-
Notifications
You must be signed in to change notification settings - Fork 3
Add compiler-backed definition navigation #38
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
serene1491
wants to merge
2
commits into
master
Choose a base branch
from
tooling/project-snapshots-navigation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
architecture/decisions/0092-private-semantic-definition-navigation.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| # ADR 0092: Private Semantic Definition Navigation | ||
|
|
||
| - Status: accepted | ||
| - Date: 2026-07-18 | ||
| - Supersedes: none | ||
| - Amends: ADR 0089, ADR 0090 | ||
|
|
||
| ## Context | ||
|
|
||
| ADRs 0089 and 0090 authorize a version-coupled compiler tooling projection and | ||
| conservative same-Bubble Package snapshots. The private language server can | ||
| therefore prove which declaration a direct call selects, but it discards that | ||
| identity after producing parameter inlay hints. Editors cannot navigate even | ||
| between two Modules that the same compiler query has already resolved. | ||
|
|
||
| Definition navigation cannot be recovered safely from spelling, namespaces, | ||
| filenames, numeric IDs, or CLI output. Complete Workspace dependency loading, | ||
| public source and syntax schemas, local binding indexes, references, and rename | ||
| remain separate work. | ||
|
|
||
| ## Decision | ||
|
|
||
| The private compiler tooling projection may expose resolved definition | ||
| occurrences. Each occurrence contains: | ||
|
|
||
| - the exact source selection span; | ||
| - the resolved `SymbolIdentity`; and | ||
| - no syntax, resolver, HIR, or MIR value. | ||
|
|
||
| The projection initially covers namespace-scope function declarations and | ||
| statically resolved direct function calls inside one analyzed Bubble. A | ||
| declaration name is an occurrence of its own identity. Unresolved, indirect, | ||
| referenced-dependency, method, member, local, and parameter uses do not produce | ||
| an occurrence in this slice. | ||
|
|
||
| The private language server implements LSP 3.17 | ||
| `textDocument/definition`. It joins an occurrence to a declaration by | ||
| `SymbolIdentity`, returns the declaration selection range, and returns `null` | ||
| when either side is absent. The request reads the current immutable document | ||
| snapshot, checks cancellation, and uses UTF-16 positions. A definition in | ||
| another source-owned Module of the same selected Bubble may return that | ||
| Module's file URI. | ||
|
|
||
| One Bubble analysis snapshot owns a deterministic map from session `FileId` | ||
| values to source URIs and text. An already open Module keeps its session | ||
| `FileId`; a closed Module receives a deterministic snapshot-local ID. File | ||
| paths and URIs select and present source inputs only. They never establish | ||
| symbol identity, merge visibility, or replace the Item → Module → Bubble → | ||
| Package → Workspace hierarchy. | ||
|
|
||
| The existing ADR 0090 restrictions remain active. Package snapshots are used | ||
| only for conventionally discovered Bubbles without unresolved dependency | ||
| edges. Dependency references, sibling Bubbles, nested Packages, and editor | ||
| workspace folders are never guessed or merged. Complete Workspace snapshots | ||
| must later reuse the Package resolver and locked dependency graph rather than | ||
| extend this filesystem bootstrap heuristically. | ||
|
|
||
| References, rename, completion, signature help, local/member navigation, | ||
| cross-Bubble navigation, public `Pop.Syntax`/`Pop.Lsp` schemas, and incremental | ||
| range edits remain outside this decision. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - Same-Module and same-Bubble direct calls gain exact definition navigation. | ||
| - Navigation reuses compiler resolution instead of building a competing editor | ||
| index. | ||
| - The snapshot retains enough source identity to present cross-Module | ||
| locations while semantic identity remains path-independent. | ||
| - Unsupported or incomplete analysis fails closed with `null`. | ||
|
|
||
| ## Alternatives considered | ||
|
|
||
| ### Search names in open text | ||
|
|
||
| Rejected because spelling cannot prove overload selection, visibility, | ||
| shadowing, or Bubble identity. | ||
|
|
||
| ### Navigate by namespace and filename | ||
|
|
||
| Rejected because neither value is semantic identity and Modules do not derive | ||
| identity from directory layout. | ||
|
|
||
| ### Expose resolver or HIR nodes to the server | ||
|
|
||
| Rejected because compiler-private arenas and IR are unstable ownership | ||
| boundaries and are not public tooling schemas. | ||
|
|
||
| ### Implement references and rename together | ||
|
|
||
| Rejected because multi-file edits, dependency indexes, locals, members, stale | ||
| snapshot handling, and atomic verification require a broader contract. | ||
|
|
||
| ## Required conformance tests | ||
|
|
||
| - a declaration name and a same-Module direct call navigate to the exact | ||
| declaration selection; | ||
| - a call in one Module navigates to a declaration in a sibling Module of the | ||
| same dependency-free Bubble; | ||
| - UTF-16 request and result positions remain exact around non-BMP text; | ||
| - unresolved, indirect, dependency-bearing, stale, and closed snapshots do not | ||
| fabricate a destination; | ||
| - two Packages or Bubbles with the same namespace never merge; | ||
| - the compiler projection joins occurrences and declarations only by | ||
| `SymbolIdentity`; and | ||
| - advertised LSP capabilities exactly match the implemented request. | ||
|
|
||
| ## Documents/components affected | ||
|
|
||
| CLI/tooling architecture, implementation roadmap, closed design decisions, | ||
| compiler driver tooling projections, private language-server snapshots and | ||
| transport, official editor extensions, and architecture conformance tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Definition navigation is absent for every direct call inside an
@CompileTimefunction because this projection only scans runtime HIR, which excludes those functions. Including the already-resolved compile-time typed bodies in the projection would cover these namespace-scope calls consistently.Prompt for AI agents