Repository navigation
Improve evaluate on hover feature. - #9821
Conversation
|
Hi Rajkumar Janakiraman (@rajkumar42), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
|
Corrected: Stop gap fix for #4059 |
There was a problem hiding this comment.
I would suggest adding some comments indicating what this code is doing. Something like:
Line 121:
// If the debug adapter supports evaluation-based-hover, we need to try and guess what the expression under the mouse cursor is. Someday it might be nice if the language service could somehow provide this. But this code attempts to approximate the answer for a variety of languages. Some example supported expressions: myVar.prop, a.b.c.d, myVar?.prop, myVar->prop, MyClass::StaticProp, *myVar
Reg ex explanation
// Match any character except a set of characters which often break interesting sub-expressions
Line 124 comment:
// First find the full expression under the cursor
Line 135 comment:
// If there are non-word characters after the cursor, we want to truncate the expression then.
There was a problem hiding this comment.
Thanks!! I've added the comments.
|
Andre Weinand (@weinand), Isidor Nikolic (@isidorn) can you please code review? |
|
We are currently in the endgame this week, thus assigning this to august and I will code review / potentially merge start of next week. |
|
Did a quick glance over the code, will do a full review next week. Here's some suggestions:
Thanks a lot for this PR! |
|
|
Jackson Davis (@jacdavis) can you take a quick look? |
There was a problem hiding this comment.
does this ignore expressions that are split across lines? Do we care?
|
LGTM as a stop-gap, though I second Rajkumar's concerns about trying to handle this at the editor-level at all. |
There was a problem hiding this comment.
doesn't this filter out template/generic types? For instance, in C++, an expression like this should be valid:
CSeafood::Swim where CSeafood is a template instance with template parameter Squid.
There was a problem hiding this comment.
No need to specify RegExp, types are inffered by TypeScript
|
My biggest problem with the current approach is that it uses the flag It seems like we all have concerns on solving this on the editor level. Since Andre Weinand (@weinand) is on vacation this week I propose to wait for next week to get his feedback on this matter. |
|
Agreed, making it an extension would make it robust. We can hold off till Andre Weinand (@weinand) gets back. Say the expression under mouse hover is foo["bar"], debuggers which supportsEvaluateForHovers would actually evaluate to foo["bar"], but for the debuggers which don't it could only find and show foo from the stack. Hence the difference in finding the expression depending on supportsEvaluateForHovers feature. Sorry if hadn't made it clear before. |
|
Isidor Nikolic (@isidorn) ping... |
|
Rajkumar Janakiraman (@rajkumar42) Isidor will be back in the office next week. |
|
Andre Weinand (@weinand) we were actually waiting for your input. |
|
I agree with most what was said in this thread:
The fact that the PR uses Having VS Code send the line and column information to the debug adapter as part of the evaluate request could help in some (simple) cases but in general it is difficult in the debug adapter to get access to the language service. |
|
Andre Weinand (@weinand) I have merged the latest changes from vscode/master. 2 unit tests are failing - unrelated to my change. Can you give me guidance on what needs to done to merge the PR? |
when session has support for 'supportsEvaluateForHovers', using regex to extract the sub-expression of the hover and using it to evaluate.
And fixing a minor bug.
9ecdbc0 to
ea13f31
Compare
| return this.domNode; | ||
| } | ||
|
|
||
| private getHoveredExpression(lineContent: string, range: Range) : Range { |
There was a problem hiding this comment.
Please rename this to better represent what is specific about this method
There was a problem hiding this comment.
Any suggestions?
There was a problem hiding this comment.
getExpressionBoundsUnderCursor?
|
Sorry for the slow reponse, I was on vacation. Did you try out your changes with node, c++ and c# debugging? We want to make sure everything works out fine. Once both fo these things are done we can merge the PR in. Next week is our endgame, so in order to have this for the august release we would need to wrap this up until Monday. |
|
Isidor Nikolic (@isidorn) addressed your comments. |
|
Looks good to me, merged! Thanks a lot 🍻 |
|
Thanks!! |
when session has support for 'supportsEvaluateForHovers', using regex to extract the
sub-expression of the hover and using it to evaluate.