Text edits with the same start position are applied in reverse #11174
Labels
A-language-server
Area: Language server client
C-bug
Category: This is a bug
E-easy
Call for participation: Experience needed to fix: Easy / not much
E-has-instructions
Call for participation: Has instructions for fixing the issue and opening a PR
Summary
Text edits returned from the LSP that have the same start position are being applied in reverse.
According to the spec, text edits with the same start position should be applied in the order received.
Recently, the language server client included with Neovim has fixed this bug (neovim/neovim#29202)
Accordingly, using some servers (e.g. efm-langserver) with the client included with Neovim, the formatted lines of the result may be reversed.
So I tried to ask the server to fix it (mattn/efm-langserver#281), but the fix causes problems with other (non-specified) clients such as Helix.
Therefore, I would like you to implement a fix in Helix that follows the spec, as well as Neovim.
Reproduction Steps
$ export PATH="$(go env GOPATH)/bin:$PATH"
helix/languages.toml
$ hx foo.json
:format
Expected result:
But actual result:
If you install the efm-langserver without the patch, this doesn't happen.
Helix log
~/.cache/helix/helix.log
Platform
Linux
Terminal Emulator
WezTerm
Installation Method
releases page
Helix Version
helix 24.7 (079f544)
The text was updated successfully, but these errors were encountered: