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

Language Server: implement textDocument/hover #1187

Open
hzeller opened this issue Feb 11, 2022 · 5 comments
Open

Language Server: implement textDocument/hover #1187

hzeller opened this issue Feb 11, 2022 · 5 comments
Labels
language-server Language server related issues

Comments

@hzeller
Copy link
Collaborator

hzeller commented Feb 11, 2022

The Hover request should return some information that can be useful in the context

Ideas:

  • Variables: type if available (maybe requires symbol table, but could probably be more simply derived; register/wire/parameter/localparam; if possible to determine without going too much in elaboration-weeds: width. Input, output ?)
  • Blocks: when hovering over the end block - if this is a labelled block, name of the label
  • generalized to endmodule, endfunction... name of the corresponding thing.

Some simple things can probably be relatively easily be derived, others might need symbol table.

@Saad-Mufti
Copy link

Is there any plan for adding hover info for literals, say to show what a binary literal is in hex or decimal? Or utility functions (e.g. $clog2)/other keywords (always_ff), to show parameters + basic info? If not I'd be willing to take a stab at it.

@hzeller
Copy link
Collaborator Author

hzeller commented Jan 5, 2024

There are many ideas that could be implemented, alas there is not enough time.
So yes, please take a stab!

@thomas-woehrle
Copy link

Hi,

I just wanted to ask which hover functionalities currently exist if any.

The language server README says: verible-verilog-ls by default loads and analyses only currently edited files in the editor. To be able to utilize such features as going to definition, going to references, printing hover info project-wide, add a verible.filelist file to the project.

This indicates that hover info already exists, but it doesn't work for me, while go-to-definition does after setting up verible.filelist, hence my question.

@hzeller
Copy link
Collaborator Author

hzeller commented Nov 11, 2024

There is actually some partial hover implementation, but it is disabled right now.

You have to set the hoverProvider value to true and recompile: https://github.com/chipsalliance/verible/blob/master/verilog/tools/ls/verilog-language-server.cc#L90

Reason why it is currently disabled is, that it creates a full symbol table of all files first, while it would be probably better to look in the local file first before doing an expensive symbol table creation.

But, this is a start and can be expanded from there.

@ButterSus
Copy link

Hi,

As a workaround, you can use the hover.nvim plugin to implement the default hover behavior. Here's how:
https://gist.github.com/ButterSus/36d47999251030ddf3bbfd187046fe7a

This solution leverages nvim-treesitter and expands the preview until the line containing the definition is fully selected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language-server Language server related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants