docs: Update lsp.settings examples for yaml-language-server (#18081)

This commit is contained in:
Peter Tripp 2024-09-19 12:00:13 -04:00 committed by GitHub
parent e9f2e72ff0
commit 3fd690ade4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 108 additions and 19 deletions

View file

@ -575,8 +575,13 @@ Each option controls displaying of a particular toolbar element. If all elements
The following settings can be overridden for specific language servers:
- `initialization_options`
- `settings`
To override settings for a language, add an entry for that language server's name to the `lsp` value. Example:
To override configuration for a language server, add an entry for that language server's name to the `lsp` value.
Some options are passed via `initialization_options` to the language server. These are for options which must be specified at language server startup and when changed will require restarting the language server.
For example to pass the `check` option to `rust-analyzer`, use the following configuration:
```json
"lsp": {
@ -590,6 +595,20 @@ To override settings for a language, add an entry for that language server's nam
}
```
While other options may be changed at a runtime and should be placed under `settings`:
```json
"lsp": {
"yaml-language-server": {
"settings": {
"yaml": {
"keyOrdering": true // Enforces alphabetical ordering of keys in maps
}
}
}
}
```
## Format On Save
- Description: Whether or not to perform a buffer format before saving.