Skip to content

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

Closed

Description

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

/cc Isidor Nikolic (@isidorn) roblourens

Activity

  1. added
    debug
    on Sep 19, 2016
  2. added
    feature-request
    on Sep 19, 2016
  3. weinand commented on Sep 23, 2016

    @weinand
    ContributorAuthor

    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

    Isidor Nikolic (@isidorn) roblourens please provide feedback
    /cc Erich Gamma (@egamma) Kai Maetzel (@kieferrm)

  4. roblourens commented on Sep 23, 2016

    @roblourens
    Member

    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.

  5. weinand commented on Sep 23, 2016

    @weinand
    ContributorAuthor

    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.

  6. roblourens commented on Sep 23, 2016

    @roblourens
    Member

    Genau!

  7. weinand commented on Oct 19, 2016

    @weinand
    ContributorAuthor

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

  8. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debugfeature-request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions