Skip to content

Commit 23d5e68

Browse files
committed
Fix error messages
* Fix code to not show error messages if no action was taken in the first place
1 parent f7e4933 commit 23d5e68

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/extension.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,18 @@ async function updateViewWithStackTrace() {
2525
export async function activate(context: ExtensionContext) {
2626
let currentPanel: WebviewPanel | undefined = undefined;
2727
// started debug session
28-
context.subscriptions.push(debug.onDidStartDebugSession(updateViewWithStackTrace));
28+
const updateView = () => {
29+
if (!currentPanel || !currentPanel.visible) {
30+
return;
31+
}
32+
updateViewWithStackTrace();
33+
};
34+
35+
context.subscriptions.push(debug.onDidStartDebugSession(updateView));
2936
// step into, step out, step over, change active stack item, change active debug session, receive custom event
30-
context.subscriptions.push(debug.onDidChangeActiveStackItem(updateViewWithStackTrace));
37+
context.subscriptions.push(debug.onDidChangeActiveStackItem(updateView));
3138
// stopped/started/changed debug session
32-
context.subscriptions.push(debug.onDidChangeActiveDebugSession(updateViewWithStackTrace));
39+
context.subscriptions.push(debug.onDidChangeActiveDebugSession(updateView));
3340

3441
context.subscriptions.push(workspace.onDidChangeConfiguration(async event => {
3542
if (event.affectsConfiguration('workbench.colorTheme')) {
@@ -66,9 +73,10 @@ export async function activate(context: ExtensionContext) {
6673

6774
if (debug.activeDebugSession) {
6875
await updateViewWithStackTrace();
69-
} else {
70-
window.showWarningMessage('No active debug session, the view will automatically update when a debug session is started');
7176
}
77+
// else {
78+
// window.showWarningMessage('No active debug session, the view will automatically update when a debug session is started');
79+
// }
7280
} catch (e: unknown) {
7381
window.showErrorMessage("failed, to create panel" + e);
7482
}

0 commit comments

Comments
 (0)