Skip to content

Commit d7d1351

Browse files
committed
Remove unused import
1 parent 2ce5ff7 commit d7d1351

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

extensions/ql-vscode/src/language-support/query-editor.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Uri, ViewColumn, window, workspace } from "vscode";
1+
import { Uri, ViewColumn, window } from "vscode";
22
import { CodeQLCliServer } from "../codeql-cli/cli";
33
import { QueryRunner } from "../query-server";
44
import { basename, join } from "path";
@@ -74,16 +74,17 @@ async function previewQueryHelp(
7474
const uri = Uri.file(absolutePathToMd);
7575
try {
7676
await cliServer.generateQueryHelp(pathToQhelp, absolutePathToMd);
77-
// Open the raw markdown file as well as the rendered file.
78-
// This will force the rendered page to refresh if there has been a change to the markdown.
77+
// Open and then close the raw markdown file first. This ensures that the preview
78+
// is refreshed when we open it in the next step.
79+
// This will mean that the users will see a the raw markdown file for a brief moment,
80+
// but this is the best we can do for now to ensure that the preview is refreshed.
7981
await window.showTextDocument(uri, {
8082
viewColumn: ViewColumn.Active,
8183
});
82-
await commandManager.execute("markdown.showPreviewToSide", uri);
83-
// close the editor we just opened. Users will see a brief flicker of this editor
84-
// being opened, but doing so will ensure that the preview is refreshed.
85-
await window.showTextDocument(uri);
8684
await commandManager.execute("workbench.action.closeActiveEditor");
85+
86+
// Now open the preview
87+
await commandManager.execute("markdown.showPreviewToSide", uri);
8788
} catch (e) {
8889
const errorMessage = getErrorMessage(e).includes(
8990
"Generating qhelp in markdown",

0 commit comments

Comments
 (0)