Skip to content

LSP Jump to Definition for LOCAL bindings #5663

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

ChrisPenner
Copy link
Contributor

@ChrisPenner ChrisPenner commented Apr 25, 2025

Overview

Adds LSP support for "jump to definition" for local bindings.

After the changes for local-var type info this was absolutely trivial to add :)

Notes:

  • this uses the same implementation for 'jump to definition" "jump to declaration" and "jump to implementation" when invoked on locally bound var references.
  • Types, and jumping to things in your codebase aren't implemented and aren't likely to be implemented unless VSCode changes its "prefetch" behaviour :'(

jump

Implementation notes

  • Use the binding location information collected during typechecking
  • When invoked, use the location of the cursor to look up the relevant symbol, map that to its binding site, then jump there.

Test coverage

  • None yet, a bit annoying to write, but could try to dream some up; will probably wait until someone notices it broke to go through the effort since it's not trivial to do, nor is it a mission-critical feature.

@ChrisPenner ChrisPenner changed the title LSP Jump to Definition LSP Jump to Definition for LOCAL bindings Apr 25, 2025
Base automatically changed from cp/local-var-notes to trunk April 25, 2025 18:59
@ChrisPenner ChrisPenner force-pushed the lsp/go-to-definition branch from 521c64b to 51585c6 Compare May 2, 2025 19:52
@ChrisPenner ChrisPenner force-pushed the lsp/go-to-definition branch from 51585c6 to 22787ff Compare May 2, 2025 20:04
@ChrisPenner ChrisPenner marked this pull request as ready for review May 2, 2025 20:04
@ChrisPenner ChrisPenner requested a review from aryairani May 2, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant