Skip to content

Implement goto-definition for local symbols#1230

Open
lionel- wants to merge 7 commits into
mainfrom
oak/goto-def-intra-file
Open

Implement goto-definition for local symbols#1230
lionel- wants to merge 7 commits into
mainfrom
oak/goto-def-intra-file

Conversation

@lionel-
Copy link
Copy Markdown
Contributor

@lionel- lionel- commented May 25, 2026

Part of posit-dev/positron#13749
Part of #1149
Closes posit-dev/positron#8631 (should extract NSE bullet in its own issue, also affecting find-refs and rename).

Adds precise within-file goto-definition driven by Oak's semantic index.

The Salsa rewrite is taking more time and merging right before release seems a bit risky, given the added complexity. So it looks like full cross-file support for goto-def, find-refs, and rename is not going to make it to the June release. However we already have everything we need for within-file analysis.

This PR adds support for jumping to definition of locally-defined symbols (def <- and function parameters):

  • Removes the ARK_OAK_GOTO_DEF-gated goto-definition handler, and all its non-Salsa baggage. That's a regression in our dev builds (we can no longer exercise the oak_sources stuff to visit installed package definitions), but that will be restored later this week with the proper Salsa implementation.

  • Adds within-file support in Ark's goto-definition handler, based on Oak's semantic index. If the symbol is not bound in the file, we use the legacy indexer-based handler. This legacy handler includes all symbols of the same name in other files, including unrelated files. This will be fixed once we fully switch to Oak.

    Note that for conditionally unbound (via e.g. if (cond) x <- 1), we don't use the legacy handlers to populate external symbols, because the complexity wasn't worth the slight and temporary inconsistency.

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.

Support for local definitions in "Go to definition"

1 participant