Skip to content

Add more types to the watches and scopes views #112

@igorlfs

Description

@igorlfs

nvim-dap-view supports highlighting a variable based on its type in the watches and scopes views. The highlighting is pretty basic, but it should already cover primitive types. However, it could be enhanced in two ways:

  1. Adding support for adapter-specific types. Some languages use slightly different naming conventions for types (e.g., in Python a string is str). The current mapping isn't really extensive in this regard. However, you can easily contribute if you encounter an unmapped type:
    1. Get the actual type name by using :=require"dap-view.state".watched_expressions. It fetches all "watches related" data, so it might be long. The type property lives inside a response or variable object, it shouldn't be hard to find. If you get lost, you can use :messages to search for type.
    2. Submit a PR with the new mapping. You can take a look at this commit. Please, avoid introducing new highlight groups. Add a comment describing where the type can be found (e.g., "None" withdebugpy).
  2. Parsing more complex types. I'm not sure how can this be done realistically as, AFAIK, there's no standard (in the protocol) that describes a variables' "raw" value. But perhaps it can be done "heuristically" for "not that complex" types (e.g., lists or dicts). If you have any ideas for that, leave them below.

The protocol outlines some "advanced" hints which we could use as well. For instance, there's an attribute that marks a variable as read only. But I'm not sure how it could be displayed on nvim-dap-view's side? I'm open to ideas on this front too.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions