-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename acts as a simple search-and-replace in some circumstances #1912
Comments
Definitively looks like an elm server issue. Reproduced in VSCode also: Screen.Recording.2021-12-04.at.18.27.47.movThe LSP client just sends the position of the symbol to the server and receives back edits to apply so it's hard to get anything wrong here on the client side. |
I’m confused: you are saying you reproduced the issue under VS Code, while your screen recording clearly doesn’t show you did… I imagine the LSP client shouldn’t do anything "clever" and just apply edits received from the server. But on the language server side, I’m told it does work properly under VS Code so it must be a bug on the LSP plugin side. Can you tell me if there is a way to see what the language server is sending to the client? |
Ops. Sorry, I've got confused since I don't know the language. :) Actually I can't reproduce it in ST either. |
Enable |
Thanks! That’ll help me see what’s going on. Yeah it’s pretty weird, at least it’s consistent on my setup. |
So I reproduced the issue with the debug logs enabled, and it’s pretty clear that the language server is returning 4 edits instead of 3. I’ll close this and add that tag back :) EDIT: Oh I can’t add the tag actually.
|
Describe the bug
Note: This issue was reported in the Elm language server repo, before I tried it in VS Code where things are working as expected. So it looks like the problem is coming from another layer.
Using LSP-elm, is some circumstances (detailed below), it seems like
LSP: Rename
acts as a simple search-and-replace on whole words, changing the name of a function even inside a literal string.To Reproduce
Steps to reproduce the behavior:
elm init
(npm install -g elm
if needed)src/Main.elm
with the following:myString
function definitionLSP: Rename
command, specifying another name likemyRenamedString
somethingElse
string between "including" and "myString"LSP: Rename
command, specifying another name likemyRenamedString
The observed behaviour is that
"text including myString"
gets changed to"text including myRenamedString"
.When I’m just opening the project, I always have to do the additional steps described in 5. above. Even though the source is exactly the same, the bug does not happen before I touch this string and put it back as it was.
This behaviour seems somewhat erratic, but quite predictible when I open the project and execute these steps exactly, before doing anything else.
Expected behavior
LSP: Rename
should never change a literal string, at the very least.Environment:
The text was updated successfully, but these errors were encountered: