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

LSP: Support hover #1575

Closed
Tracked by #1558
phated opened this issue Jun 6, 2023 · 0 comments · Fixed by #5491
Closed
Tracked by #1558

LSP: Support hover #1575

phated opened this issue Jun 6, 2023 · 0 comments · Fixed by #5491
Assignees
Labels
enhancement New feature or request lsp Language Server Protocol

Comments

@phated
Copy link
Contributor

phated commented Jun 6, 2023

Problem

The LSP should support hover requests following https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_hover

Happy Case

Users should be shown tooltips with additional information when hovering over parts of their source code when using an LSP client, such as the vscode plugin.

Alternatives Considered

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@phated phated added enhancement New feature or request lsp Language Server Protocol labels Jun 6, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jun 6, 2023
@asterite asterite self-assigned this Jul 11, 2024
@asterite asterite mentioned this issue Jul 11, 2024
5 tasks
github-merge-queue bot pushed a commit that referenced this issue Jul 12, 2024
# Description

## Problem

Resolves #1575

## Summary

Implements LSP hover for:
- modules
- structs
- struct members
- traits
- global variables
- functions
- aliases
- local variables

The popup content is similar to that of Rust Analyzer except that
there's no link to go to that reference. The reason is that it seems the
LSP type to do that has an "actions" property but I can't find that in
the lsp-types library we are using. That said, once this PR is merged
doing that should be relatively easy, and it might be better to keep PRs
smaller.

There's one case where the hover doesn't work: if you have `let x: i32 =
Default::default();`, hovering over `default` won't show the impl
function. It's doable, but doing it requires more changes in this PR and
at one point I wanted to stop :-)

This PR also includes several fixes that I found in
"find-all-references" and "rename", but because hover and those are all
kind of related, and testing things for hover is simpler, I decided to
add tests for those things and fix them.

Here it's in action:


https://github.com/noir-lang/noir/assets/209371/bb64d368-2cf7-450c-99f3-e2aba52ca4e3

## Additional Context

None.

## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

---------

Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lsp Language Server Protocol
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants