mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add no-floating-promises rule to sql-database-projects extension (#16943)
* Add no-floating-promises rule to sql-database-projects extension * fix test
This commit is contained in:
13
extensions/sql-database-projects/.eslintrc.json
Normal file
13
extensions/sql-database-projects/.eslintrc.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"parserOptions": {
|
||||||
|
"project": "./extensions/sql-database-projects/tsconfig.json"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/no-floating-promises": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ignoreVoid": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,33 +51,33 @@ export default class MainController implements vscode.Disposable {
|
|||||||
|
|
||||||
private async initializeDatabaseProjects(): Promise<void> {
|
private async initializeDatabaseProjects(): Promise<void> {
|
||||||
// init commands
|
// init commands
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.properties', async (node: WorkspaceTreeItem) => { await vscode.window.showErrorMessage(`Properties not yet implemented: ${node.element.uri.path}`); }); // TODO
|
vscode.commands.registerCommand('sqlDatabaseProjects.properties', async (node: WorkspaceTreeItem) => { return vscode.window.showErrorMessage(`Properties not yet implemented: ${node.element.uri.path}`); }); // TODO
|
||||||
|
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.build', async (node: WorkspaceTreeItem) => { await this.projectsController.buildProject(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.build', async (node: WorkspaceTreeItem) => { return this.projectsController.buildProject(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.publish', async (node: WorkspaceTreeItem) => { this.projectsController.publishProject(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.publish', async (node: WorkspaceTreeItem) => { this.projectsController.publishProject(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.deployLocal', async (node: WorkspaceTreeItem) => { this.projectsController.deployProject(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.deployLocal', async (node: WorkspaceTreeItem) => { return this.projectsController.deployProject(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.schemaCompare', async (node: WorkspaceTreeItem) => { await this.projectsController.schemaCompare(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.schemaCompare', async (node: WorkspaceTreeItem) => { return this.projectsController.schemaCompare(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.createProjectFromDatabase', async (context: azdataType.IConnectionProfile | vscodeMssql.ITreeNodeInfo | undefined) => { await this.projectsController.createProjectFromDatabase(context); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.createProjectFromDatabase', async (context: azdataType.IConnectionProfile | vscodeMssql.ITreeNodeInfo | undefined) => { return this.projectsController.createProjectFromDatabase(context); });
|
||||||
|
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.newScript', async (node: WorkspaceTreeItem) => { await this.projectsController.addItemPromptFromNode(node, templates.script); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.newScript', async (node: WorkspaceTreeItem) => { return this.projectsController.addItemPromptFromNode(node, templates.script); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.newPreDeploymentScript', async (node: WorkspaceTreeItem) => { await this.projectsController.addItemPromptFromNode(node, templates.preDeployScript); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.newPreDeploymentScript', async (node: WorkspaceTreeItem) => { return this.projectsController.addItemPromptFromNode(node, templates.preDeployScript); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.newPostDeploymentScript', async (node: WorkspaceTreeItem) => { await this.projectsController.addItemPromptFromNode(node, templates.postDeployScript); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.newPostDeploymentScript', async (node: WorkspaceTreeItem) => { return this.projectsController.addItemPromptFromNode(node, templates.postDeployScript); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.newTable', async (node: WorkspaceTreeItem) => { await this.projectsController.addItemPromptFromNode(node, templates.table); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.newTable', async (node: WorkspaceTreeItem) => { return this.projectsController.addItemPromptFromNode(node, templates.table); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.newView', async (node: WorkspaceTreeItem) => { await this.projectsController.addItemPromptFromNode(node, templates.view); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.newView', async (node: WorkspaceTreeItem) => { return this.projectsController.addItemPromptFromNode(node, templates.view); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.newStoredProcedure', async (node: WorkspaceTreeItem) => { await this.projectsController.addItemPromptFromNode(node, templates.storedProcedure); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.newStoredProcedure', async (node: WorkspaceTreeItem) => { return this.projectsController.addItemPromptFromNode(node, templates.storedProcedure); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.newExternalStreamingJob', async (node: WorkspaceTreeItem) => { await this.projectsController.addItemPromptFromNode(node, templates.externalStreamingJob); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.newExternalStreamingJob', async (node: WorkspaceTreeItem) => { return this.projectsController.addItemPromptFromNode(node, templates.externalStreamingJob); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.newItem', async (node: WorkspaceTreeItem) => { await this.projectsController.addItemPromptFromNode(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.newItem', async (node: WorkspaceTreeItem) => { return this.projectsController.addItemPromptFromNode(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.newFolder', async (node: WorkspaceTreeItem) => { await this.projectsController.addFolderPrompt(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.newFolder', async (node: WorkspaceTreeItem) => { return this.projectsController.addFolderPrompt(node); });
|
||||||
|
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.addDatabaseReference', async (node: WorkspaceTreeItem) => { await this.projectsController.addDatabaseReference(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.addDatabaseReference', async (node: WorkspaceTreeItem) => { return this.projectsController.addDatabaseReference(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.openContainingFolder', async (node: WorkspaceTreeItem) => { await this.projectsController.openContainingFolder(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.openContainingFolder', async (node: WorkspaceTreeItem) => { return this.projectsController.openContainingFolder(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.editProjectFile', async (node: WorkspaceTreeItem) => { await this.projectsController.editProjectFile(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.editProjectFile', async (node: WorkspaceTreeItem) => { return this.projectsController.editProjectFile(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.delete', async (node: WorkspaceTreeItem) => { await this.projectsController.delete(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.delete', async (node: WorkspaceTreeItem) => { return this.projectsController.delete(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.exclude', async (node: WorkspaceTreeItem) => { await this.projectsController.exclude(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.exclude', async (node: WorkspaceTreeItem) => { return this.projectsController.exclude(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.changeTargetPlatform', async (node: WorkspaceTreeItem) => { await this.projectsController.changeTargetPlatform(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.changeTargetPlatform', async (node: WorkspaceTreeItem) => { return this.projectsController.changeTargetPlatform(node); });
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.validateExternalStreamingJob', async (node: WorkspaceTreeItem) => { await this.projectsController.validateExternalStreamingJob(node); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.validateExternalStreamingJob', async (node: WorkspaceTreeItem) => { return this.projectsController.validateExternalStreamingJob(node); });
|
||||||
|
|
||||||
vscode.commands.registerCommand('sqlDatabaseProjects.addSqlBinding', async (uri: vscode.Uri | undefined) => { await launchAddSqlBindingQuickpick(uri, this.packageHelper); });
|
vscode.commands.registerCommand('sqlDatabaseProjects.addSqlBinding', async (uri: vscode.Uri | undefined) => { return launchAddSqlBindingQuickpick(uri, this.packageHelper); });
|
||||||
|
|
||||||
IconPathHelper.setExtensionContext(this.extensionContext);
|
IconPathHelper.setExtensionContext(this.extensionContext);
|
||||||
|
|
||||||
|
|||||||
@@ -247,9 +247,9 @@ export class ProjectsController {
|
|||||||
|
|
||||||
const message = utils.getErrorMessage(err);
|
const message = utils.getErrorMessage(err);
|
||||||
if (err instanceof DotNetError) {
|
if (err instanceof DotNetError) {
|
||||||
vscode.window.showErrorMessage(message);
|
void vscode.window.showErrorMessage(message);
|
||||||
} else {
|
} else {
|
||||||
vscode.window.showErrorMessage(constants.projBuildFailed(message));
|
void vscode.window.showErrorMessage(constants.projBuildFailed(message));
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -281,16 +281,16 @@ export class ProjectsController {
|
|||||||
if (deployProfile.localDbSetting) {
|
if (deployProfile.localDbSetting) {
|
||||||
await this.deployService.getConnection(deployProfile.localDbSetting, true, deployProfile.localDbSetting.dbName);
|
await this.deployService.getConnection(deployProfile.localDbSetting, true, deployProfile.localDbSetting.dbName);
|
||||||
}
|
}
|
||||||
vscode.window.showInformationMessage(constants.deployProjectSucceed);
|
void vscode.window.showInformationMessage(constants.deployProjectSucceed);
|
||||||
} else {
|
} else {
|
||||||
vscode.window.showErrorMessage(constants.deployProjectFailed(publishResult?.errorMessage || ''));
|
void vscode.window.showErrorMessage(constants.deployProjectFailed(publishResult?.errorMessage || ''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vscode.window.showErrorMessage(constants.deployProjectFailed(constants.deployProjectFailedMessage));
|
void vscode.window.showErrorMessage(constants.deployProjectFailed(constants.deployProjectFailedMessage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
vscode.window.showErrorMessage(constants.deployProjectFailed(utils.getErrorMessage(error)));
|
void vscode.window.showErrorMessage(constants.deployProjectFailed(utils.getErrorMessage(error)));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -318,7 +318,7 @@ export class ProjectsController {
|
|||||||
|
|
||||||
return publishDatabaseDialog;
|
return publishDatabaseDialog;
|
||||||
} else {
|
} else {
|
||||||
launchPublishDatabaseQuickpick(project, this);
|
void launchPublishDatabaseQuickpick(project, this);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,7 @@ export class ProjectsController {
|
|||||||
.withAdditionalProperties(props)
|
.withAdditionalProperties(props)
|
||||||
.send();
|
.send();
|
||||||
|
|
||||||
vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,7 +476,7 @@ export class ProjectsController {
|
|||||||
await project.addFolderItem(relativeFolderPath);
|
await project.addFolderItem(relativeFolderPath);
|
||||||
this.refreshProjectsTree(treeNode);
|
this.refreshProjectsTree(treeNode);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,7 +540,7 @@ export class ProjectsController {
|
|||||||
await vscode.commands.executeCommand(constants.vscodeOpenCommand, newEntry.fsUri);
|
await vscode.commands.executeCommand(constants.vscodeOpenCommand, newEntry.fsUri);
|
||||||
treeDataProvider?.notifyTreeDataChanged();
|
treeDataProvider?.notifyTreeDataChanged();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
|
|
||||||
TelemetryReporter.createErrorEvent(TelemetryViews.ProjectTree, TelemetryActions.addItemFromTree)
|
TelemetryReporter.createErrorEvent(TelemetryViews.ProjectTree, TelemetryActions.addItemFromTree)
|
||||||
.withAdditionalProperties(telemetryProps)
|
.withAdditionalProperties(telemetryProps)
|
||||||
@@ -560,7 +560,7 @@ export class ProjectsController {
|
|||||||
await project.exclude(fileEntry);
|
await project.exclude(fileEntry);
|
||||||
} else {
|
} else {
|
||||||
TelemetryReporter.sendErrorEvent(TelemetryViews.ProjectTree, TelemetryActions.excludeFromProject);
|
TelemetryReporter.sendErrorEvent(TelemetryViews.ProjectTree, TelemetryActions.excludeFromProject);
|
||||||
vscode.window.showErrorMessage(constants.unableToPerformAction(constants.excludeAction, node.projectUri.path));
|
void vscode.window.showErrorMessage(constants.unableToPerformAction(constants.excludeAction, node.projectUri.path));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refreshProjectsTree(context);
|
this.refreshProjectsTree(context);
|
||||||
@@ -614,7 +614,7 @@ export class ProjectsController {
|
|||||||
.withAdditionalProperties({ objectType: node.constructor.name })
|
.withAdditionalProperties({ objectType: node.constructor.name })
|
||||||
.send();
|
.send();
|
||||||
|
|
||||||
vscode.window.showErrorMessage(constants.unableToPerformAction(constants.deleteAction, node.projectUri.path));
|
void vscode.window.showErrorMessage(constants.unableToPerformAction(constants.deleteAction, node.projectUri.path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,7 +670,7 @@ export class ProjectsController {
|
|||||||
const result = await vscode.window.showInformationMessage(constants.reloadProject, constants.yesString, constants.noString);
|
const result = await vscode.window.showInformationMessage(constants.reloadProject, constants.yesString, constants.noString);
|
||||||
|
|
||||||
if (result === constants.yesString) {
|
if (result === constants.yesString) {
|
||||||
this.reloadProject(context);
|
return this.reloadProject(context);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -683,7 +683,7 @@ export class ProjectsController {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,7 +716,7 @@ export class ProjectsController {
|
|||||||
|
|
||||||
if (selectedTargetPlatform) {
|
if (selectedTargetPlatform) {
|
||||||
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(selectedTargetPlatform)!);
|
await project.changeTargetPlatform(constants.targetPlatformToVersion.get(selectedTargetPlatform)!);
|
||||||
vscode.window.showInformationMessage(constants.currentTargetPlatform(project.projectFileName, constants.getTargetPlatformFromVersion(project.getProjectTargetVersion())));
|
void vscode.window.showInformationMessage(constants.currentTargetPlatform(project.projectFileName, constants.getTargetPlatformFromVersion(project.getProjectTargetVersion())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -731,7 +731,7 @@ export class ProjectsController {
|
|||||||
const addDatabaseReferenceDialog = this.getAddDatabaseReferenceDialog(project);
|
const addDatabaseReferenceDialog = this.getAddDatabaseReferenceDialog(project);
|
||||||
addDatabaseReferenceDialog.addReference = async (proj, settings) => await this.addDatabaseReferenceCallback(proj, settings, context as dataworkspace.WorkspaceTreeItem);
|
addDatabaseReferenceDialog.addReference = async (proj, settings) => await this.addDatabaseReferenceCallback(proj, settings, context as dataworkspace.WorkspaceTreeItem);
|
||||||
|
|
||||||
addDatabaseReferenceDialog.openDialog();
|
await addDatabaseReferenceDialog.openDialog();
|
||||||
return addDatabaseReferenceDialog;
|
return addDatabaseReferenceDialog;
|
||||||
} else {
|
} else {
|
||||||
const settings = await addDatabaseReferenceQuickpick(project);
|
const settings = await addDatabaseReferenceQuickpick(project);
|
||||||
@@ -767,7 +767,7 @@ export class ProjectsController {
|
|||||||
// check for cirular dependency
|
// check for cirular dependency
|
||||||
for (let r of projectReferences) {
|
for (let r of projectReferences) {
|
||||||
if ((<SqlProjectReferenceProjectEntry>r).projectName === project.projectFileName) {
|
if ((<SqlProjectReferenceProjectEntry>r).projectName === project.projectFileName) {
|
||||||
vscode.window.showErrorMessage(constants.cantAddCircularProjectReference(referencedProject?.projectFileName!));
|
void vscode.window.showErrorMessage(constants.cantAddCircularProjectReference(referencedProject?.projectFileName!));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -784,7 +784,7 @@ export class ProjectsController {
|
|||||||
|
|
||||||
this.refreshProjectsTree(context);
|
this.refreshProjectsTree(context);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -817,10 +817,10 @@ export class ProjectsController {
|
|||||||
telemetryProps.success = result.success.toString();
|
telemetryProps.success = result.success.toString();
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
vscode.window.showInformationMessage(constants.externalStreamingJobValidationPassed);
|
void vscode.window.showInformationMessage(constants.externalStreamingJobValidationPassed);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vscode.window.showErrorMessage(result.errorMessage);
|
void vscode.window.showErrorMessage(result.errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
TelemetryReporter.createActionEvent(TelemetryViews.ProjectTree, TelemetryActions.runStreamingJobValidation)
|
TelemetryReporter.createActionEvent(TelemetryViews.ProjectTree, TelemetryActions.runStreamingJobValidation)
|
||||||
@@ -985,7 +985,7 @@ export class ProjectsController {
|
|||||||
await workspaceApi.addProjectsToWorkspace([vscode.Uri.file(newProjFilePath)]);
|
await workspaceApi.addProjectsToWorkspace([vscode.Uri.file(newProjFilePath)]);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1027,7 +1027,7 @@ export class ProjectsController {
|
|||||||
if (await utils.exists(absolutePath + constants.sqlFileExtension)) {
|
if (await utils.exists(absolutePath + constants.sqlFileExtension)) {
|
||||||
absolutePath += constants.sqlFileExtension;
|
absolutePath += constants.sqlFileExtension;
|
||||||
} else {
|
} else {
|
||||||
vscode.window.showErrorMessage(constants.cannotResolvePath(absolutePath));
|
void vscode.window.showErrorMessage(constants.cannotResolvePath(absolutePath));
|
||||||
return fileFolderList;
|
return fileFolderList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,9 +139,9 @@ export class AddDatabaseReferenceDialog {
|
|||||||
this.updateEnabledInputBoxes();
|
this.updateEnabledInputBoxes();
|
||||||
|
|
||||||
if (this.currentReferenceType === ReferenceType.project) {
|
if (this.currentReferenceType === ReferenceType.project) {
|
||||||
this.projectRadioButton?.focus();
|
await this.projectRadioButton?.focus();
|
||||||
} else {
|
} else {
|
||||||
this.systemDatabaseRadioButton?.focus();
|
await this.systemDatabaseRadioButton?.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.initDialogComplete?.resolve();
|
this.initDialogComplete?.resolve();
|
||||||
@@ -559,7 +559,7 @@ export class AddDatabaseReferenceDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.exampleUsage!.value = newText;
|
this.exampleUsage!.value = newText;
|
||||||
this.exampleUsage?.updateCssStyles({ 'font-style': fontStyle });
|
void this.exampleUsage?.updateCssStyles({ 'font-style': fontStyle });
|
||||||
}
|
}
|
||||||
|
|
||||||
private validSqlCmdVariables(): boolean {
|
private validSqlCmdVariables(): boolean {
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ export async function launchAddSqlBindingQuickpick(uri: vscode.Uri | undefined,
|
|||||||
try {
|
try {
|
||||||
getAzureFunctionsResult = await azureFunctionsService.getAzureFunctions(uri.fsPath);
|
getAzureFunctionsResult = await azureFunctionsService.getAzureFunctions(uri.fsPath);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
vscode.window.showErrorMessage(e);
|
void vscode.window.showErrorMessage(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const azureFunctions = getAzureFunctionsResult.azureFunctions;
|
const azureFunctions = getAzureFunctionsResult.azureFunctions;
|
||||||
|
|
||||||
if (azureFunctions.length === 0) {
|
if (azureFunctions.length === 0) {
|
||||||
vscode.window.showErrorMessage(constants.noAzureFunctionsInFile);
|
void vscode.window.showErrorMessage(constants.noAzureFunctionsInFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,11 +89,11 @@ export async function launchAddSqlBindingQuickpick(uri: vscode.Uri | undefined,
|
|||||||
const result = await azureFunctionsService.addSqlBinding(selectedBinding.type, uri.fsPath, azureFunctionName, objectName, connectionStringSetting);
|
const result = await azureFunctionsService.addSqlBinding(selectedBinding.type, uri.fsPath, azureFunctionName, objectName, connectionStringSetting);
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
vscode.window.showErrorMessage(result.errorMessage);
|
void vscode.window.showErrorMessage(result.errorMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
vscode.window.showErrorMessage(e);
|
void vscode.window.showErrorMessage(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ export class CreateProjectFromDatabaseDialog {
|
|||||||
|
|
||||||
let formModel = this.formBuilder.component();
|
let formModel = this.formBuilder.component();
|
||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
this.selectConnectionButton?.focus();
|
await this.selectConnectionButton?.focus();
|
||||||
this.initDialogComplete?.resolve();
|
this.initDialogComplete?.resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ export class CreateProjectFromDatabaseDialog {
|
|||||||
|
|
||||||
private async updateConnectionComponents(connectionTextboxValue: string, connectionId: string, databaseName?: string) {
|
private async updateConnectionComponents(connectionTextboxValue: string, connectionId: string, databaseName?: string) {
|
||||||
this.sourceConnectionTextBox!.value = connectionTextboxValue;
|
this.sourceConnectionTextBox!.value = connectionTextboxValue;
|
||||||
this.sourceConnectionTextBox!.updateProperty('title', connectionTextboxValue);
|
void this.sourceConnectionTextBox!.updateProperty('title', connectionTextboxValue);
|
||||||
|
|
||||||
// populate database dropdown with the databases for this connection
|
// populate database dropdown with the databases for this connection
|
||||||
if (connectionId) {
|
if (connectionId) {
|
||||||
@@ -249,7 +249,7 @@ export class CreateProjectFromDatabaseDialog {
|
|||||||
|
|
||||||
this.projectNameTextBox.onTextChanged(() => {
|
this.projectNameTextBox.onTextChanged(() => {
|
||||||
this.projectNameTextBox!.value = this.projectNameTextBox!.value?.trim();
|
this.projectNameTextBox!.value = this.projectNameTextBox!.value?.trim();
|
||||||
this.projectNameTextBox!.updateProperty('title', this.projectNameTextBox!.value);
|
void this.projectNameTextBox!.updateProperty('title', this.projectNameTextBox!.value);
|
||||||
this.tryEnableCreateButton();
|
this.tryEnableCreateButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ export class CreateProjectFromDatabaseDialog {
|
|||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
this.projectLocationTextBox.onTextChanged(() => {
|
this.projectLocationTextBox.onTextChanged(() => {
|
||||||
this.projectLocationTextBox!.updateProperty('title', this.projectLocationTextBox!.value);
|
void this.projectLocationTextBox!.updateProperty('title', this.projectLocationTextBox!.value);
|
||||||
this.tryEnableCreateButton();
|
this.tryEnableCreateButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ export class CreateProjectFromDatabaseDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.projectLocationTextBox!.value = folderUris[0].fsPath;
|
this.projectLocationTextBox!.value = folderUris[0].fsPath;
|
||||||
this.projectLocationTextBox!.updateProperty('title', folderUris[0].fsPath);
|
void this.projectLocationTextBox!.updateProperty('title', folderUris[0].fsPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
return browseFolderButton;
|
return browseFolderButton;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ export class PublishDatabaseDialog {
|
|||||||
let formModel = this.formBuilder.component();
|
let formModel = this.formBuilder.component();
|
||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
|
|
||||||
this.loadProfileTextBox!.focus();
|
await this.loadProfileTextBox!.focus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +464,7 @@ export class PublishDatabaseDialog {
|
|||||||
this.sqlCmdVars = { ...this.project.sqlCmdVariables };
|
this.sqlCmdVars = { ...this.project.sqlCmdVariables };
|
||||||
|
|
||||||
const data = this.convertSqlCmdVarsToTableFormat(this.sqlCmdVars!);
|
const data = this.convertSqlCmdVarsToTableFormat(this.sqlCmdVars!);
|
||||||
(<azdataType.DeclarativeTableComponent>this.sqlCmdVariablesTable)!.updateProperties({
|
await (<azdataType.DeclarativeTableComponent>this.sqlCmdVariablesTable)!.updateProperties({
|
||||||
dataValues: data
|
dataValues: data
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ export class PublishDatabaseDialog {
|
|||||||
|
|
||||||
let connectionTextboxValue: string = getConnectionName(connection);
|
let connectionTextboxValue: string = getConnectionName(connection);
|
||||||
|
|
||||||
this.updateConnectionComponents(connectionTextboxValue, this.connectionId);
|
await this.updateConnectionComponents(connectionTextboxValue, this.connectionId);
|
||||||
|
|
||||||
// change the database inputbox value to the connection's database if there is one
|
// change the database inputbox value to the connection's database if there is one
|
||||||
if (connection.options.database && connection.options.database !== constants.master) {
|
if (connection.options.database && connection.options.database !== constants.master) {
|
||||||
@@ -505,7 +505,7 @@ export class PublishDatabaseDialog {
|
|||||||
|
|
||||||
private async updateConnectionComponents(connectionTextboxValue: string, connectionId: string) {
|
private async updateConnectionComponents(connectionTextboxValue: string, connectionId: string) {
|
||||||
this.targetConnectionTextBox!.value = connectionTextboxValue;
|
this.targetConnectionTextBox!.value = connectionTextboxValue;
|
||||||
this.targetConnectionTextBox!.updateProperty('title', connectionTextboxValue);
|
await this.targetConnectionTextBox!.updateProperty('title', connectionTextboxValue);
|
||||||
|
|
||||||
// populate database dropdown with the databases for this connection
|
// populate database dropdown with the databases for this connection
|
||||||
if (connectionId) {
|
if (connectionId) {
|
||||||
@@ -569,7 +569,7 @@ export class PublishDatabaseDialog {
|
|||||||
|
|
||||||
// show file path in text box and hover text
|
// show file path in text box and hover text
|
||||||
this.loadProfileTextBox!.value = fileUris[0].fsPath;
|
this.loadProfileTextBox!.value = fileUris[0].fsPath;
|
||||||
this.loadProfileTextBox!.updateProperty('title', fileUris[0].fsPath);
|
await this.loadProfileTextBox!.updateProperty('title', fileUris[0].fsPath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { SqlDatabaseProjectProvider } from './projectProvider/projectProvider';
|
|||||||
let controllers: MainController[] = [];
|
let controllers: MainController[] = [];
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext): Promise<SqlDatabaseProjectProvider> {
|
export function activate(context: vscode.ExtensionContext): Promise<SqlDatabaseProjectProvider> {
|
||||||
vscode.commands.executeCommand('setContext', 'azdataAvailable', !!getAzdataApi());
|
void vscode.commands.executeCommand('setContext', 'azdataAvailable', !!getAzdataApi());
|
||||||
// Start the main controller
|
// Start the main controller
|
||||||
const mainController = new MainController(context);
|
const mainController = new MainController(context);
|
||||||
controllers.push(mainController);
|
controllers.push(mainController);
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ export class Project implements ISqlProject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (preDeployScriptCount > 1 || postDeployScriptCount > 1) {
|
if (preDeployScriptCount > 1 || postDeployScriptCount > 1) {
|
||||||
window.showWarningMessage(constants.prePostDeployCount, constants.okString);
|
void window.showWarningMessage(constants.prePostDeployCount, constants.okString);
|
||||||
}
|
}
|
||||||
|
|
||||||
// find all none-deployment scripts to include
|
// find all none-deployment scripts to include
|
||||||
@@ -630,7 +630,7 @@ export class Project implements ISqlProject {
|
|||||||
itemGroup = this.findOrCreateItemGroup(xmlTag, prePostScriptExist);
|
itemGroup = this.findOrCreateItemGroup(xmlTag, prePostScriptExist);
|
||||||
|
|
||||||
if (prePostScriptExist.scriptExist === true) {
|
if (prePostScriptExist.scriptExist === true) {
|
||||||
window.showInformationMessage(constants.deployScriptExists(xmlTag));
|
void window.showInformationMessage(constants.deployScriptExists(xmlTag));
|
||||||
xmlTag = constants.None; // Add only one pre-deploy and post-deploy script. All additional ones get added in the same item group with None tag
|
xmlTag = constants.None; // Add only one pre-deploy and post-deploy script. All additional ones get added in the same item group with None tag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export async function readPublishProfile(profileUri: vscode.Uri): Promise<Publis
|
|||||||
const profile = await load(profileUri, dacFxService);
|
const profile = await load(profileUri, dacFxService);
|
||||||
return profile;
|
return profile;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
vscode.window.showErrorMessage(constants.profileReadError(e));
|
void vscode.window.showErrorMessage(constants.profileReadError(e));
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -568,11 +568,11 @@ describe('ProjectsController', function (): void {
|
|||||||
const addDbReferenceDialog = TypeMoq.Mock.ofType(AddDatabaseReferenceDialog, undefined, undefined, proj);
|
const addDbReferenceDialog = TypeMoq.Mock.ofType(AddDatabaseReferenceDialog, undefined, undefined, proj);
|
||||||
addDbReferenceDialog.callBase = true;
|
addDbReferenceDialog.callBase = true;
|
||||||
addDbReferenceDialog.setup(x => x.addReferenceClick()).returns(() => {
|
addDbReferenceDialog.setup(x => x.addReferenceClick()).returns(() => {
|
||||||
projController.object.addDatabaseReferenceCallback(proj,
|
return projController.object.addDatabaseReferenceCallback(proj,
|
||||||
{ systemDb: SystemDatabase.master, databaseName: 'master', suppressMissingDependenciesErrors: false },
|
{ systemDb: SystemDatabase.master, databaseName: 'master', suppressMissingDependenciesErrors: false },
|
||||||
{ treeDataProvider: new SqlDatabaseProjectTreeViewProvider(), element: undefined });
|
{ treeDataProvider: new SqlDatabaseProjectTreeViewProvider(), element: undefined });
|
||||||
return Promise.resolve(undefined);
|
|
||||||
});
|
});
|
||||||
|
addDbReferenceDialog.setup(x => x.openDialog()).returns(() => Promise.resolve());
|
||||||
|
|
||||||
const projController = TypeMoq.Mock.ofType(ProjectsController);
|
const projController = TypeMoq.Mock.ofType(ProjectsController);
|
||||||
projController.callBase = true;
|
projController.callBase = true;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export class NetCoreTool {
|
|||||||
public async findOrInstallNetCore(): Promise<boolean> {
|
public async findOrInstallNetCore(): Promise<boolean> {
|
||||||
if ((!this.isNetCoreInstallationPresent || !await this.isNetCoreVersionSupported())) {
|
if ((!this.isNetCoreInstallationPresent || !await this.isNetCoreVersionSupported())) {
|
||||||
if (vscode.workspace.getConfiguration(DBProjectConfigurationKey)[NetCoreDoNotAskAgainKey] !== true) {
|
if (vscode.workspace.getConfiguration(DBProjectConfigurationKey)[NetCoreDoNotAskAgainKey] !== true) {
|
||||||
this.showInstallDialog(); // Removing await so that Build and extension load process doesn't wait on user input
|
void this.showInstallDialog(); // Removing await so that Build and extension load process doesn't wait on user input
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ export class NetCoreTool {
|
|||||||
outputChannel.show();
|
outputChannel.show();
|
||||||
|
|
||||||
// Add listeners to print stdout and stderr and exit code
|
// Add listeners to print stdout and stderr and exit code
|
||||||
child.on('exit', (code: number | null, signal: string | null) => {
|
void child.on('exit', (code: number | null, signal: string | null) => {
|
||||||
if (code !== null) {
|
if (code !== null) {
|
||||||
outputChannel.appendLine(localize('sqlDatabaseProjects.RunStreamedCommand.ExitedWithCode', " >>> {0} … exited with code: {1}", command, code));
|
outputChannel.appendLine(localize('sqlDatabaseProjects.RunStreamedCommand.ExitedWithCode', " >>> {0} … exited with code: {1}", command, code));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export class PackageHelper {
|
|||||||
await this.addPackage(project, packageName, packageVersion);
|
await this.addPackage(project, packageName, packageVersion);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
vscode.window.showErrorMessage(e.message);
|
void vscode.window.showErrorMessage(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ export class PackageHelper {
|
|||||||
// TODO: figure out which project contains the file
|
// TODO: figure out which project contains the file
|
||||||
// the new style csproj doesn't list all the files in the project anymore, unless the file isn't in the same folder
|
// the new style csproj doesn't list all the files in the project anymore, unless the file isn't in the same folder
|
||||||
// so we can't rely on using that to check
|
// so we can't rely on using that to check
|
||||||
vscode.window.showInformationMessage(`To use SQL bindings, ensure your Azure Functions project has a reference to ${constants.sqlExtensionPackageName}`);
|
void vscode.window.showInformationMessage(`To use SQL bindings, ensure your Azure Functions project has a reference to ${constants.sqlExtensionPackageName}`);
|
||||||
console.error('need to find which project contains the file ' + filePath);
|
console.error('need to find which project contains the file ' + filePath);
|
||||||
return undefined;
|
return undefined;
|
||||||
} else if (functionsProjects.length === 0) {
|
} else if (functionsProjects.length === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user