Skip to content

Commit 158fa70

Browse files
committed
adapt to graphviz interactive preview extension changes
1 parent 8d86257 commit 158fa70

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.vscode/launch.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
"type": "extensionHost",
1111
"request": "launch",
1212
"runtimeExecutable": "${execPath}",
13+
//"debugWebWorkerHost": true,
1314
"args": [
14-
"--extensionDevelopmentPath=${workspaceFolder}"
15+
"--extensionDevelopmentPath=${workspaceFolder}",
16+
//"--extensionDevelopmentKind=web"
1517
],
1618
"outFiles": [
1719
"${workspaceFolder}/out/**/*.js"

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@
2727
"vscode:prepublish": "npm run bundle -- --minify",
2828
"esbuild": "npm run bundle -- --sourcemap",
2929
"esbuild-watch": "npm run bundle -- --sourcemap --watch",
30+
"esbuild-web": "npm run bundle -- --sourcemap --platform=browser",
3031
"package": "vsce package",
32+
"publish": "vsce publish",
3133
"compile": "tsc -p ./",
3234
"lint": "eslint src --ext ts",
3335
"watch": "tsc -watch -p ./",
3436
"pretest": "npm run compile && npm run lint",
35-
"test": "node ./out/test/runTest.js"
37+
"test": "node ./out/test/runTest.js",
38+
"open-in-browser": "npm run esbuild-web && vscode-test-web --browserType=chromium --open-devtools --extensionDevelopmentPath=. --extensionId tintinweb.graphviz-interactive-preview --extensionId ms-vscode.mock-debug /tmp"
3639
},
3740
"extensionDependencies": [
3841
"tintinweb.graphviz-interactive-preview"
@@ -49,6 +52,7 @@
4952
"@typescript-eslint/parser": "^5.33.0",
5053
"@vscode/debugprotocol": "^1.57.0",
5154
"@vscode/test-electron": "^2.1.5",
55+
"@vscode/test-web": "*",
5256
"esbuild": "^0.14.54",
5357
"eslint": "^8.21.0",
5458
"glob": "^8.0.3",

src/codemap.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ export class CodeMapProvider implements vs.DebugAdapterTracker, vs.TextDocumentC
2222
const args = {
2323
document: this.dotDocument,
2424
callback: (panel: any /* PreviewPanel */) => {
25+
const graphvizConfig = vs.workspace.getConfiguration('graphviz-interactive-preview');
26+
const preserveFocus = graphvizConfig.get('preserveFocus');
27+
if (preserveFocus)
28+
return;
29+
2530
// we have to switch back to the original editor group to prevent issues
2631
const webpanel: vs.WebviewPanel = panel.panel;
2732
const disposable = webpanel.onDidChangeViewState(e => {
@@ -47,7 +52,10 @@ export class CodeMapProvider implements vs.DebugAdapterTracker, vs.TextDocumentC
4752
title: 'Call Graph',
4853
};
4954

50-
vs.commands.executeCommand("graphviz-interactive-preview.preview.beside", args);
55+
const graphvizConfig = vs.workspace.getConfiguration('graphviz-interactive-preview');
56+
const openAutomatically = graphvizConfig.get('openAutomatically');
57+
if (!openAutomatically)
58+
vs.commands.executeCommand("graphviz-interactive-preview.preview.beside", args);
5159
}
5260

5361
/** @override TextDocumentContentProvider */

0 commit comments

Comments
 (0)