* fix(docs): correct outdated and inaccurate LSP documentation
- Remove reference to non-existent `packages/cli/LSP_DEBUGGING_GUIDE.md`
- Remove reference to unimplemented `/lsp status` slash command
- Replace incorrect `DEBUG=lsp*` env var with actual debug log location
(`~/.qwen/debug/` session files with `[LSP]` tag)
- Remove external Claude Code documentation links (`code.claude.com`)
- Document `isPathSafe` constraint: absolute paths outside workspace
are blocked, users must add server binary directory to PATH
- Add practical troubleshooting: `ps aux | grep <server>` to check
if the server process is actually running
- Add clangd-specific guidance: `--background-index`, `compile_commands.json`
location, and `--compile-commands-dir` usage
- Simplify trust documentation (remove vague "configure in settings")
* fix(lsp): allow absolute paths in LSP server command configuration
Previously, `isPathSafe` rejected any command containing a path
separator that resolved outside the workspace directory. This blocked
legitimate use cases where users specify absolute paths to language
server binaries (e.g. `/usr/bin/clangd`, `/opt/tools/jdtls/bin/jdtls`).
The fix allows:
- Bare command names resolved via PATH (unchanged)
- Absolute paths (explicit user intent, already gated by trust checks)
- Relative paths within the workspace (unchanged)
Only relative paths that traverse outside the workspace (e.g.
`../../malicious-binary`) are still blocked.
Closes: server silently fails to start when users configure absolute
paths in `.lsp.json`, with only a debug log warning visible.
* feat(lsp): inject LSP priority instruction into system prompt when enabled
The model was not using the LSP tool because the system prompt's
"Tool Usage" section never mentioned it. The tool description alone
("ALWAYS use LSP as the PRIMARY tool") was insufficient — models
follow system prompt instructions more reliably than tool descriptions.
Changes:
- getCoreSystemPrompt() accepts `options.lspEnabled` parameter
- When LSP is enabled, injects an instruction in the Tool Usage section
telling the model to ALWAYS use the LSP tool FIRST for code
intelligence queries (definitions, references, hover, symbols, etc.)
instead of falling back to grep/readfile
- Updated client.ts to pass config.isLspEnabled() to the prompt builder
- Updated test mocks and snapshots
* feat(lsp): add symbolName parameter for position-free LSP queries
The model avoided calling LSP for findReferences, hover, etc. because
these operations required filePath + line + character which the user
rarely provides. The model would read files directly instead.
Changes:
- Add `symbolName` optional parameter to LspTool
- When symbolName is provided without line/character, auto-resolve
the symbol's position via workspaceSymbol before executing the
actual operation (findReferences, hover, goToImplementation, etc.)
- Update tool description with examples showing symbolName usage
- Move LSP priority instruction to top of system prompt for visibility
- Add debug logging for LSP prompt injection
This enables natural queries like:
{operation: "findReferences", symbolName: "Calculator"}
{operation: "hover", symbolName: "addShape"}
without requiring the user to know exact file positions.
* feat(lsp): add LSP reminder to grep/readfile tool descriptions
When LSP is enabled, the model often chose grep or readfile instead
of LSP for code intelligence queries. Now the competing tools'
descriptions include a note reminding the model to use the LSP tool
for definitions, references, symbols, hover, diagnostics, etc.
This "push-pull" approach:
- System prompt pushes toward LSP (top-level priority instruction)
- Grep/ReadFile descriptions pull away from code intelligence usage
* fix(docs): align LSP doc with isPathSafe change — absolute paths now supported
The doc still said "absolute paths outside the workspace are not
supported" but the code was changed to allow them. Updated all
three places (Required Fields table, Troubleshooting, Debugging)
to reflect that absolute paths are now accepted.
* fix(lsp): improve symbol-based tool resolution
* fix(lsp): normalize display paths across platforms
* fix(lsp): narrow docs and path safety changes
* fix(lsp): add edge-case tests for isPathSafe and fix Chinese comment
- Add test for intermediate path traversal (./a/../../../etc/passwd)
- Add test for forward-slash relative paths (tools/clangd)
- Replace Chinese JSDoc with English on requestUserConsent
* fix(lsp): rename requestUserConsent to checkWorkspaceTrust
The method only checks workspace trust level and does not actually
prompt the user for consent. Rename the method and update the JSDoc
and call-site log message to accurately reflect the behavior.
Key changes:
1. Remove LspLanguageDetector — LSP is now fully config-driven via
.lsp.json or extensions. No more auto-detected built-in presets
that fail when the server binary is missing.
2. Add ensureDocumentOpen — send textDocument/didOpen before every
document-level LSP request (definitions, references, hover,
documentSymbol, implementations, prepareCallHierarchy, diagnostics,
codeActions). This fixes the root cause of most methods returning
empty results (Issue #2106, #1873).
3. Add retry mechanism for slow servers — when a freshly opened
document yields empty results on non-TypeScript servers (jdtls,
clangd, pylsp), wait 2s and retry once. This mirrors the existing
retry logic in workspaceSymbols.
4. Handle LSP 3.17 WorkspaceSymbol format — location.range is now
optional in normalizeSymbolResult, fixing jdtls workspace symbol
responses that omit the range field.
5. Improve workspace symbol warmup — for non-TypeScript servers, open
a workspace file before the first workspace/symbol request and
retry on empty results after a warmup delay.
6. Track warmup-opened URIs — warmupTypescriptServer now returns the
opened URI, which is registered with ensureDocumentOpen to prevent
duplicate didOpen notifications.
Closes#2106, closes#1873
Made-with: Cursor
- remove configuration options such as lsp.enabled, lsp.allowed, lsp.excluded, etc. from settings.json schema
- Delete lspSettingsSchema.ts files and associated JSON schema definitions
- Removed VS Code settings loading function, no longer merge. vscode/settings.json configuration
- Updated LSP documentation to reflect new configurations and experimental flags
-remove allow/exclude parameters in NativeLspService constructor
- Create new LspConfigLoader classes to handle LSP configuration loading and merging
- Updated debug guide to match the new configuration mechanism
- Simplify loadCliConfig functions, remove startLsp options
- Reconstruct the configuration loading process to remove duplicate configuration merge logic
- Add LspConfigLoader classes to implement configuration parsing and merging functions