fix: fall back to next LS when formatting returns no edits#1433
Merged
sebthom merged 1 commit intoeclipse-lsp4e:mainfrom Dec 1, 2025
Merged
fix: fall back to next LS when formatting returns no edits#1433sebthom merged 1 commit intoeclipse-lsp4e:mainfrom
sebthom merged 1 commit intoeclipse-lsp4e:mainfrom
Conversation
rubenporras
approved these changes
Dec 1, 2025
Member
Author
|
@rubenporras we should make sure this fix gets part of the simrel. so before we merge any features we should create a fix release before end of this week and register it with simrel 2025-12. I can do the release if you want. https://github.com/eclipse-simrel/.github/blob/main/wiki/SimRel/2025-12.md |
Contributor
Contributor
|
@sebthom , I have merged eclipse-simrel/simrel.build#1163. I am not sure if this is enough, but if not, would you mind taking over if we need to submit to a different branch? |
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.
In WildWebDeveloper it is currently not possible to format .vue files because VUE and TS LS are both launched and the TS LS processes the format request first and returns an empty list of edits for .vue documents.
LSP4E’s
LSPFormattercurrently wraps the result of each server call intoVersionedEditsbefore passing it toLanguageServers.computeFirst(...), so computeFirst only sees a non-null object and cannot detect that the underlying edit list is empty. As a result, the TS LS “wins” the formatting request for .vue files and the Vue LS is never consulted.This PR changes
LSPFormatter.requestFormatting(...)to letcomputeFirstoperate on the rawList<? extends TextEdit>returned by each language server. Only aftercomputeFirsthas selected a non-empty edit list do we wrap it intoVersionedEdits. This allowscomputeFirst’s existing logic (which treatsnulland empty collections as “no result”) to work as intended: servers that advertise formatting but return no edits are skipped, and the next server with real edits (e.g. the Vue LS) is used instead.The behavior for single-server scenarios is unchanged (an empty edit list still means “no formatting applied”), while multi-server setups like WildWebDeveloper (TS + Vue) now correctly fall back to the Vue language server for .vue formatting.