nixd icon indicating copy to clipboard operation
nixd copied to clipboard

nixd/hover: hover documentation for options

Open inclyc opened this issue 2 years ago • 3 comments

Give option documentation to our user.

inclyc avatar Jun 24 '23 08:06 inclyc

This would be great.

What would be especially helpful would be the type signature; that's what I'd want to see in my single line of emacs minibuffer when hovering.

Atemu avatar Apr 24 '24 01:04 Atemu

What would be especially helpful would be the type signature; that's what I'd want to see in my single line of emacs minibuffer when hovering.

This is already shown in the completion list, I suppose I'd rather straightforward to do this.

Contributors who wants to take this should:

Write a class OptionsHoverProvider in this anonymous namespace here:

https://github.com/nix-community/nixd/blob/a8d7322d35dce8c0d6a54eb24213cfe31f5339d3/nixd/lib/Controller/Hover.cpp#L88

This content looks like:

https://github.com/nix-community/nixd/blob/a8d7322d35dce8c0d6a54eb24213cfe31f5339d3/nixd/lib/Controller/Definition.cpp#L170

The class shown above is used for "providing" locations, thus for hover request the new class should provide "Hover" information.

After writing that class, invoke

https://github.com/nix-community/nixd/blob/a8d7322d35dce8c0d6a54eb24213cfe31f5339d3/nixd/lib/Controller/Definition.cpp#L241

here (in Controller::onHover), to get attrpath used for RPC request.

https://github.com/nix-community/nixd/blob/a8d7322d35dce8c0d6a54eb24213cfe31f5339d3/nixd/lib/Controller/Hover.cpp#L106

Finally, update the tests

Should be a new entry, like "hover-options.md", put it here

https://github.com/nix-community/nixd/blob/main/nixd/tools/nixd/test/

The content looks like https://github.com/nix-community/nixd/blob/main/nixd/tools/nixd/test/hover-package.md, and options list can be provided like this:

https://github.com/nix-community/nixd/blob/a8d7322d35dce8c0d6a54eb24213cfe31f5339d3/nixd/tools/nixd/test/completion-options.md?plain=1#L2

inclyc avatar Apr 24 '24 02:04 inclyc

Anyone who wants to take this please comment here, and I can give you commit access after patches merged! (Functional improvements).

inclyc avatar Apr 24 '24 02:04 inclyc

I would like to try and implement this feature.

Grafcube avatar Jun 19 '24 14:06 Grafcube

I've opened the PR at #526

Grafcube avatar Jun 19 '24 15:06 Grafcube