Skip to content

fix: async LSP bails on no result - #873

Open
liskin wants to merge 1 commit into
stevearc:masterfrom
liskin:fix-async-multiple-clients
Open

fix: async LSP bails on no result#873
liskin wants to merge 1 commit into
stevearc:masterfrom
liskin:fix-async-multiple-clients

Conversation

@liskin

@liskin liskin commented May 4, 2026

Copy link
Copy Markdown

There was an inconsistency between the sync and async version of lsp_format:

  • Sync version invokes all LSP clients even if they don't return a result, as long as they don't return an error.
  • Async version stops as soon as no result is returned.

An example of this happening is when both pylsp and ruff are enabled, and pylsp only being used for refactoring and mypy, with the isort and black plugins disabled. In that case, pylsp gets tried first, returns no result, and conform doesn't even try ruff. It's fine with format_on_save (provided the formatting is fast enough), but format_after_save is unusable.

This commit fixes it by making the async/sync behaviour consistent.

@github-actions
github-actions Bot requested a review from stevearc May 4, 2026 22:52
There was an inconsistency between the sync and async version of
lsp_format:

* Sync version invokes all LSP clients even if they don't return a
  result, as long as they don't return an error.
* Async version stops as soon as no result is returned.

An example of this happening is when both pylsp and ruff are enabled,
and pylsp only being used for refactoring and mypy, with the isort and
black plugins disabled. In that case, pylsp gets tried first, returns no
result, and conform doesn't even try ruff. It's fine with
`format_on_save` (provided the formatting is fast enough), but
`format_after_save` is unusable.

This commit fixes it by making the async/sync behaviour consistent.
@liskin
liskin force-pushed the fix-async-multiple-clients branch from 9b39a02 to 447e35e Compare June 11, 2026 22:33
@liskin

liskin commented Jun 11, 2026

Copy link
Copy Markdown
Author

I believe the test failures weren't my fault, but I rebased nevertheless. Hopefully it'll be green now :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant