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

Not supplying evaluateName does not hide "Add to Watch" #47078

Closed
DanTup opened this issue Apr 2, 2018 · 9 comments
Closed

Not supplying evaluateName does not hide "Add to Watch" #47078

DanTup opened this issue Apr 2, 2018 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@DanTup
Copy link
Contributor

DanTup commented Apr 2, 2018

According to #25166:

If "evaluateName" is falsy, all actions relying on it should not be available (e.g. "Add to watch").

However, the context menu still seems to show Add to Watch in the Variables display, and when clicking it it adds an empty expression to the watch window.

It's not a bad thing - I never implemented evaluateName (oops) since I incorrectly expected it to fall back to name (I'm fixing that now though!).

@weinand weinand assigned isidorn and unassigned weinand Apr 2, 2018
@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues bug Issue identified by VS Code Team member as probable bug labels Apr 2, 2018
@isidorn
Copy link
Contributor

isidorn commented Apr 13, 2018

If there is no evaluateName we use the name of the variable. Which I think is good behavior for most debug adapters.

I understand this is not conforming with the docs. So we should either

  • Change the docs
  • Change the actions to not be available (or disabled) when evaluate name is not there

Currently I think that using the name when evaluateName is missing might not be a bad strategy, but am overall open for suggestions.
@weinand thoughts?

@isidorn isidorn added the under-discussion Issue is under discussion for relevance, priority, approach label Apr 13, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Apr 13, 2018

I'd be fine with it falling back to name, but it doesn't seem to do that today as when you click "Add to watch" you get an empty expression in the watch window (whereas if you provide evaluateName it prefills with that).

So, if the docs are going to be changed (and the actions are not removed), I think it's a bug that "Add to watch" isn't filling in the name (it might not be the only thing that might not be falling back to name).

@isidorn
Copy link
Contributor

isidorn commented Apr 13, 2018

@DanTup It is very strange that it is not falling back to name for you
https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/debug/browser/debugActions.ts#L608

Can you put a breakpoint there and investigate deeper what is going on

@DanTup
Copy link
Contributor Author

DanTup commented Apr 13, 2018

Hmm, that is strange - I'll do some investigation. When it didn't work, I found #25166 and assumed it was intended that evaluateName not being provided would hide/remove this functionality. In my testing, it definitely seems to add empty watches without evaluateName and the correct name with it.

I'll dig more and post back next week though!

@DanTup
Copy link
Contributor Author

DanTup commented Apr 16, 2018

@isidorn Ok, I looked at this code again:

const name = this.expression instanceof Variable ? this.expression.evaluateName : this.expression.name;

This is not falling back to name because this.expression is an instance of Variable, it just doesn't have an evaluateName. Therefore the code above takes the undefined of this.expression.evaluateName.

Shouldn't it be something like:

const name = this.expression instanceof Variable && this.expression.evaluateName ? this.expression.evaluateName : this.expression.name;

?

@DanTup
Copy link
Contributor Author

DanTup commented Apr 16, 2018

Also; I still think the behaviour mentioned in the linked comment at the top would be good - what happens if we fabricate a variable for the Variables window (eg. an exception) and don't have a good way to add it to the Watch window?

@isidorn isidorn added this to the April 2018 milestone Apr 17, 2018
@isidorn isidorn removed the under-discussion Issue is under discussion for relevance, priority, approach label Apr 17, 2018
@isidorn
Copy link
Contributor

isidorn commented Apr 17, 2018

@DanTup makes sense, thanks for feedback
I have pushed a change that now actions depedning on evaluateName are disabled when evaluateName is not there.

@DanTup
Copy link
Contributor Author

DanTup commented Apr 17, 2018

Super, thanks! 👍

@DanTup
Copy link
Contributor Author

DanTup commented Apr 23, 2018

Checked in Insiders, seems to work as expected. Thanks!

@weinand weinand added the verified Verification succeeded label Apr 25, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants