@protolabsai/proto 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +203 -0
- package/README.md +286 -0
- package/dist/bundled/adversarial-verification/SKILL.md +98 -0
- package/dist/bundled/brainstorming/SKILL.md +171 -0
- package/dist/bundled/coding-agent-standards/SKILL.md +67 -0
- package/dist/bundled/dispatching-parallel-agents/SKILL.md +193 -0
- package/dist/bundled/executing-plans/SKILL.md +77 -0
- package/dist/bundled/finishing-a-development-branch/SKILL.md +213 -0
- package/dist/bundled/loop/SKILL.md +61 -0
- package/dist/bundled/qc-helper/SKILL.md +151 -0
- package/dist/bundled/qc-helper/docs/_meta.ts +30 -0
- package/dist/bundled/qc-helper/docs/common-workflow.md +571 -0
- package/dist/bundled/qc-helper/docs/configuration/_meta.ts +10 -0
- package/dist/bundled/qc-helper/docs/configuration/auth.md +366 -0
- package/dist/bundled/qc-helper/docs/configuration/memory.md +0 -0
- package/dist/bundled/qc-helper/docs/configuration/model-providers.md +542 -0
- package/dist/bundled/qc-helper/docs/configuration/qwen-ignore.md +55 -0
- package/dist/bundled/qc-helper/docs/configuration/settings.md +652 -0
- package/dist/bundled/qc-helper/docs/configuration/themes.md +160 -0
- package/dist/bundled/qc-helper/docs/configuration/trusted-folders.md +61 -0
- package/dist/bundled/qc-helper/docs/extension/_meta.ts +9 -0
- package/dist/bundled/qc-helper/docs/extension/extension-releasing.md +121 -0
- package/dist/bundled/qc-helper/docs/extension/getting-started-extensions.md +299 -0
- package/dist/bundled/qc-helper/docs/extension/introduction.md +303 -0
- package/dist/bundled/qc-helper/docs/features/_meta.ts +18 -0
- package/dist/bundled/qc-helper/docs/features/approval-mode.md +263 -0
- package/dist/bundled/qc-helper/docs/features/arena.md +218 -0
- package/dist/bundled/qc-helper/docs/features/checkpointing.md +77 -0
- package/dist/bundled/qc-helper/docs/features/commands.md +312 -0
- package/dist/bundled/qc-helper/docs/features/headless.md +318 -0
- package/dist/bundled/qc-helper/docs/features/hooks.md +343 -0
- package/dist/bundled/qc-helper/docs/features/language.md +139 -0
- package/dist/bundled/qc-helper/docs/features/lsp.md +453 -0
- package/dist/bundled/qc-helper/docs/features/mcp.md +281 -0
- package/dist/bundled/qc-helper/docs/features/sandbox.md +241 -0
- package/dist/bundled/qc-helper/docs/features/scheduled-tasks.md +139 -0
- package/dist/bundled/qc-helper/docs/features/skills.md +289 -0
- package/dist/bundled/qc-helper/docs/features/sub-agents.md +307 -0
- package/dist/bundled/qc-helper/docs/features/token-caching.md +29 -0
- package/dist/bundled/qc-helper/docs/ide-integration/_meta.ts +4 -0
- package/dist/bundled/qc-helper/docs/ide-integration/ide-companion-spec.md +182 -0
- package/dist/bundled/qc-helper/docs/ide-integration/ide-integration.md +144 -0
- package/dist/bundled/qc-helper/docs/integration-github-action.md +241 -0
- package/dist/bundled/qc-helper/docs/integration-jetbrains.md +81 -0
- package/dist/bundled/qc-helper/docs/integration-vscode.md +39 -0
- package/dist/bundled/qc-helper/docs/integration-zed.md +72 -0
- package/dist/bundled/qc-helper/docs/overview.md +64 -0
- package/dist/bundled/qc-helper/docs/quickstart.md +273 -0
- package/dist/bundled/qc-helper/docs/reference/_meta.ts +4 -0
- package/dist/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +72 -0
- package/dist/bundled/qc-helper/docs/reference/sdk-api.md +524 -0
- package/dist/bundled/qc-helper/docs/support/Uninstall.md +42 -0
- package/dist/bundled/qc-helper/docs/support/_meta.ts +6 -0
- package/dist/bundled/qc-helper/docs/support/tos-privacy.md +112 -0
- package/dist/bundled/qc-helper/docs/support/troubleshooting.md +123 -0
- package/dist/bundled/receiving-code-review/SKILL.md +226 -0
- package/dist/bundled/requesting-code-review/SKILL.md +115 -0
- package/dist/bundled/review/SKILL.md +123 -0
- package/dist/bundled/subagent-driven-development/SKILL.md +292 -0
- package/dist/bundled/subagent-driven-development/code-quality-reviewer-prompt.md +27 -0
- package/dist/bundled/subagent-driven-development/implementer-prompt.md +113 -0
- package/dist/bundled/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/dist/bundled/systematic-debugging/SKILL.md +305 -0
- package/dist/bundled/test-driven-development/SKILL.md +396 -0
- package/dist/bundled/using-git-worktrees/SKILL.md +223 -0
- package/dist/bundled/using-superpowers/SKILL.md +117 -0
- package/dist/bundled/verification-before-completion/SKILL.md +147 -0
- package/dist/bundled/writing-plans/SKILL.md +159 -0
- package/dist/bundled/writing-skills/SKILL.md +716 -0
- package/dist/cli.js +483432 -0
- package/dist/sandbox-macos-permissive-closed.sb +32 -0
- package/dist/sandbox-macos-permissive-open.sb +27 -0
- package/dist/sandbox-macos-permissive-proxied.sb +37 -0
- package/dist/sandbox-macos-restrictive-closed.sb +93 -0
- package/dist/sandbox-macos-restrictive-open.sb +96 -0
- package/dist/sandbox-macos-restrictive-proxied.sb +98 -0
- package/dist/vendor/ripgrep/COPYING +3 -0
- package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/x64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/dist/vendor/tree-sitter/tree-sitter-bash.wasm +0 -0
- package/dist/vendor/tree-sitter/tree-sitter.wasm +0 -0
- package/package.json +143 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Internationalization (i18n) & Language
|
|
2
|
+
|
|
3
|
+
Qwen Code is built for multilingual workflows: it supports UI localization (i18n/l10n) in the CLI, lets you choose the assistant output language, and allows custom UI language packs.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
From a user point of view, Qwen Code’s “internationalization” spans multiple layers:
|
|
8
|
+
|
|
9
|
+
| Capability / Setting | What it controls | Where stored |
|
|
10
|
+
| ------------------------ | ---------------------------------------------------------------------- | ---------------------------- |
|
|
11
|
+
| `/language ui` | Terminal UI text (menus, system messages, prompts) | `~/.qwen/settings.json` |
|
|
12
|
+
| `/language output` | Language the AI responds in (an output preference, not UI translation) | `~/.qwen/output-language.md` |
|
|
13
|
+
| Custom UI language packs | Overrides/extends built-in UI translations | `~/.qwen/locales/*.js` |
|
|
14
|
+
|
|
15
|
+
## UI Language
|
|
16
|
+
|
|
17
|
+
This is the CLI’s UI localization layer (i18n/l10n): it controls the language of menus, prompts, and system messages.
|
|
18
|
+
|
|
19
|
+
### Setting the UI Language
|
|
20
|
+
|
|
21
|
+
Use the `/language ui` command:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
/language ui zh-CN # Chinese
|
|
25
|
+
/language ui en-US # English
|
|
26
|
+
/language ui ru-RU # Russian
|
|
27
|
+
/language ui de-DE # German
|
|
28
|
+
/language ui ja-JP # Japanese
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Aliases are also supported:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
/language ui zh # Chinese
|
|
35
|
+
/language ui en # English
|
|
36
|
+
/language ui ru # Russian
|
|
37
|
+
/language ui de # German
|
|
38
|
+
/language ui ja # Japanese
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Auto-detection
|
|
42
|
+
|
|
43
|
+
On first startup, Qwen Code detects your system locale and sets the UI language automatically.
|
|
44
|
+
|
|
45
|
+
Detection priority:
|
|
46
|
+
|
|
47
|
+
1. `QWEN_CODE_LANG` environment variable
|
|
48
|
+
2. `LANG` environment variable
|
|
49
|
+
3. System locale via JavaScript Intl API
|
|
50
|
+
4. Default: English
|
|
51
|
+
|
|
52
|
+
## LLM Output Language
|
|
53
|
+
|
|
54
|
+
The LLM output language controls what language the AI assistant responds in, regardless of what language you type your questions in.
|
|
55
|
+
|
|
56
|
+
### How It Works
|
|
57
|
+
|
|
58
|
+
The LLM output language is controlled by a rule file at `~/.qwen/output-language.md`. This file is automatically included in the LLM's context during startup, instructing it to respond in the specified language.
|
|
59
|
+
|
|
60
|
+
### Auto-detection
|
|
61
|
+
|
|
62
|
+
On first startup, if no `output-language.md` file exists, Qwen Code automatically creates one based on your system locale. For example:
|
|
63
|
+
|
|
64
|
+
- System locale `zh` creates a rule for Chinese responses
|
|
65
|
+
- System locale `en` creates a rule for English responses
|
|
66
|
+
- System locale `ru` creates a rule for Russian responses
|
|
67
|
+
- System locale `de` creates a rule for German responses
|
|
68
|
+
- System locale `ja` creates a rule for Japanese responses
|
|
69
|
+
|
|
70
|
+
### Manual Setting
|
|
71
|
+
|
|
72
|
+
Use `/language output <language>` to change:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
/language output Chinese
|
|
76
|
+
/language output English
|
|
77
|
+
/language output Japanese
|
|
78
|
+
/language output German
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Any language name works. The LLM will be instructed to respond in that language.
|
|
82
|
+
|
|
83
|
+
> [!note]
|
|
84
|
+
>
|
|
85
|
+
> After changing the output language, restart Qwen Code for the change to take effect.
|
|
86
|
+
|
|
87
|
+
### File Location
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
~/.qwen/output-language.md
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
### Via Settings Dialog
|
|
96
|
+
|
|
97
|
+
1. Run `/settings`
|
|
98
|
+
2. Find "Language" under General
|
|
99
|
+
3. Select your preferred UI language
|
|
100
|
+
|
|
101
|
+
### Via Environment Variable
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
export QWEN_CODE_LANG=zh
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This influences auto-detection on first startup (if you haven’t set a UI language and no `output-language.md` file exists yet).
|
|
108
|
+
|
|
109
|
+
## Custom Language Packs
|
|
110
|
+
|
|
111
|
+
For UI translations, you can create custom language packs in `~/.qwen/locales/`:
|
|
112
|
+
|
|
113
|
+
- Example: `~/.qwen/locales/es.js` for Spanish
|
|
114
|
+
- Example: `~/.qwen/locales/fr.js` for French
|
|
115
|
+
|
|
116
|
+
User directory takes precedence over built-in translations.
|
|
117
|
+
|
|
118
|
+
> [!tip]
|
|
119
|
+
>
|
|
120
|
+
> Contributions are welcome! If you’d like to improve built-in translations or add new languages.
|
|
121
|
+
> For a concrete example, see [PR #1238: feat(i18n): add Russian language support](https://github.com/QwenLM/qwen-code/pull/1238).
|
|
122
|
+
|
|
123
|
+
### Language Pack Format
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
// ~/.qwen/locales/es.js
|
|
127
|
+
export default {
|
|
128
|
+
Hello: 'Hola',
|
|
129
|
+
Settings: 'Configuracion',
|
|
130
|
+
// ... more translations
|
|
131
|
+
};
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Related Commands
|
|
135
|
+
|
|
136
|
+
- `/language` - Show current language settings
|
|
137
|
+
- `/language ui [lang]` - Set UI language
|
|
138
|
+
- `/language output <language>` - Set LLM output language
|
|
139
|
+
- `/settings` - Open settings dialog
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
# Language Server Protocol (LSP) Support
|
|
2
|
+
|
|
3
|
+
Qwen Code provides native Language Server Protocol (LSP) support, enabling advanced code intelligence features like go-to-definition, find references, diagnostics, and code actions. This integration allows the AI agent to understand your code more deeply and provide more accurate assistance.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
LSP support in Qwen Code works by connecting to language servers that understand your code. Once you configure servers via `.lsp.json` (or extensions), Qwen Code can start them and use them to:
|
|
8
|
+
|
|
9
|
+
- Navigate to symbol definitions
|
|
10
|
+
- Find all references to a symbol
|
|
11
|
+
- Get hover information (documentation, type info)
|
|
12
|
+
- View diagnostic messages (errors, warnings)
|
|
13
|
+
- Access code actions (quick fixes, refactorings)
|
|
14
|
+
- Analyze call hierarchies
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
LSP auto-enables when a `.lsp.json` file exists in your project root. You can also enable it explicitly:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
proto --lsp
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or in `~/.proto/settings.json`:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"general": {
|
|
29
|
+
"lsp": true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
LSP servers are configuration-driven. Define them in `.lsp.json` (or via extensions) for proto to start them.
|
|
35
|
+
|
|
36
|
+
### Prerequisites
|
|
37
|
+
|
|
38
|
+
You need to have the language server for your programming language installed:
|
|
39
|
+
|
|
40
|
+
| Language | Language Server | Install Command |
|
|
41
|
+
| --------------------- | -------------------------- | ------------------------------------------------------------------------------ |
|
|
42
|
+
| TypeScript/JavaScript | typescript-language-server | `npm install -g typescript-language-server typescript` |
|
|
43
|
+
| Python | pylsp | `pip install python-lsp-server` |
|
|
44
|
+
| Go | gopls | `go install golang.org/x/tools/gopls@latest` |
|
|
45
|
+
| Rust | rust-analyzer | [Installation guide](https://rust-analyzer.github.io/manual.html#installation) |
|
|
46
|
+
| C/C++ | clangd | Install LLVM/clangd via your package manager |
|
|
47
|
+
| Java | jdtls | Install JDTLS and a JDK |
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
### .lsp.json File
|
|
52
|
+
|
|
53
|
+
You can configure language servers using a `.lsp.json` file in your project root. This uses the language-keyed format described in the [Claude Code plugin LSP configuration reference](https://code.claude.com/docs/en/plugins-reference#lsp-servers).
|
|
54
|
+
|
|
55
|
+
**Basic format:**
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"typescript": {
|
|
60
|
+
"command": "typescript-language-server",
|
|
61
|
+
"args": ["--stdio"],
|
|
62
|
+
"extensionToLanguage": {
|
|
63
|
+
".ts": "typescript",
|
|
64
|
+
".tsx": "typescriptreact",
|
|
65
|
+
".js": "javascript",
|
|
66
|
+
".jsx": "javascriptreact"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### C/C++ (clangd) configuration
|
|
73
|
+
|
|
74
|
+
Dependencies:
|
|
75
|
+
|
|
76
|
+
- clangd (LLVM) must be installed and available in PATH.
|
|
77
|
+
- A compile database (`compile_commands.json`) or `compile_flags.txt` is required for accurate results.
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"cpp": {
|
|
84
|
+
"command": "clangd",
|
|
85
|
+
"args": [
|
|
86
|
+
"--background-index",
|
|
87
|
+
"--clang-tidy",
|
|
88
|
+
"--header-insertion=iwyu",
|
|
89
|
+
"--completion-style=detailed"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Java (jdtls) configuration
|
|
96
|
+
|
|
97
|
+
Dependencies:
|
|
98
|
+
|
|
99
|
+
- JDK installed and available in PATH (`java`).
|
|
100
|
+
- JDTLS installed and available in PATH (`jdtls`).
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"java": {
|
|
107
|
+
"command": "jdtls",
|
|
108
|
+
"args": ["-configuration", ".jdtls-config", "-data", ".jdtls-workspace"]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Configuration Options
|
|
114
|
+
|
|
115
|
+
#### Required Fields
|
|
116
|
+
|
|
117
|
+
| Option | Type | Description |
|
|
118
|
+
| --------- | ------ | ------------------------------------------------- |
|
|
119
|
+
| `command` | string | Command to start the LSP server (must be in PATH) |
|
|
120
|
+
|
|
121
|
+
#### Optional Fields
|
|
122
|
+
|
|
123
|
+
| Option | Type | Default | Description |
|
|
124
|
+
| ----------------------- | -------- | --------- | ------------------------------------------------------- |
|
|
125
|
+
| `args` | string[] | `[]` | Command line arguments |
|
|
126
|
+
| `transport` | string | `"stdio"` | Transport type: `stdio`, `tcp`, or `socket` |
|
|
127
|
+
| `env` | object | - | Environment variables |
|
|
128
|
+
| `initializationOptions` | object | - | LSP initialization options |
|
|
129
|
+
| `settings` | object | - | Server settings via `workspace/didChangeConfiguration` |
|
|
130
|
+
| `extensionToLanguage` | object | - | Maps file extensions to language identifiers |
|
|
131
|
+
| `workspaceFolder` | string | - | Override workspace folder (must be within project root) |
|
|
132
|
+
| `startupTimeout` | number | `10000` | Startup timeout in milliseconds |
|
|
133
|
+
| `shutdownTimeout` | number | `5000` | Shutdown timeout in milliseconds |
|
|
134
|
+
| `restartOnCrash` | boolean | `false` | Auto-restart on crash |
|
|
135
|
+
| `maxRestarts` | number | `3` | Maximum restart attempts |
|
|
136
|
+
| `trustRequired` | boolean | `true` | Require trusted workspace |
|
|
137
|
+
|
|
138
|
+
### TCP/Socket Transport
|
|
139
|
+
|
|
140
|
+
For servers that use TCP or Unix socket transport:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"remote-lsp": {
|
|
145
|
+
"transport": "tcp",
|
|
146
|
+
"socket": {
|
|
147
|
+
"host": "127.0.0.1",
|
|
148
|
+
"port": 9999
|
|
149
|
+
},
|
|
150
|
+
"extensionToLanguage": {
|
|
151
|
+
".custom": "custom"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Available LSP Operations
|
|
158
|
+
|
|
159
|
+
Qwen Code exposes LSP functionality through the unified `lsp` tool. Here are the available operations:
|
|
160
|
+
|
|
161
|
+
### Code Navigation
|
|
162
|
+
|
|
163
|
+
#### Go to Definition
|
|
164
|
+
|
|
165
|
+
Find where a symbol is defined.
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
Operation: goToDefinition
|
|
169
|
+
Parameters:
|
|
170
|
+
- filePath: Path to the file
|
|
171
|
+
- line: Line number (1-based)
|
|
172
|
+
- character: Column number (1-based)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### Find References
|
|
176
|
+
|
|
177
|
+
Find all references to a symbol.
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
Operation: findReferences
|
|
181
|
+
Parameters:
|
|
182
|
+
- filePath: Path to the file
|
|
183
|
+
- line: Line number (1-based)
|
|
184
|
+
- character: Column number (1-based)
|
|
185
|
+
- includeDeclaration: Include the declaration itself (optional)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### Go to Implementation
|
|
189
|
+
|
|
190
|
+
Find implementations of an interface or abstract method.
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
Operation: goToImplementation
|
|
194
|
+
Parameters:
|
|
195
|
+
- filePath: Path to the file
|
|
196
|
+
- line: Line number (1-based)
|
|
197
|
+
- character: Column number (1-based)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Symbol Information
|
|
201
|
+
|
|
202
|
+
#### Hover
|
|
203
|
+
|
|
204
|
+
Get documentation and type information for a symbol.
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
Operation: hover
|
|
208
|
+
Parameters:
|
|
209
|
+
- filePath: Path to the file
|
|
210
|
+
- line: Line number (1-based)
|
|
211
|
+
- character: Column number (1-based)
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### Document Symbols
|
|
215
|
+
|
|
216
|
+
Get all symbols in a document.
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
Operation: documentSymbol
|
|
220
|
+
Parameters:
|
|
221
|
+
- filePath: Path to the file
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### Workspace Symbol Search
|
|
225
|
+
|
|
226
|
+
Search for symbols across the workspace.
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
Operation: workspaceSymbol
|
|
230
|
+
Parameters:
|
|
231
|
+
- query: Search query string
|
|
232
|
+
- limit: Maximum results (optional)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Call Hierarchy
|
|
236
|
+
|
|
237
|
+
#### Prepare Call Hierarchy
|
|
238
|
+
|
|
239
|
+
Get the call hierarchy item at a position.
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
Operation: prepareCallHierarchy
|
|
243
|
+
Parameters:
|
|
244
|
+
- filePath: Path to the file
|
|
245
|
+
- line: Line number (1-based)
|
|
246
|
+
- character: Column number (1-based)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### Incoming Calls
|
|
250
|
+
|
|
251
|
+
Find all functions that call the given function.
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
Operation: incomingCalls
|
|
255
|
+
Parameters:
|
|
256
|
+
- callHierarchyItem: Item from prepareCallHierarchy
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### Outgoing Calls
|
|
260
|
+
|
|
261
|
+
Find all functions called by the given function.
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
Operation: outgoingCalls
|
|
265
|
+
Parameters:
|
|
266
|
+
- callHierarchyItem: Item from prepareCallHierarchy
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Diagnostics
|
|
270
|
+
|
|
271
|
+
#### File Diagnostics
|
|
272
|
+
|
|
273
|
+
Get diagnostic messages (errors, warnings) for a file.
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
Operation: diagnostics
|
|
277
|
+
Parameters:
|
|
278
|
+
- filePath: Path to the file
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
#### Workspace Diagnostics
|
|
282
|
+
|
|
283
|
+
Get all diagnostic messages across the workspace.
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
Operation: workspaceDiagnostics
|
|
287
|
+
Parameters:
|
|
288
|
+
- limit: Maximum results (optional)
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Code Actions
|
|
292
|
+
|
|
293
|
+
#### Get Code Actions
|
|
294
|
+
|
|
295
|
+
Get available code actions (quick fixes, refactorings) at a location.
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
Operation: codeActions
|
|
299
|
+
Parameters:
|
|
300
|
+
- filePath: Path to the file
|
|
301
|
+
- line: Start line number (1-based)
|
|
302
|
+
- character: Start column number (1-based)
|
|
303
|
+
- endLine: End line number (optional, defaults to line)
|
|
304
|
+
- endCharacter: End column (optional, defaults to character)
|
|
305
|
+
- diagnostics: Diagnostics to get actions for (optional)
|
|
306
|
+
- codeActionKinds: Filter by action kind (optional)
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Code action kinds:
|
|
310
|
+
|
|
311
|
+
- `quickfix` - Quick fixes for errors/warnings
|
|
312
|
+
- `refactor` - Refactoring operations
|
|
313
|
+
- `refactor.extract` - Extract to function/variable
|
|
314
|
+
- `refactor.inline` - Inline function/variable
|
|
315
|
+
- `source` - Source code actions
|
|
316
|
+
- `source.organizeImports` - Organize imports
|
|
317
|
+
- `source.fixAll` - Fix all auto-fixable issues
|
|
318
|
+
|
|
319
|
+
## Security
|
|
320
|
+
|
|
321
|
+
LSP servers are only started in trusted workspaces by default. This is because language servers run with your user permissions and can execute code.
|
|
322
|
+
|
|
323
|
+
### Trust Controls
|
|
324
|
+
|
|
325
|
+
- **Trusted Workspace**: LSP servers start if configured
|
|
326
|
+
- **Untrusted Workspace**: LSP servers won't start unless `trustRequired: false` is set in the server configuration
|
|
327
|
+
|
|
328
|
+
To mark a workspace as trusted, use the `/trust` command or configure trusted folders in settings.
|
|
329
|
+
|
|
330
|
+
### Per-Server Trust Override
|
|
331
|
+
|
|
332
|
+
You can override trust requirements for specific servers in their configuration:
|
|
333
|
+
|
|
334
|
+
```json
|
|
335
|
+
{
|
|
336
|
+
"safe-server": {
|
|
337
|
+
"command": "safe-language-server",
|
|
338
|
+
"args": ["--stdio"],
|
|
339
|
+
"trustRequired": false,
|
|
340
|
+
"extensionToLanguage": {
|
|
341
|
+
".safe": "safe"
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Troubleshooting
|
|
348
|
+
|
|
349
|
+
### Server Not Starting
|
|
350
|
+
|
|
351
|
+
1. **Check if the server is installed**: Run the command manually to verify
|
|
352
|
+
2. **Check the PATH**: Ensure the server binary is in your system PATH
|
|
353
|
+
3. **Check workspace trust**: The workspace must be trusted for LSP
|
|
354
|
+
4. **Check logs**: Look for error messages in the console output
|
|
355
|
+
5. **Verify LSP is enabled**: Check that `.lsp.json` exists or `--lsp` flag is set
|
|
356
|
+
|
|
357
|
+
### Slow Performance
|
|
358
|
+
|
|
359
|
+
1. **Large projects**: Consider excluding `node_modules` and other large directories
|
|
360
|
+
2. **Server timeout**: Increase `startupTimeout` in server configuration for slow servers
|
|
361
|
+
|
|
362
|
+
### No Results
|
|
363
|
+
|
|
364
|
+
1. **Server not ready**: The server may still be indexing
|
|
365
|
+
2. **File not saved**: Save your file for the server to pick up changes
|
|
366
|
+
3. **Wrong language**: Check if the correct server is running for your language
|
|
367
|
+
|
|
368
|
+
### Debugging
|
|
369
|
+
|
|
370
|
+
Enable debug logging to see LSP communication:
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
DEBUG=lsp* proto --lsp
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Or check the LSP debugging guide at `packages/cli/LSP_DEBUGGING_GUIDE.md`.
|
|
377
|
+
|
|
378
|
+
## Claude Code Compatibility
|
|
379
|
+
|
|
380
|
+
Qwen Code supports Claude Code-style `.lsp.json` configuration files in the language-keyed format defined in the [Claude Code plugins reference](https://code.claude.com/docs/en/plugins-reference#lsp-servers). If you're migrating from Claude Code, use the language-as-key layout in your configuration.
|
|
381
|
+
|
|
382
|
+
### Configuration Format
|
|
383
|
+
|
|
384
|
+
The recommended format follows Claude Code's specification:
|
|
385
|
+
|
|
386
|
+
```json
|
|
387
|
+
{
|
|
388
|
+
"go": {
|
|
389
|
+
"command": "gopls",
|
|
390
|
+
"args": ["serve"],
|
|
391
|
+
"extensionToLanguage": {
|
|
392
|
+
".go": "go"
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Claude Code LSP plugins can also supply `lspServers` in `plugin.json` (or a referenced `.lsp.json`). Qwen Code loads those configs when the extension is enabled, and they must use the same language-keyed format.
|
|
399
|
+
|
|
400
|
+
## Best Practices
|
|
401
|
+
|
|
402
|
+
1. **Install language servers globally**: This ensures they're available in all projects
|
|
403
|
+
2. **Use project-specific settings**: Configure server options per project when needed via `.lsp.json`
|
|
404
|
+
3. **Keep servers updated**: Update your language servers regularly for best results
|
|
405
|
+
4. **Trust wisely**: Only trust workspaces from trusted sources
|
|
406
|
+
|
|
407
|
+
## FAQ
|
|
408
|
+
|
|
409
|
+
### Q: How do I enable LSP?
|
|
410
|
+
|
|
411
|
+
Place a `.lsp.json` in your project root — LSP auto-enables. Or run `proto --lsp`, or set `general.lsp: true` in settings.
|
|
412
|
+
|
|
413
|
+
### Q: How do I know which language servers are running?
|
|
414
|
+
|
|
415
|
+
Use the `/lsp status` command to see all configured and running language servers.
|
|
416
|
+
|
|
417
|
+
### Q: Can I use multiple language servers for the same file type?
|
|
418
|
+
|
|
419
|
+
Yes, but only one will be used for each operation. The first server that returns results wins.
|
|
420
|
+
|
|
421
|
+
### Q: Does LSP work in sandbox mode?
|
|
422
|
+
|
|
423
|
+
LSP servers run outside the sandbox to access your code. They're subject to workspace trust controls.
|
|
424
|
+
|
|
425
|
+
## SDK usage
|
|
426
|
+
|
|
427
|
+
Enable LSP when using the [TypeScript SDK](../reference/sdk-api.md) by setting `lsp: true`:
|
|
428
|
+
|
|
429
|
+
```typescript
|
|
430
|
+
import { query, isLspDiagnosticEvent } from '@qwen-code/sdk';
|
|
431
|
+
|
|
432
|
+
const conversation = query({
|
|
433
|
+
prompt: 'Fix all type errors in the auth module',
|
|
434
|
+
options: {
|
|
435
|
+
lsp: true,
|
|
436
|
+
permissionMode: 'auto-edit',
|
|
437
|
+
},
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
for await (const message of conversation) {
|
|
441
|
+
if (isLspDiagnosticEvent(message)) {
|
|
442
|
+
const { uri, diagnostics } = message.data;
|
|
443
|
+
console.log(`${diagnostics.length} diagnostics in ${uri}`);
|
|
444
|
+
for (const d of diagnostics) {
|
|
445
|
+
console.log(
|
|
446
|
+
` [${d.severity}] ${d.message} (line ${d.range.start.line})`,
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
The SDK passes `--lsp` to the CLI process. Language servers are configured via `.lsp.json` or installed LSP plugins, the same as CLI usage. The `SDKLspDiagnosticEvent` surfaces diagnostics in the message stream so your application can react to type errors, missing imports, and other issues.
|