zed
zed copied to clipboard
Add setting to choose specific language server for formatting
Closes https://github.com/zed-industries/zed/issues/11288
Inspired by VSCode, which also lets you choose a specific formatter like this. I successfully tried this out so may as well make a PR, totally open for discussion tho :).
Example settings:
{
"languages": {
"TypeScript": {
"formatter": {
"language_server_name": "biome"
}
},
}
}
Release Notes:
- N/A
I'd like to dig into/understand the underlying issue a bit more first.
Because the language_servers
setting should indicate the order in which language servers are used by the formatter (at least in the case when "formatter": "language_server",
is set).
@luckydye Could you expand on the use case this PR is serving, that isn't supported by the language_servers
setting as @maxdeviant mentioned? Once we have a clear idea of the use case you're seeing, we can move forward :)
@mikayla-maki sure thing.
First of all, it is just not clear at the moment, what language server is used to format using current "formatter" settings. When I format a file, there is no way of knowing what LS did the formatting.
The "language_servers" setting, also does not really show what language server is used for formatting, since the first one in the list may not have formatting support. It would be better imo, to explicitly tell zed what I want to use.
I'm sure there may be another way of solving this.
Going to close this until we have time to revisit.
We can continue discussion in https://github.com/zed-industries/zed/issues/11288.