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

Debug: investigate how to present inline values in source when stepping through code #12256

Closed
weinand opened this issue Sep 19, 2016 · 5 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality

Comments

@weinand
Copy link
Contributor

weinand commented Sep 19, 2016

Investigate how VS Code could present inline values in source when stepping through code

/cc @isidorn @roblourens

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Sep 19, 2016
@weinand weinand added this to the September 2016 milestone Sep 19, 2016
@weinand weinand self-assigned this Sep 19, 2016
@weinand weinand added the feature-request Request for new features or functionality label Sep 19, 2016
@weinand
Copy link
Contributor Author

weinand commented Sep 23, 2016

Dev tools show inline values as follows:

  • on a stopped event the source boundaries of the top scope are determined (the CDP protocol provides this information automatically, v8 does not)
  • beginning with the start line of the scope:
    • for every line variables and parameters are detected by fuzzy parsing and matched against variables available in the scope from the variables view.
    • for the first n variables of a line a one line 'preview' is added at the end of the line with a different background color
    • the process stops just before the line where the runtime is stopped

VS Code could implement this feature almost completely based on the existing mechanisms and protocols.
There are two tricky areas:

  • finding the source boundaries for a scope requires language knowledge if the boundaries are not returned from the debug adapter as part of the scope object. For now we ignore this because node-debug2 doesn't have that problem.
  • finding variables in a line can be done by fuzzy parsing (similar to what we already do for the variable hover). False positives could be eliminated by verifying them against the variables returned from the debug adapter for the scope.

Proposal:

  1. in the debug protocol add a scope boundary (start, end position) to the scope object.
  2. implement this in node-debug2.
  3. VS Code starts to use that information to fix the hover experience by only showing a hover when inside the scope boundaries.
  4. node.debug2 and (node-debug) implement the one line 'preview' for objects and arrays. This is not a new protocol request but just improves what's get returned as the valueattribute in a Variables request for objects and arrays.
  5. VS Code implements the 'show inline values' feature as outlined above

@isidorn @roblourens please provide feedback
/cc @egamma @kieferrm

@weinand weinand closed this as completed Sep 23, 2016
@roblourens
Copy link
Member

roblourens commented Sep 23, 2016

So for an object, the adapter will return { name: "myObj", variablesReference: 1000, value: "Object { abc: 123 }" } as part of the response to variablesRequest, and the adapter will find the location to display myObj = Object { abc: 123 }? Sounds good to me. It should be easy to generate this preview.

@weinand
Copy link
Contributor Author

weinand commented Sep 23, 2016

@roblourens yes, correct. And the object 'preview' feature is independent from the 'present inline values'. The preview will be useful in the REPL and the Variables view as well.

@roblourens
Copy link
Member

Genau!

@weinand
Copy link
Contributor Author

weinand commented Oct 19, 2016

See microsoft/vscode-debugadapter-node#78 for the corresponding protocol addition.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants