From 6ca980efe641b25e4b5f2b4cbade7d6e8eea9426 Mon Sep 17 00:00:00 2001 From: Polina Sokolova Date: Tue, 9 Jun 2020 17:00:37 +0000 Subject: [PATCH] src/debugAdapter: suppress error pop-up for failed watch expression evaluation 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 #143 Change-Id: I026955980d22e955e4af933bc68256dc320c3f56 GitHub-Last-Rev: 9a524922e55ecbda7179749b8de330385107a319 GitHub-Pull-Request: golang/vscode-go#196 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/236999 Reviewed-by: Hyang-Ah Hana Kim --- src/debugAdapter/goDebug.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 59ae63bd61..62eafbc299 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -15,6 +15,7 @@ import kill = require('tree-kill'); import * as util from 'util'; import { DebugSession, + ErrorDestination, Handles, InitializedEvent, logger, @@ -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); } ); }