-
-
Notifications
You must be signed in to change notification settings - Fork 926
Open
Labels
Description
Thank you for the bug report
- I am using the latest version of
lsp-mode
related packages. - I checked FAQ and Troubleshooting sections
- You may also try reproduce the issue using clean environment using the following command:
M-x lsp-start-plain
Bug description
When using lsp-biome alongside ts-ls while editing a js file the lsp-format-buffer
applies the same changes twice which in some cases does unexpected things.
When executing either of the servers on their own everything works ok.
Steps to reproduce
- Create a js file with the following content (there are two spaces between const and one):
const··one·=·1;
- Make sure both servers are started: ts-ls and biome
- Execute
lsp-format-buffer
- The buffer will be formatted like this:
const·ne·=·1
Expected behavior
The buffer should have been formatted removing only one of the 2 spaces:
const·one·=·1
What seems to be happening is that the change that would fix the issue is getting executed twice. In the above example we have one extra space that would be fixed by removing one character but two get removed
- So in this case (1 extra space):
const··one·=·1
- 2 characters (in brackets) get deleted:
const·[·o]ne·=·1
- 2 characters (in brackets) get deleted:
- With 2 extra spaces:
const···one·=·1
- 4 characters (in brackets) get deleted:
const·[··on]e·=·1
- 4 characters (in brackets) get deleted:
Which Language Server did you use?
- ts-ls
- biome
OS
Linux
Error callstack
Anything else?
To be able to reproduce this bug 2 servers have to be active for the buffer. In my case this was achieved by using the package lsp-biome which required:
- Installation of the js package @biomejs/biome
- Creation of a basic biome.json configuration file in the root of the project
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json"
}