Skip to content

fix(completion): no suggestions inside comments or strings - #4

Merged
Kinflou merged 1 commit into
masterfrom
fix/no-completion-in-comments
Sep 2, 2026
Merged

fix(completion): no suggestions inside comments or strings#4
Kinflou merged 1 commit into
masterfrom
fix/no-completion-in-comments

Conversation

@Kinflou

@Kinflou Kinflou commented Sep 2, 2026

Copy link
Copy Markdown
Member

get_completions returned keywords / primitives / types for any cursor position — including inside /// docstrings, // comments and string literals, where the text isn't Comline (visible as the playground editor popping use / bool mid-docstring).

Adds in_comment_or_string(source, offset) — a one-line prefix scan (Comline has no block comments and strings don't span lines) — and returns [] early when the cursor is in either. A // inside a string doesn't start a comment.

Shared fix: comline-lsp (→ VS Code) and the playground both get it. 47 unit + 2 e2e + 4 integration green; wasm build unaffected.

Completion offered keywords / primitives / types regardless of cursor
context — including inside `///` docstrings, `//` comments and string
literals, where the text isn't Comline. Add a one-line scan
(`in_comment_or_string`) and bail early. Fixes the playground editor
popping `use` / `bool` while typing a docstring.
@Kinflou
Kinflou merged commit d44ab76 into master Sep 2, 2026
4 checks passed
@Kinflou
Kinflou deleted the fix/no-completion-in-comments branch September 2, 2026 11:32
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.

1 participant