fix(lsp): keep completion scoped once a prefix is typed#11
Closed
shockwave-bot[bot] wants to merge 2 commits into
Closed
fix(lsp): keep completion scoped once a prefix is typed#11shockwave-bot[bot] wants to merge 2 commits into
shockwave-bot[bot] wants to merge 2 commits into
Conversation
A partial identifier under the caret ends at the offset, so the `<= offset` trigger scan selected it instead of the `.`/`::`/`:`/`#[` before it, falling through to general items. Skip the boundary identifier; its predecessor governs context. Adds with-prefix tests per context. refs #10 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Deploying pseudoscript-landing with
|
| Latest commit: |
f2bdd97
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f053f51d.pseudoscript-landing.pages.dev |
| Branch Preview URL: | https://fix-completion-scope-leak.pseudoscript-landing.pages.dev |
Deploying pseudoscript-ide with
|
| Latest commit: |
f2bdd97
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ac069f3e.pseudoscript-ide.pages.dev |
| Branch Preview URL: | https://fix-completion-scope-leak.pseudoscript-ide.pages.dev |
Native LSP (complete.rs) and the web IDE's context-free JS provider are unsynchronised; wasm exports no completion. Notes the surface to edit per request and the unify-via-wasm direction. refs #10 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Folded into #12, which now opens against main and contains this fix as its first commit. Single PR per request. |
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.
Fixes
Closes #10.
Defect
Completion dropped to general scope the instant a prefix was typed in any narrowing context (
.,::,:/<,#[). A partial identifier under the caret ends at the offset, so the<= offsettrigger scan selected it instead of the trigger before it, falling through togeneral_items— the full keyword + symbol set.Change
governing_trigger(tokens, offset): skips a boundary identifier (kind == Ident && span.end == offset); its predecessor governs context. A caret strictly inside an identifier (span.end > offset) is untouched.Tests
4 with-prefix regression tests — one per context — each asserts the scoped set is present AND a general keyword (
system) is absent. The 4 existing zero-prefix tests still pass.Verification
cargo fmt --checkcleancargo clippy -p pseudoscript-lsp --all-targets -- -D warningscleancargo test -p pseudoscript-lsp— 38/38 lib + 17 cucumber scenarios pass