Check if file is dirty before adding sql binding (#17175)

* check if file is dirty before adding sql binding

* Addressing comments
This commit is contained in:
Kim Santiago
2021-09-29 15:26:14 -07:00
committed by GitHub
parent ccc440f471
commit b2e9e30529
2 changed files with 12 additions and 0 deletions

View File

@@ -14,6 +14,16 @@ export async function launchAddSqlBindingQuickpick(uri: vscode.Uri | undefined,
// this command only shows in the command palette when the active editor is a .cs file, so we can safely assume that's the scenario
// when this is called without a uri
uri = vscode.window.activeTextEditor!.document.uri;
if (vscode.window.activeTextEditor!.document.isDirty) {
const result = await vscode.window.showWarningMessage(constants.saveChangesInFile, { modal: true }, constants.save);
if (result !== constants.save) {
return;
}
await vscode.window.activeTextEditor!.document.save();
}
}
// get all the Azure functions in the file