+
Skip to content

Format action applied twice when using in tandem with ts-ls #11

@eder-pki

Description

@eder-pki

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
  • With 2 extra spaces: const···one·=·1
    • 4 characters (in brackets) get deleted: const·[··on]e·=·1

Possible root of the problem

It seems that the biome client is registered with the property :add-on t. I tried changing this value to nil and it fixed my problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载