Page MenuHomePhabricator

[lldb-vscode] Handle request_evaluate's context attribute

Authored by wallace on Mar 15 2021, 1:08 PM.



The request "evaluate" supports a "context" attribute, which is sent by VSCode. The attribute is defined here

The "clipboard" context is not yet supported by lldb-vscode, so we can forget about it for now. The 'repl' (i.e. Debug Console) and 'watch' (i.e. Watch Expression) contexts must use the expression parser in case the frame's variable path is not enough, as the user expects these expressions to never fail. On the other hand, the 'hover' expression is invoked whenever the user hovers on any keyword on the UI and the user is fine with the expression not being fully resolved, as they know that the 'repl' case is the fallback they can rely on.

Given that the 'hover' expression is invoked many many times without the user noticing it due to it being triggered by the mouse, I'm making it use only the frame's variable path functionality and not the expression parser. This should speed up tremendously the responsiveness of a debug session when the user only sets source breakpoints and inspect local variables, as the entire debug info is not needed to be parsed.

Regarding tests, I've tried to be as comprehensive as possible considering a multi-file project. Fortunately, the results from the "hover" case are enough most of the times.

Diff Detail

Event Timeline

wallace requested review of this revision.Mar 15 2021, 1:08 PM
wallace created this revision.
clayborg accepted this revision.Mar 15 2021, 2:46 PM

I agree that we the hover happens way too often and it actually happens with any text you hover over including comments, so this is a good change.


Just inline this and check for failure first before doing a string compare

This revision is now accepted and ready to land.Mar 15 2021, 2:46 PM
wallace updated this revision to Diff 330819.Mar 15 2021, 3:05 PM

address comment

This revision was landed with ongoing or failed builds.Mar 15 2021, 3:10 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2021, 3:10 PM