Skip to content

Commit

Permalink
Fix error messages
Browse files Browse the repository at this point in the history
* Fix code to not show error messages if no action was taken in the first place
  • Loading branch information
K0IN committed Sep 13, 2024
1 parent f7e4933 commit 23d5e68
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ async function updateViewWithStackTrace() {
export async function activate(context: ExtensionContext) {
let currentPanel: WebviewPanel | undefined = undefined;
// started debug session
context.subscriptions.push(debug.onDidStartDebugSession(updateViewWithStackTrace));
const updateView = () => {
if (!currentPanel || !currentPanel.visible) {
return;
}
updateViewWithStackTrace();
};

context.subscriptions.push(debug.onDidStartDebugSession(updateView));
// step into, step out, step over, change active stack item, change active debug session, receive custom event
context.subscriptions.push(debug.onDidChangeActiveStackItem(updateViewWithStackTrace));
context.subscriptions.push(debug.onDidChangeActiveStackItem(updateView));
// stopped/started/changed debug session
context.subscriptions.push(debug.onDidChangeActiveDebugSession(updateViewWithStackTrace));
context.subscriptions.push(debug.onDidChangeActiveDebugSession(updateView));

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

if (debug.activeDebugSession) {
await updateViewWithStackTrace();
} else {
window.showWarningMessage('No active debug session, the view will automatically update when a debug session is started');
}
// else {
// window.showWarningMessage('No active debug session, the view will automatically update when a debug session is started');
// }
} catch (e: unknown) {
window.showErrorMessage("failed, to create panel" + e);
}
Expand Down

0 comments on commit 23d5e68

Please sign in to comment.