|
1 | | -import { Uri, ViewColumn, window, workspace } from "vscode"; |
| 1 | +import { Uri, ViewColumn, window } from "vscode"; |
2 | 2 | import { CodeQLCliServer } from "../codeql-cli/cli"; |
3 | 3 | import { QueryRunner } from "../query-server"; |
4 | 4 | import { basename, join } from "path"; |
@@ -74,16 +74,17 @@ async function previewQueryHelp( |
74 | 74 | const uri = Uri.file(absolutePathToMd); |
75 | 75 | try { |
76 | 76 | 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. |
79 | 81 | await window.showTextDocument(uri, { |
80 | 82 | viewColumn: ViewColumn.Active, |
81 | 83 | }); |
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); |
86 | 84 | await commandManager.execute("workbench.action.closeActiveEditor"); |
| 85 | + |
| 86 | + // Now open the preview |
| 87 | + await commandManager.execute("markdown.showPreviewToSide", uri); |
87 | 88 | } catch (e) { |
88 | 89 | const errorMessage = getErrorMessage(e).includes( |
89 | 90 | "Generating qhelp in markdown", |
|
0 commit comments