Skip to content

Commit

Permalink
src/debugAdapter: suppress error pop-up for failed watch expression e…
Browse files Browse the repository at this point in the history
…valuation

Watch expressions are repeated over and over again while the program is running, pausing, continuing, etc, and the result is always displayed and continuously refreshed under WATCH. Unlike other types of evaluations (e.g. in REPL, where one expression is evaluated at a time, and the error can be buried among logging messages), there is no advantage to also showing the same error in a pop-up box.

Fixes microsoft#143

Change-Id: I026955980d22e955e4af933bc68256dc320c3f56
GitHub-Last-Rev: 9a52492
GitHub-Pull-Request: golang/vscode-go#196
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/236999
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
  • Loading branch information
polinasok committed Jun 10, 2020
1 parent 47e9fa9 commit 6ca980e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import kill = require('tree-kill');
import * as util from 'util';
import {
DebugSession,
ErrorDestination,
Handles,
InitializedEvent,
logger,
Expand Down Expand Up @@ -1599,9 +1600,18 @@ export class GoDebugSession extends LoggingDebugSession {
log('EvaluateResponse');
},
(err) => {
let dest: ErrorDestination;
// No need to repeatedly show the error pop-up when expressions
// are continiously reevaluated in the Watch panel, which
// already displays errors.
if (args.context === 'watch') {
dest = null;
} else {
dest = ErrorDestination.User;
}
this.sendErrorResponse(response, 2009, 'Unable to eval expression: "{e}"', {
e: err.toString()
});
}, dest);
}
);
}
Expand Down

0 comments on commit 6ca980e

Please sign in to comment.