mattn / efm-langserver

General purpose Language Server
MIT License
1.32k stars 59 forks source link

Text edits which have the same start position are reversed #281

Open kyoh86 opened 2 weeks ago

kyoh86 commented 2 weeks ago

In LSP spec, an order of the text-edits which have the same start position should be applied in order of them. Neovim LSP client was applied them in reversed order, but it's fixed in https://github.com/neovim/neovim/issues/29202. So now, formatting some continuous lines with efm-langserver, text lines are reversed. Please see the issue https://github.com/neovim/neovim/issues/29392 for steps to reproduce and details.

kyoh86 commented 1 week ago

In the golang/tools, the ComputeEdits is being used only as testing util.... https://github.com/golang/tools/blob/d9c6af3f039a6193d1557d780752f223b3978173/internal/diff/myers/diff.go

kyoh86 commented 1 week ago

It is deprecated in the golang/tools. I think it would be better to re-implement using google/go-cmp or something similar.

kyoh86 commented 1 week ago

The reason for the deprecated status was not related to this project, so I think that we can continue to use the ComputeEdits as it is.

kyoh86 commented 1 week ago

https://github.com/mattn/efm-langserver/pull/282#issuecomment-2227157623

I had neglected to mention that this change would affect other clients as well. At a minimum I would check for the following clients

  • vim-lsp
  • coc.nvim
  • Eglot
  • Helix
  • VSCode

Since it will take time to verify all environments, we will withdraw the request and ask for another review after the investigation.

If anybody could help me for testing them, give me your help.

conao3 commented 1 week ago

I will try to check this issue using Eglot.

kyoh86 commented 1 week ago

:memo: I finished testing for vim-lsp, helix and coc.nvim.

conao3 commented 1 week ago

I checked Eglot. It worked the same way as vim-lsp.