[BUG] textDocument/completion returns -32600 "invalid request" when auto-triggered, racing with textDocument/didChange
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript, vscode
- Domain
- tooling
Research direction
Start by reproducing the auto-triggered request with verbose LSP tracing, then trace the textDocument/completion and textDocument/didChange handling in the extension or server. Done means typing a trigger character produces completion results without an -32600 invalid request, while explicit Ctrl+Space continues to work.
Written by the indexing model from the issue text.
Description
(Note: this bug report was generated when I tried to get Claude Code to help me set up autocompletion, but I am a real person :) )
Describe the bug
Auto-triggered completions (via the . trigger character) always fail with -32600: invalid request from the LSP server. Completions only succeed when explicitly invoked with Ctrl+Space after a pause in typing.
This means member access completions (e.g., math.) never appear automatically in VSCode despite . being registered as a trigger character in the server's completionProvider capabilities.
To Reproduce
Open a .mojo file in VSCode with the Mojo extension installed
Add import math at the top
Inside a function, type math.
Observe: no completion popup appears
For comparison, place the cursor after math. and press Ctrl+Space — completions appear correctly.
Expected behavior
Typing . should trigger the completion popup automatically, as . is registered in the server's completionProvider.triggerCharacters.
LSP Trace Evidence
With mojo.trace.server: verbose enabled, the auto-triggered completion requests consistently fail:
I[10:57:50.352] --> textDocument/didChange (version=6)
I[10:57:50.352] --> textDocument/completion(18)
I[10:57:50.352] --> reply:textDocument/completion(18): -32600: invalid request
The explicit Ctrl+Space invocation (after a pause, no concurrent didChange) succeeds:
I[10:58:53.922] --> textDocument/completion(77)
I[10:58:54.800] --> reply:textDocument/completion(77)
{"id":77,"jsonrpc":"2.0","result":{"isIncomplete":false,"items":[...]}}
The root cause appears to be a race condition: the LSP rejects textDocument/completion requests that arrive concurrently with textDocument/didChange notifications. The auto-trigger fires at the same instant as the document change, causing the rejection. Ctrl+Space works because the user pauses before pressing it, allowing the document change to finish processing.
Environment
Mojo version: 0.26.2 (via pixi)
OS: Linux (Ubuntu)
VSCode extension: modular-mojotools.vscode-mojo 26.2.0
- Dominant language
- TypeScript
- Stars
- 38
- Forks
- 17
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 13
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modular/vscode-mojo
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
modular/vscode-mojo#263 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modular/vscode-mojo#20 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
modular/vscode-mojo#111 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
modular/vscode-mojo#106 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
modular/vscode-mojo#59 ·
All issues in modular/vscode-mojo
Similar issues
-
comp/dashboard P3 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
NousResearch/hermes-agent#117722 ·
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·