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'; "> - +