Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/debugAdapter: suppress error pop-up for failed watch expression evaluation #196

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1586,9 +1587,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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the default destination always user if nothing is passed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the default is to show to the user, but I decided to spell out both options explicitly in the if-else, so it is clear what is going on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, thanks!

}
);
}
Expand Down