Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting to choose specific language server for formatting #11390

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

luckydye
Copy link
Contributor

@luckydye luckydye commented May 4, 2024

Closes #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

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 4, 2024
@maxdeviant maxdeviant self-assigned this May 4, 2024
@maxdeviant
Copy link
Member

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 luckydye force-pushed the formatter-langauge-server branch 3 times, most recently from 85e5151 to 89abfce Compare May 16, 2024 11:32
@mikayla-maki
Copy link
Contributor

@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 :)

@luckydye
Copy link
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong primary language_server for formatting
3 participants