Skip to content

Fix formatter: "auto" to skip language servers that can't format#50661

Merged
SomeoneToIgnore merged 2 commits intozed-industries:mainfrom
Dnreikronos:fix/auto-formatter-skip-non-formatting-servers
Mar 6, 2026
Merged

Fix formatter: "auto" to skip language servers that can't format#50661
SomeoneToIgnore merged 2 commits intozed-industries:mainfrom
Dnreikronos:fix/auto-formatter-skip-non-formatting-servers

Conversation

@Dnreikronos
Copy link
Copy Markdown
Contributor

Closes #50631

Before you mark this PR as ready for review, make sure that you have:

  • Added a solid test coverage and/or screenshots from doing manual testing
  • Done a self-review taking into account security and performance aspects
  • Aligned any UI changes with the UI checklist

Release Notes:

  • Fixed formatter: "auto" silently doing nothing when the first language server for a language doesn't support formatting (e.g., Dependi before Tombi for
    TOML).

When multiple language servers are registered for a language (e.g.,
Tombi
  and Dependi for TOML), the `Current` specifier blindly picked the
first
  server. If that server didn't support formatting, Zed silently did
  nothing instead of trying the next server.

  Add a `server_supports_formatting` helper that checks document
formatting
  and range formatting capabilities, and update the `Current` arm to use
  `find` instead of `first` so it selects a server that actually
advertises
  formatting support.

  Closes zed-industries#50631
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 4, 2026
@SomeoneToIgnore SomeoneToIgnore self-assigned this Mar 4, 2026
@Dnreikronos
Copy link
Copy Markdown
Contributor Author

Hi @SomeoneToIgnore, could you please rerun the run_tests / run_tests_windows pipeline? I don't have the permissions to trigger it myself, and it looks like it failed due to a timeout.

@Dnreikronos
Copy link
Copy Markdown
Contributor Author

Dnreikronos commented Mar 4, 2026

Seems like the Windows CI failure is unrelated to this PR's changes, It's a flaky timeout on editor::display_map::block_map::tests::test_random_blocks.

On main, this test already takes ~57-58s to pass with a 60s timeout limit, so it's right on the edge. With a slightly different random seed or runner load, it tips over. The PR branch just got unlucky across the retries.

All other 3347 tests pass, including on Linux and macOS.

What you think, @SomeoneToIgnore?

@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

main had gotten a timeout bump for this test, if you want to rebase and fix this.

Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you for this.

@SomeoneToIgnore SomeoneToIgnore enabled auto-merge (squash) March 6, 2026 09:23
@SomeoneToIgnore SomeoneToIgnore merged commit e3d0a35 into zed-industries:main Mar 6, 2026
58 of 62 checks passed
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.

"formatter": "auto" setting tries to use a language server that can't format

2 participants