mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim
GNU General Public License v3.0
5.11k stars 179 forks source link

More variable formatting options and/or extension points #1062

Open mfussenegger opened 8 months ago

mfussenegger commented 8 months ago

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:

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.