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: Add Go to Definition support for Enum/Type/Connect #597

Merged
merged 1 commit into from
May 11, 2023

Conversation

jansul
Copy link
Contributor

@jansul jansul commented May 9, 2023

This PR adds "Go to Definition" support to some more of the easier nodes as shown in the videos below.

For Ast::ConnectVariable:

2023-05-09.19-25-56.mp4

For Ast::EnumDestructuring:

2023-05-09.19-26-19.mp4

For Ast::EnumId:

2023-05-09.19-26-36.mp4

For Ast::Type:

2023-05-09.19-26-52.mp4

There's still some testing I need to do, especially when referencing any of the "core" files (they are not on the filesystem so you cannot link to them 😢 ) but otherwise should be good for review.

@Sija Sija added enhancement New feature or request tooling Tooling related feature (formatter, documentation, production builder) labels May 9, 2023
@Sija Sija added this to the 0.18.0 milestone May 9, 2023
@jansul
Copy link
Contributor Author

jansul commented May 10, 2023

Somewhat related, I think I might be able to solve linking to core files (components, modules etc) without them having to be on disk using this:
https://code.visualstudio.com/api/extension-guides/virtual-documents

Unfortunately would be VSCode specific until the LSP itself supports similar functionality

@gdotdesign
Copy link
Member

Awesome progress 🎉 These are very useful to have 🙏

There's still some testing I need to do, especially when referencing any of the "core" files (they are not on the filesystem so you cannot link to them cry ) but otherwise should be good for review.

We could show the source of the definition in a message https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#window_showMessageRequest until something like virtual documents are implemented, or we can dump them somewhere (.mint directory) and link to them maybe?

@jansul
Copy link
Contributor Author

jansul commented May 11, 2023

or we can dump them somewhere (.mint directory)

I had thought of this, but it seemed wrong spamming the whole standard library to disk just for this feature - as useful as it would be. (getting flashbacks of node_modules 😱 )

Looks like there are discussions about adding something similar to virtual documents to the LS specification, so hopefully something that isn't VSCode specific wouldn't be far off.

In the meantime I will probably just make it so you can't link to core files, or show a message as mentioned.

@jansul jansul force-pushed the def-enum-connect-type branch from 767e1c0 to a7b6b49 Compare May 11, 2023 19:17
@jansul
Copy link
Contributor Author

jansul commented May 11, 2023

Fixed issues when linking to core files. At the moment it just returns an empty definition response until we can implement something like the above 😄

Noticed a small bug when testing it:

Screenshot 2023-05-11 at 20-04-20 Screenshot

Will fix in another PR. Might try and add a few tests for messages/ in general as I'm sure my TypeId etc changes has probably broken a few others 😅

@Sija Sija merged commit 536001b into mint-lang:master May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tooling Tooling related feature (formatter, documentation, production builder)
Development

Successfully merging this pull request may close these issues.

3 participants