Add missing await (#11275)

* Add missing await

* Addressed comment
This commit is contained in:
Sakshi Sharma
2020-07-10 11:26:18 -07:00
committed by GitHub
parent 95b024ed66
commit 3e860692a2
3 changed files with 16 additions and 17 deletions

View File

@@ -77,7 +77,7 @@ export default class MainController implements Disposable {
await templates.loadTemplates(path.join(this.context.extensionPath, 'resources', 'templates'));
// ensure .net core is installed
this.netcoreTool.findOrInstallNetCore();
await this.netcoreTool.findOrInstallNetCore();
}
/**

View File

@@ -261,7 +261,7 @@ export class ProjectsController {
// check that dacpac exists
if (await utils.exists(dacpacPath)) {
this.apiWrapper.executeCommand(constants.schemaCompareStartCommand, dacpacPath);
await this.apiWrapper.executeCommand(constants.schemaCompareStartCommand, dacpacPath);
} else {
this.apiWrapper.showErrorMessage(constants.buildDacpacNotFound);
}
@@ -346,7 +346,7 @@ export class ProjectsController {
const newEntry = await project.addScriptItem(relativeFilePath, newFileText);
this.apiWrapper.executeCommand(constants.vscodeOpenCommand, newEntry.fsUri);
await this.apiWrapper.executeCommand(constants.vscodeOpenCommand, newEntry.fsUri);
this.refreshProjectsTree();
} catch (err) {

View File

@@ -34,26 +34,25 @@ export class NetCoreTool {
private _outputChannel: vscode.OutputChannel = vscode.window.createOutputChannel(projectsOutputChannel);
public findOrInstallNetCore(): boolean {
public async findOrInstallNetCore(): Promise<boolean> {
if (!this.isNetCoreInstallationPresent) {
this.showInstallDialog();
await this.showInstallDialog();
return false;
}
return true;
}
private showInstallDialog(): void {
vscode.window.showInformationMessage(NetCoreInstallationConfirmation, UpdateNetCoreLocation, InstallNetCore).then(async (result) => {
if (result === UpdateNetCoreLocation) {
//open settings
vscode.commands.executeCommand('workbench.action.openGlobalSettings');
}
else if (result === InstallNetCore) {
//open install link
const dotnetcoreURL = 'https://dotnet.microsoft.com/download/dotnet-core/3.1';
vscode.env.openExternal(vscode.Uri.parse(dotnetcoreURL));
}
});
private async showInstallDialog(): Promise<void> {
let result = await vscode.window.showInformationMessage(NetCoreInstallationConfirmation, UpdateNetCoreLocation, InstallNetCore);
if (result === UpdateNetCoreLocation) {
//open settings
await vscode.commands.executeCommand('workbench.action.openGlobalSettings');
}
else if (result === InstallNetCore) {
//open install link
const dotnetcoreURL = 'https://dotnet.microsoft.com/download/dotnet-core/3.1';
await vscode.env.openExternal(vscode.Uri.parse(dotnetcoreURL));
}
}
private get isNetCoreInstallationPresent(): Boolean {