From a0c8f74c53e4fc72b6884706125300dce79220e0 Mon Sep 17 00:00:00 2001 From: Stephen Gennard Date: Thu, 2 Jan 2025 21:22:00 +0000 Subject: [PATCH] add refresh code --- src/vsdotmarkdown.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/vsdotmarkdown.ts b/src/vsdotmarkdown.ts index a3dfc196..7e9b3563 100644 --- a/src/vsdotmarkdown.ts +++ b/src/vsdotmarkdown.ts @@ -67,7 +67,20 @@ export async function view_dot_callgraph(context: vscode.ExtensionContext, setti undefined, context.subscriptions ); + setHtmlContent(webviewPanel.webview, context, linesArray); + + vscode.workspace.onDidChangeTextDocument(changeEvent => { + if (vscode.window.activeTextEditor?.document) { + if (changeEvent.document.uri != vscode.window.activeTextEditor.document.uri) return; + let current = VSCOBOLSourceScanner.getCachedObject(vscode.window.activeTextEditor.document, settings); + if (current === undefined) { + return; + } + const updatedLinesArray: string[] = getCurrentProgramCallGraph(settings, current, false); + setHtmlContent(webviewPanel.webview, context, updatedLinesArray); + } + }); } function saveAsPng(messageText: string) { @@ -76,7 +89,8 @@ function saveAsPng(messageText: string) { } function setHtmlContent(webview: vscode.Webview, extensionContext: vscode.ExtensionContext, linesArray: string[]) { - let htmlContent = ` + let htmlContent = ` + @@ -86,7 +100,7 @@ function setHtmlContent(webview: vscode.Webview, extensionContext: vscode.Extens script-src 'nonce-nonce' 'unsafe-inline'; "> - +