johmsalas/text-case.nvim

[Multiple LS Clients] Rename adds extra characters when converting from camelCase to Constant Case

johmsalas opened this issue · 5 comments

LSP Rename adds extra characters

Reproduction Steps:

  • In the sample file, locate the cursor on the variable currentStep in the 5th line
  • gaN
  • The new name of the variable is CURRENT_STEPP, expected result is CURRENT_STEP

Also failing for Telescope LSP renaming
gan works fine.

Found out this happens when there are multiple attached LS clients and there is a change in the string length. For example when converting from fooBar to FOO_BAR, there is one extra character in the result

Setting up different language servers in the tests seems a lot though. Which language servers were running on your machine when you found this bug?

@peterfication this is an example of how to mock the LSP clients

Interestingly I didn't have to modify those tests 🤔 I'll have a look later

The difference between buf_request and buf_request_all is buf_request is called n times, where n is the amount of clients. On the other hand, buf_request_all is called only once, and all the results are passed in the callback. To mock the buf_request_all, we'd call the callback once and pass different sets of results according to the behavior we'd want to mock

Ah nice, makes sense 👍