mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
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:
@@ -484,6 +484,8 @@ export const createNewLocalAppSettingWithIcon = `$(add) ${createNewLocalAppSetti
|
||||
export const valueMustNotBeEmpty = localize('valueMustNotBeEmpty', "Value must not be empty");
|
||||
export const enterConnectionStringSettingName = localize('enterConnectionStringSettingName', "Enter connection string setting name");
|
||||
export const enterConnectionString = localize('enterConnectionString', "Enter connection string");
|
||||
export const saveChangesInFile = localize('saveChangesInFile', "There are unsaved changes in the current file. Save now?");
|
||||
export const save = localize('save', "Save");
|
||||
export function settingAlreadyExists(settingName: string) { return localize('SettingAlreadyExists', 'Local app setting \'{0}\' already exists. Overwrite?', settingName); }
|
||||
export function failedToParse(errorMessage: string) { return localize('failedToParse', 'Failed to parse "{0}": {1}.', azureFunctionLocalSettingsFileName, errorMessage); }
|
||||
export function jsonParseError(error: string, line: number, column: number) { return localize('jsonParseError', '{0} near line "{1}", column "{2}"', error, line, column); }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user