fix: async LSP bails on no result - #873
Open
liskin wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
fix-async-multiple-clients
branch
from
June 11, 2026 22:33
9b39a02 to
447e35e
Compare
Author
|
I believe the test failures weren't my fault, but I rebased nevertheless. Hopefully it'll be green now :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was an inconsistency between the sync and async version of lsp_format:
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), butformat_after_saveis unusable.This commit fixes it by making the async/sync behaviour consistent.