Add compiler-backed definition navigation - #38
Open
serene1491 wants to merge 2 commits into
Open
Conversation
Preserve compiler-resolved callee spans and project definition occurrences by SymbolIdentity so the private language server can answer LSP definition requests without textual lookup. Limit navigation to namespace functions in the current dependency-free Bubble snapshot. Document the boundary in ADR 0092 and cover overloads, UTF-16 positions, sibling Modules, unresolved dependencies, and the LSP transport.
Contributor
There was a problem hiding this comment.
1 issue found across 20 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/compiler/driver/src/front_end.rs">
<violation number="1" location="crates/compiler/driver/src/front_end.rs:334">
P2: Definition navigation is absent for every direct call inside an `@CompileTime` function 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.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| .collect::<Vec<_>>(); | ||
| if let Some(hir) = hir { | ||
| occurrences.extend( | ||
| hir.functions() |
Contributor
There was a problem hiding this comment.
P2: Definition navigation is absent for every direct call inside an @CompileTime function 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
Check if this issue is valid — if so, understand the root cause and fix it. At crates/compiler/driver/src/front_end.rs, line 334:
<comment>Definition navigation is absent for every direct call inside an `@CompileTime` function 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.</comment>
<file context>
@@ -309,10 +311,46 @@ pub fn analyze_bubble(input: FrontEndBubbleInput) -> FrontEndResult {
+ .collect::<Vec<_>>();
+ if let Some(hir) = hir {
+ occurrences.extend(
+ hir.functions()
+ .iter()
+ .chain(hir.methods().iter().map(pop_hir::HirMethod::function))
</file context>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add compiler-backed go-to-definition for namespace-scope functions and
statically resolved direct calls in the private Pop Lang language server.
The compiler now preserves the exact callee span through typed bodies and HIR,
then publishes a bounded tooling projection keyed by
SymbolIdentity. Thelanguage server joins occurrences to declarations without textual lookup and
serves LSP 3.17
textDocument/definitionlocations in the current immutablesame-Bubble snapshot.
This change intentionally does not add local/member navigation, dependency or
cross-Bubble navigation, references, rename, completion, or a public
Pop.Syntax/Pop.Lspschema.Architecture traceability
Definition Navigation
advertises and implements LSP 3.17
textDocument/definition; no Pop Langpublic package API is stabilized.
implementation roadmap, closed design decisions, CLI/tooling architecture,
language-server README, and architecture conformance tests.
Verification
cargo fmt --all -- --checkcargo check --workspace --all-targetscargo test --workspace --all-targetscargo clippy --workspace --all-targets -- -D warningsIf a check was not run, explain why:
cargo test --workspace --all-targetswas not run because the repository'sarchitecture conformance policy rejects executing harness-free benchmarks.
The accepted PR test command was used instead:
Additional successful validation:
Review notes
The bootstrap Package snapshot remains deliberately conservative. It navigates
across source-owned Modules only when conventional discovery selects one Bubble
without unresolved dependency edges. Dependency-bearing Packages fall back to
standalone analysis and return no fabricated destination.
The compiler projection currently covers function declarations and direct
function calls. Local variables, parameters, fields, methods, referenced
dependencies, references, rename, and complete Workspace snapshots require
separate architecture and query work.
A companion
vscode-popcommit tests the standard LSP capability throughvscode.executeDefinitionProvider; the extension does not implement acompeting navigation engine.
Summary by cubic
Adds compiler-backed go-to-definition for namespace functions and resolved direct calls in the private
pop-language-server. Implements LSP textDocument/definition with precise callee spans and cross‑module navigation within the current dependency‑free Bubble snapshot.Written for commit a9d4cc9. Summary will update on new commits.