From 5e68695a039f00d788027b5be0c4a96b2c653a34 Mon Sep 17 00:00:00 2001 From: John Murray Date: Fri, 26 Jul 2024 15:36:51 +0100 Subject: [PATCH] Improve reliability of updating status bar panels (#1416) --- src/extension.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 016dd9ba..415533c4 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -865,7 +865,7 @@ export async function activate(context: vscode.ExtensionContext): Promise { if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 1) { const workspaceFolder = currentWorkspaceFolder(); if (workspaceFolder && workspaceFolder !== workspaceState.get("workspaceFolder")) { - workspaceState.update("workspaceFolder", workspaceFolder); + await workspaceState.update("workspaceFolder", workspaceFolder); await checkConnection(false, editor?.document.uri); } } @@ -1318,15 +1318,20 @@ export async function activate(context: vscode.ExtensionContext): Promise { }), vscode.window.onDidChangeActiveTextEditor(async (textEditor: vscode.TextEditor) => { if (!textEditor) return; - await checkConnection(false, textEditor.document.uri); posPanel.text = ""; + await checkConnection(false, textEditor.document.uri); if (textEditor.document.uri.path.toLowerCase().endsWith(".xml") && config("autoPreviewXML")) { return previewXMLAsUDL(textEditor, true); } }), vscode.window.onDidChangeTextEditorSelection((event: vscode.TextEditorSelectionChangeEvent) => { - posPanel.text = ""; const document = event.textEditor.document; + + // Avoid losing position indicator if event came from output channel + if (document.uri.scheme == "output") { + return; + } + posPanel.text = ""; if (![macLangId, intLangId].includes(document.languageId)) { return; }