Skip to content

fix(lsp): keep completion scoped once a prefix is typed#11

Closed
shockwave-bot[bot] wants to merge 2 commits into
mainfrom
fix/completion-scope-leak
Closed

fix(lsp): keep completion scoped once a prefix is typed#11
shockwave-bot[bot] wants to merge 2 commits into
mainfrom
fix/completion-scope-leak

Conversation

@shockwave-bot
Copy link
Copy Markdown
Contributor

@shockwave-bot shockwave-bot Bot commented Jun 1, 2026

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 <= offset trigger scan selected it instead of the trigger before it, falling through to general_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.
  • Removed the stale comment that mis-described the old behaviour.

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 --check clean
  • cargo clippy -p pseudoscript-lsp --all-targets -- -D warnings clean
  • cargo test -p pseudoscript-lsp — 38/38 lib + 17 cucumber scenarios pass

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>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jun 1, 2026

Deploying pseudoscript-landing with  Cloudflare Pages  Cloudflare Pages

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

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jun 1, 2026

Deploying pseudoscript-ide with  Cloudflare Pages  Cloudflare Pages

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

View logs

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>
@shockwave-bot
Copy link
Copy Markdown
Contributor Author

shockwave-bot Bot commented Jun 1, 2026

Folded into #12, which now opens against main and contains this fix as its first commit. Single PR per request.

@shockwave-bot shockwave-bot Bot closed this Jun 1, 2026
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.

LSP completion: narrowing scope leaks to general items once a prefix is typed

0 participants