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

Show docstring when hovering on function #617

Closed
iFrostizz opened this issue Nov 24, 2024 · 3 comments
Closed

Show docstring when hovering on function #617

iFrostizz opened this issue Nov 24, 2024 · 3 comments

Comments

@iFrostizz
Copy link

When hovering over a function by the use of the lua function on neovim

vim.lsp.buf.hover()

the modal box opens and works fine. Though, the docstring is not read as when using an LSP such as rust-analyzer. This feature would improve code understanding because there would be no need to go to definition to read the docstring.

image

@kanej
Copy link
Member

kanej commented Nov 25, 2024

This is something we definitely need. I am going to close this request as a duplicate of: #268

@kanej kanej closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2024
@iFrostizz
Copy link
Author

Sorry @kanej for the duplicate, Slang should be capable of this now right ? I'm happy to help with solving my issues if that can save you some time :)

@kanej
Copy link
Member

kanej commented Nov 25, 2024

Yes, the Slang parser can get us the doc strings for functions, even in the presence of syntax errors in the file.
However, currently the Language Server uses an ad-hoc JS analysis phase to build up a representation of the code used in navigation or for things like onHover lookup. We will migrate that to Slang's binding analysis capabilities eventually - but it is a big task.
The alternative is to use the existing ad-hoc JS analysis to find the function definition in the onHover case, then reparse the file with slang (and the function line/column info) to pull out the comment. Not ideal - but it would get us a useful feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants