1
1
# Editor settings
2
2
3
- The editor settings supported by ty's language server, as well as the settings specific to [ ty's VS Code extension] ( https://github.com/astral-sh/ty-vscode/ ) .
3
+ The editor settings supported by ty's language server, as well as the settings specific to [ ty's VS
4
+ Code extension] [ ty-vscode ] .
4
5
5
- ## ` python.ty. disableLanguageServices`
6
+ ## ` disableLanguageServices `
6
7
7
8
Whether to disable the language services for the ty language server like code completion, hover,
8
9
go to definition, etc.
@@ -16,84 +17,142 @@ server for features like code completion, hover, go to definition, etc.
16
17
17
18
** Example usage** :
18
19
19
- ``` json
20
- {
21
- "python.ty.disableLanguageServices" : true
22
- }
23
- ```
24
-
25
- ## ` diagnosticMode `
26
-
27
- Determines the scope of the diagnostics reported by the language server.
28
-
29
- - ` openFilesOnly ` : Diagnostics are reported only for files that are currently open in the editor.
30
- - ` workspace ` : Diagnostics are reported for all files in the workspace.
31
-
32
- ** Default value** : ` "openFilesOnly" `
20
+ === "VS Code"
21
+
22
+ ```json
23
+ {
24
+ "ty.disableLanguageServices": true
25
+ }
26
+ ```
27
+
28
+ === "Neovim"
29
+
30
+ ```lua
31
+ require('lspconfig').ty.setup({
32
+ settings = {
33
+ ty = {
34
+ disableLanguageServices = true,
35
+ },
36
+ },
37
+ })
38
+
39
+ -- For Neovim 0.11.0 and later:
40
+ vim.lsp.config('ty', {
41
+ settings = {
42
+ ty = {
43
+ disableLanguageServices = true,
44
+ },
45
+ },
46
+ })
47
+ ```
48
+
49
+ === "Zed"
50
+
51
+ ```json
52
+ {
53
+ "lsp": {
54
+ "ty": {
55
+ "settings": {
56
+ "ty": {
57
+ "disableLanguageServices": true
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ______________________________________________________________________
33
66
34
- ** Type ** : ` "workspace" | "openFilesOnly" `
67
+ ## ` python.ty.disableLanguageServices `
35
68
36
- ** Example usage ** :
69
+ !!! warning "Deprecated"
37
70
38
- ``` json
39
- {
40
- "ty.diagnosticMode" : " workspace"
41
- }
42
- ```
71
+ This option has been deprecated. Use [`ty.disableLanguageServices`](#disablelanguageservices) instead.
43
72
44
- ## ` logFile `
73
+ Whether to disable the language services that ty provides like code completion, hover, go to
74
+ definition, etc.
45
75
46
- Path to the file to which the language server writes its log messages. By default, ty writes log messages to stderr.
76
+ This is useful if you want to use ty exclusively for type checking in combination with another
77
+ language server for features like code completion, hover, go to definition, etc.
47
78
48
- ** Default value** : ` null `
79
+ ** Default value** : ` false `
49
80
50
- ** Type** : ` string `
81
+ ** Type** : ` boolean `
51
82
52
83
** Example usage** :
53
84
54
85
``` json
55
86
{
56
- "ty.logFile " : " ~/path/to/ty.log "
87
+ "python. ty.disableLanguageServices " : true
57
88
}
58
89
```
59
90
60
- ## ` logLevel `
61
-
62
- The log level to use for the language server.
63
-
64
- ** Default value** : ` "info" `
65
-
66
- ** Type** : ` "trace" | "debug" | "info" | "warn" | "error" `
67
-
68
- ** Example usage** :
91
+ ______________________________________________________________________
69
92
70
- ``` json
71
- {
72
- "ty.logLevel" : " debug"
73
- }
74
- ```
93
+ ## ` diagnosticMode `
75
94
76
- ## ` trace. server`
95
+ Determines the scope of the diagnostics reported by the language server.
77
96
78
- The detail level at which messages between the language server and the editor (client) are logged. Refer to the [ LSP
79
- specification] ( https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#traceValue )
80
- for more information.
97
+ - ` openFilesOnly ` : Diagnostics are reported only for files that are currently open in the editor.
98
+ - ` workspace ` : Diagnostics are reported for all files in the workspace.
81
99
82
- ** Default value** : ` "off " `
100
+ ** Default value** : ` "openFilesOnly " `
83
101
84
- ** Type** : ` "off " | "messages" | "verbose " `
102
+ ** Type** : ` "workspace " | "openFilesOnly " `
85
103
86
104
** Example usage** :
87
105
88
- ``` json
89
- {
90
- "ty.trace.server" : " messages"
91
- }
92
- ```
106
+ === "VS Code"
107
+
108
+ ```json
109
+ {
110
+ "ty.diagnosticMode": "workspace"
111
+ }
112
+ ```
113
+
114
+ === "Neovim"
115
+
116
+ ```lua
117
+ require('lspconfig').ty.setup({
118
+ settings = {
119
+ ty = {
120
+ diagnosticMode = 'workspace',
121
+ },
122
+ },
123
+ })
124
+
125
+ -- For Neovim 0.11.0 and later:
126
+ vim.lsp.config('ty', {
127
+ settings = {
128
+ ty = {
129
+ diagnosticMode = 'workspace',
130
+ },
131
+ },
132
+ })
133
+ ```
134
+
135
+ === "Zed"
136
+
137
+ ```json
138
+ {
139
+ "lsp": {
140
+ "ty": {
141
+ "settings": {
142
+ "ty": {
143
+ "diagnosticMode": "workspace"
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ ______________________________________________________________________
93
152
94
153
## VS Code specific
95
154
96
- The following settings are specific to ty's VS Code extension.
155
+ The following settings are specific to [ ty's VS Code extension] [ ty-vscode ] .
97
156
98
157
### ` importStrategy `
99
158
@@ -114,6 +173,8 @@ Strategy for loading the `ty` executable.
114
173
}
115
174
```
116
175
176
+ ______________________________________________________________________
177
+
117
178
### ` interpreter `
118
179
119
180
A list of paths to Python interpreters. Even though this is a list, only the first interpreter is
@@ -134,6 +195,8 @@ The interpreter path is used to find the `ty` executable when
134
195
}
135
196
```
136
197
198
+ ______________________________________________________________________
199
+
137
200
### ` path `
138
201
139
202
A list of path to ` ty ` executables.
@@ -152,3 +215,139 @@ The extension uses the first executable that exists. This setting takes preceden
152
215
"ty.path" : [" /home/user/.local/bin/ty" ]
153
216
}
154
217
```
218
+
219
+ ______________________________________________________________________
220
+
221
+ ### ` trace.server `
222
+
223
+ The detail level at which messages between the language server and the editor (client) are logged.
224
+
225
+ This setting is useful for debugging issues with the language server. Refer to the [ troubleshooting
226
+ guide] ( https://github.com/astral-sh/ty-vscode/blob/6cf16b4e87342a49f2bec1310a730cde8229e1d9/TROUBLESHOOTING.md )
227
+ in [ ty's VS Code extension] [ ty-vscode ] for more information.
228
+
229
+ ** Default value** : ` "off" `
230
+
231
+ ** Type** : ` "off" | "messages" | "verbose" `
232
+
233
+ ** Example usage** :
234
+
235
+ ``` json
236
+ {
237
+ "ty.trace.server" : " messages"
238
+ }
239
+ ```
240
+
241
+ ______________________________________________________________________
242
+
243
+ ## Initialization options
244
+
245
+ The following settings are required when ty is initialized in an editor. These settings are
246
+ static so changing them requires restarting the editor to take effect.
247
+
248
+ For VS Code users, these settings are defined in the ` ty.* ` namespace as usual, but for other
249
+ editors, they would need to be provided in a separate field of the configuration that corresponds to
250
+ the initialization options. Refer to the examples below for how to set these options in different
251
+ editors.
252
+
253
+ ### ` logFile `
254
+
255
+ Path to the file to which the language server writes its log messages. By default, ty writes log messages to stderr.
256
+
257
+ ** Default value** : ` null `
258
+
259
+ ** Type** : ` string `
260
+
261
+ ** Example usage** :
262
+
263
+ === "VS Code"
264
+
265
+ ```json
266
+ {
267
+ "ty.logFile": "/path/to/ty.log"
268
+ }
269
+ ```
270
+
271
+ === "Neovim"
272
+
273
+ ```lua
274
+ require('lspconfig').ty.setup({
275
+ init_options = {
276
+ logFile = '/path/to/ty.log',
277
+ },
278
+ })
279
+
280
+ -- For Neovim 0.11.0 and later:
281
+ vim.lsp.config('ty', {
282
+ init_options = {
283
+ logFile = '/path/to/ty.log',
284
+ },
285
+ })
286
+ ```
287
+
288
+ === "Zed"
289
+
290
+ ```json
291
+ {
292
+ "lsp": {
293
+ "ty": {
294
+ "initialization_options": {
295
+ "logFile": "/path/to/ty.log"
296
+ }
297
+ }
298
+ }
299
+ }
300
+ ```
301
+
302
+ ______________________________________________________________________
303
+
304
+ ### ` logLevel `
305
+
306
+ The log level to use for the language server.
307
+
308
+ ** Default value** : ` "info" `
309
+
310
+ ** Type** : ` "trace" | "debug" | "info" | "warn" | "error" `
311
+
312
+ ** Example usage** :
313
+
314
+ === "VS Code"
315
+
316
+ ```json
317
+ {
318
+ "ty.logLevel": "debug"
319
+ }
320
+ ```
321
+
322
+ === "Neovim"
323
+
324
+ ```lua
325
+ require('lspconfig').ty.setup({
326
+ init_options = {
327
+ logLevel = 'debug',
328
+ },
329
+ })
330
+
331
+ -- For Neovim 0.11.0 and later:
332
+ vim.lsp.config('ty', {
333
+ init_options = {
334
+ logLevel = 'debug',
335
+ },
336
+ })
337
+ ```
338
+
339
+ === "Zed"
340
+
341
+ ```json
342
+ {
343
+ "lsp": {
344
+ "ty": {
345
+ "initialization_options": {
346
+ "logLevel": "debug"
347
+ }
348
+ }
349
+ }
350
+ }
351
+ ```
352
+
353
+ [ ty-vscode ] : https://marketplace.visualstudio.com/items?itemName=astral-sh.ty
0 commit comments