Skip to content

Commit

Permalink
DA#302: Added: Save document while running the Query
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushTyagi1 committed Oct 4, 2023
1 parent 0e66012 commit 5caad37
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/commands/queryHistory/applyQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const applyQuery = async (query: IQuery) => {
return;
}
const activeTextEditor = vscode.window.activeTextEditor;
activeTextEditor?.document.save();
if (
activeTextEditor &&
activeTextEditor.document.languageId === "SQL++"
Expand Down
3 changes: 2 additions & 1 deletion src/workbench/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ export default class UntitledSqlppDocumentService {
});

const document = await vscode.workspace.openTextDocument(uri);
document.save();
await vscode.window.showTextDocument(document, { preview: false });
return vscode.workspace.openTextDocument(uri);
return document;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/workbench/queryWorkbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class QueryWorkbench {
}
// Get the active text editor
const activeTextEditor = vscode.window.activeTextEditor;
activeTextEditor?.document.save();
if (activeTextEditor && activeTextEditor.document.languageId === "SQL++") {
// Get the text content of the active text editor.
const query = activeTextEditor.selection.isEmpty ? activeTextEditor.document.getText() : activeTextEditor.document.getText(activeTextEditor.selection);
Expand Down

0 comments on commit 5caad37

Please sign in to comment.