Repository navigation
feat(lsp): add quick fix for misspelled @namespace references - #87
Merged
monga-puneet merged 2 commits intoOct 9, 2026
Merged
monga-puneet merged 2 commits into
monga-puneet merged 2 commits into
Conversation
The undefined-reference lint already computes a "did you mean" suggestion but the editor only showed it in the message. Add a "Change to '<name>'" quick fix that replaces just the misspelled segment (the namespace or the last member) of the reference. To know which segment was misspelled, undefinedReferenceDiagnostic now records it in data.found, matching what invalid-modifier and unknown-type diagnostics already do.
monga-puneet
approved these changes
Oct 9, 2026
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.
What
Adds a "Change to ''" quick fix in the LSP for
undefined-referencediagnostics, so@variables.custmer_namecan be fixed to@variables.customer_namefrom the lightbulb menu. Misspelled namespaces (@varibles.x->@variables.x) are handled too.Why
The lint pass already works out a "Did you mean ...?" suggestion and puts it in
data.suggestion, but the editor only shows it in the message text.invalid-modifierandunknown-typealready have this kind of fix.How
undefinedReferenceDiagnostictakes a newfoundargument (the misspelled segment) and stores it indata.found, the same key the other diagnostics use. All callers inlanguageand the agentfabric dialect are updated, and the docs signature is too.code-actions.tsreplaces only that segment: the namespace right after the@, or the last member. It checks that the text at that position matchesfoundbefore offering the fix. It skips multi-line ranges and@foo.foo, where the namespace and member can't be told apart.Test Plan
code-actions.test.ts: misspelled member, misspelled namespace, no close match (no action)pnpm testpasses inpackages/language,packages/lsp,dialect/agentscript,dialect/agentforceanddialect/agentfabricpnpm typecheckand prettier pass for the touched packages