Merge pull request #2660 from github/aeisenberg/qhelp-preview
Ensure the qhelp preview is refreshed after editing
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
- Remove "last updated" information and sorting from variant analysis results view. [#2637](https://github.com/github/vscode-codeql/pull/2637)
|
||||
- Links to code on GitHub now include column numbers as well as line numbers. [#2406](https://github.com/github/vscode-codeql/pull/2406)
|
||||
- No longer highlight trailing commas for jump to definition. [#2615](https://github.com/github/vscode-codeql/pull/2615)
|
||||
- Fix a bug where the QHelp preview page was not being refreshed after changes to the underlying `.qhelp` file. [#2660](https://github.com/github/vscode-codeql/pull/2660)
|
||||
|
||||
## 1.8.8 - 17 July 2023
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ type BuiltInVsCodeCommands = {
|
||||
// The codeQLDatabases.focus command is provided by VS Code because we've registered the custom view
|
||||
"codeQLDatabases.focus": () => Promise<void>;
|
||||
"markdown.showPreviewToSide": (uri: Uri) => Promise<void>;
|
||||
"workbench.action.closeActiveEditor": () => Promise<void>;
|
||||
revealFileInOS: (uri: Uri) => Promise<void>;
|
||||
setContext: (
|
||||
key: `${"codeql" | "codeQL"}${string}`,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Uri, window } from "vscode";
|
||||
import { Uri, ViewColumn, window } from "vscode";
|
||||
import { CodeQLCliServer } from "../codeql-cli/cli";
|
||||
import { QueryRunner } from "../query-server";
|
||||
import { basename, join } from "path";
|
||||
@@ -74,6 +74,16 @@ async function previewQueryHelp(
|
||||
const uri = Uri.file(absolutePathToMd);
|
||||
try {
|
||||
await cliServer.generateQueryHelp(pathToQhelp, absolutePathToMd);
|
||||
// Open and then close the raw markdown file first. This ensures that the preview
|
||||
// is refreshed when we open it in the next step.
|
||||
// This will mean that the users will see a the raw markdown file for a brief moment,
|
||||
// but this is the best we can do for now to ensure that the preview is refreshed.
|
||||
await window.showTextDocument(uri, {
|
||||
viewColumn: ViewColumn.Active,
|
||||
});
|
||||
await commandManager.execute("workbench.action.closeActiveEditor");
|
||||
|
||||
// Now open the preview
|
||||
await commandManager.execute("markdown.showPreviewToSide", uri);
|
||||
} catch (e) {
|
||||
const errorMessage = getErrorMessage(e).includes(
|
||||
|
||||
Reference in New Issue
Block a user