Allow user to use multiple formatters (#14846)
Fixes #4822 - [x] Release note - [ ] Surface formatting errors via a toast - [x] Doc updates - [x] Have "language-server" accept an optional name of the server. Release Notes: - `format` and `format_on_save` now accept an array of formatting actions to run. - `language_server` formatter option now accepts the name of a language server to use (e.g. `{"language_server": {"name: "ruff"}}`); when not specified, a primary language server is used. --------- Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
parent
53b711c2b4
commit
3d1bf09299
7 changed files with 565 additions and 130 deletions
|
@ -601,6 +601,21 @@ To override settings for a language, add an entry for that language server's nam
|
|||
}
|
||||
```
|
||||
|
||||
4. Or to use multiple formatters consecutively, use an array of formatters:
|
||||
```json
|
||||
{
|
||||
"formatter": [
|
||||
{"language_server": {"name": "rust-analyzer"}},
|
||||
{"external": {
|
||||
"command": "sed",
|
||||
"arguments": ["-e", "s/ *$//"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Here `rust-analyzer` will be used first to format the code, followed by a call of sed.
|
||||
If any of the formatters fails, the subsequent ones will still be executed.
|
||||
|
||||
## Code Actions On Format
|
||||
|
||||
- Description: The code actions to perform with the primary language server when formatting the buffer.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue