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

More variable formatting options and/or extension points #1062

Open
mfussenegger opened this issue Oct 21, 2023 · 0 comments
Open

More variable formatting options and/or extension points #1062

mfussenegger opened this issue Oct 21, 2023 · 0 comments

Comments

@mfussenegger
Copy link
Owner

mfussenegger commented Oct 21, 2023

Problem Statement

This is more of a collection of a few pain points in regards to the presentation and functionality related to variables.

Mostly a brain dump for now.

long text

The display of variables can be quite hard to read if it is a structure with a
very long string representation as you get something like:

looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggggggggggggg tttttttttttttttttttttttttttttttttttttttteeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtttttttttttttttttttttttttttttttttttttttttttttttttttttt
property1: foo
property2: bar
property3: ..
[...]

Ideas:

  • repl could provide a way to only print the text (and treating \n as newline in that mode). E.g. a .e <expression>. .e for evaluate, which supports level specification .e0, .e1, ... The 0 level could mean only top-level text.
  • Trim long text by default

Formatters

Sometimes you stop at a breakpoint and view the contents of a variable and then want to create a test-case with that data. It would be cool if there were some way to control how the variable is formatted.

E.g. a "copy as Lua/JSON/Python/.."
Language specifics are out of scope for nvim-dap, but a (higher level?) extension point for it might be built-in.
Or recipes how to do it with the low level API.

If anyone has concrete examples of output they'd want to format in a certain way - please add them as comment. It could help coming up with an interface

Search in collapsed items

Sometimes you want to see if an item in a collection contains a particular item. It would be nice if there were some functionality to search within collapsed (=not yet resolved) items

E.g. if you have:

  settings: ArrayList@50 size=50

And type /foo it could first use regular buffer text search, and then fallback to nvim-dap variable contents search.

mfussenegger added a commit that referenced this issue Oct 26, 2023
As described in #1062
Some debug adapters heavily use the lazy hint.

For example, a collapsed list is initially displayed as:

    settings: ArrayList@50 size=1

That's good. But after expanding, the contained items looke like this:

    settings: ArrayList@50 size=1
      0: Assignment@66

Each individual item had to be expanded to show the value:

    settings: ArrayList@50 size=1
      0: Assignment@66 "Assignment{column='stats.jobs_log_size', expressions=[1024]}"

This removes the intermediate step, to go from:

    settings: ArrayList@50 size=1

Straight to:

    settings: ArrayList@50 size=1
      0: Assignment@66 "Assignment{column='stats.jobs_log_size', expressions=[1024]}"
mfussenegger added a commit that referenced this issue Oct 27, 2023
As described in #1062
Some debug adapters heavily use the lazy hint.

For example, a collapsed list is initially displayed as:

    settings: ArrayList@50 size=1

That's good. But after expanding, the contained items looke like this:

    settings: ArrayList@50 size=1
      0: Assignment@66

Each individual item had to be expanded to show the value:

    settings: ArrayList@50 size=1
      0: Assignment@66 "Assignment{column='stats.jobs_log_size', expressions=[1024]}"

This removes the intermediate step, to go from:

    settings: ArrayList@50 size=1

Straight to:

    settings: ArrayList@50 size=1
      0: Assignment@66 "Assignment{column='stats.jobs_log_size', expressions=[1024]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant