mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-03 17:44:30 +00:00
docs: Improve language server configuration dotted/nested notation example (#19608)
This commit is contained in:
parent
1cb9f64917
commit
c292bdd2ca
1 changed files with 10 additions and 8 deletions
|
@ -151,28 +151,30 @@ Many language servers accept custom configuration options. You can set these in
|
||||||
|
|
||||||
This example configures the Rust Analyzer to use Clippy for additional linting when saving files.
|
This example configures the Rust Analyzer to use Clippy for additional linting when saving files.
|
||||||
|
|
||||||
|
#### Nested objects
|
||||||
|
|
||||||
When configuring language server options in Zed, it's important to use nested objects rather than dot-delimited strings. This is particularly relevant when working with more complex configurations. Let's look at a real-world example using the TypeScript language server:
|
When configuring language server options in Zed, it's important to use nested objects rather than dot-delimited strings. This is particularly relevant when working with more complex configurations. Let's look at a real-world example using the TypeScript language server:
|
||||||
|
|
||||||
Suppose you want to configure the following settings for TypeScript:
|
Suppose you want to configure the following settings for TypeScript:
|
||||||
|
|
||||||
- Enable strict null checks
|
- Enable strict null checks
|
||||||
- Set the target ECMAScript version to ES2020
|
- Set the target ECMAScript version to ES2020
|
||||||
- Configure import organization preferences
|
|
||||||
|
|
||||||
Here's how you would structure these settings in Zed's `settings.json`:
|
Here's how you would structure these settings in Zed's `settings.json`:
|
||||||
|
|
||||||
Here's how you might incorrectly attempt to set these options using dot notation:
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"lsp": {
|
"lsp": {
|
||||||
"typescript-language-server": {
|
"typescript-language-server": {
|
||||||
"initialization_options": {
|
"initialization_options": {
|
||||||
// This is not supported:
|
// These are not supported (VSCode dotted style):
|
||||||
// "preferences.strictNullChecks": true,
|
// "preferences.strictNullChecks": true,
|
||||||
// You express it like this:
|
// "preferences.target": "ES2020"
|
||||||
|
//
|
||||||
|
// These is correct (nested notation):
|
||||||
"preferences": {
|
"preferences": {
|
||||||
"strictNullChecks": true
|
"strictNullChecks": true,
|
||||||
}
|
"target": "ES2020"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue