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 Hover: Support go_to button links in the hover box #2852

Closed
JoshuaBatty opened this issue Sep 26, 2022 · 3 comments · Fixed by #4539
Closed

LSP Hover: Support go_to button links in the hover box #2852

JoshuaBatty opened this issue Sep 26, 2022 · 3 comments · Fixed by #4539
Assignees
Labels
enhancement New feature or request language server LSP server

Comments

@JoshuaBatty
Copy link
Member

eg

Screen Shot 2022-09-26 at 2 23 20 pm

@JoshuaBatty JoshuaBatty added enhancement New feature or request language server LSP server labels Sep 26, 2022
@sdankel sdankel self-assigned this Apr 19, 2023
@sdankel
Copy link
Member

sdankel commented Apr 25, 2023

Since this is not yet part of the LSP spec, we'd need to return an additional field in the hover response.

With tower-lsp, there seems to be no way to override the method signature that they define. Opened an issue: ebkalderon/tower-lsp#393

We'll either need this to be supported in tower-lsp or move to another framework to be able to do this feature.

@sdankel
Copy link
Member

sdankel commented Apr 26, 2023

Actually, never mind. We can just add the links in the markdown and it looks fine.

image

I was looking at how rust-analyzer does it, which involves implementing the hover provider on the client side to handle the extra actions argument from the hover response, but I don't see why that's necessary.

@sdankel
Copy link
Member

sdankel commented Apr 26, 2023

New problem I'm running into: microsoft/vscode#180913

sdankel added a commit that referenced this issue May 6, 2023
## Description

This is a subset of https://github.com/FuelLabs/sway/pull/4532/files.
I'm trying to narrow down why some of the e2e tests are failing. This PR
contains the changes for the "Go to type" links only, excluding the
changes in sway-core that were needed for "Goto implementations" to
work.

Closes #2852

<img width="673" alt="image"
src="https://user-images.githubusercontent.com/47993817/236371214-0b82b509-9a59-4575-b1d1-5acd505da255.png">

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
sdankel added a commit that referenced this issue May 6, 2023
This is a subset of https://github.com/FuelLabs/sway/pull/4532/files.
I'm trying to narrow down why some of the e2e tests are failing. This PR
contains the changes for the "Go to type" links only, excluding the
changes in sway-core that were needed for "Goto implementations" to
work.

Closes #2852

<img width="673" alt="image"
src="https://user-images.githubusercontent.com/47993817/236371214-0b82b509-9a59-4575-b1d1-5acd505da255.png">

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
IGI-111 added a commit that referenced this issue May 10, 2023
## Description

Closes #2851
#2852

Related, this code is needed for the links to work:
FuelLabs/sway-vscode-plugin#152

There are two types of links: go to definition and go to
implementations.

It should be working for:
- structs
- enums
- traits
- variables
- functions
- function parameters
- struct fields

Note: it isn't working for ABI at the moment. 

<img width="500" alt="image"
src="https://user-images.githubusercontent.com/47993817/236133554-aa79b4ed-f2db-4de4-baf9-edae42b6d44a.png">

<img width="617" alt="image"
src="https://user-images.githubusercontent.com/47993817/236133705-d9990ea1-61d6-4abc-a8f8-ee41d8a5658a.png">

<img width="1138" alt="image"
src="https://user-images.githubusercontent.com/47993817/236133746-0fdf1ede-ff49-46ce-bb2a-41ce18503c6e.png">

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: IGI-111 <[email protected]>
Co-authored-by: Kaya Gökalp <[email protected]>
Co-authored-by: Joshua Batty <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request language server LSP server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants