-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
[Sublime Text] Rename acts as a simple search-and-replace in some circumstances #661
Comments
I’m unable to reproduce this in VSCode. :/ |
Did you raise this with the sublime client team? |
I didn’t bother raising the issue on the LSP-elm plugin because it looks like a simple wrapper around the language server, but maybe I should, and maybe also on the general Sublime LSP plugin if that’s what you mean. |
Do you think it’s more likely to come from the LSP plugin or the LSP-elm plugin? (if you have any idea about that!) |
From your wording it did sound, like it would be the general plugin. |
After enabling the debug logs, I was able to see that the language server is returning 4 edits instead of 3, so it does tell the client to change "myString" inside that literal string on the last line. Here is the relevant log output, please tell me if I can provide additional relevant information. (Line numbers don’t match exactly because I removed some empty lines in the source file for this bug report)
|
I’m not encountering this in my day-to-day use, but I tried it again just to see if it was still happening. So it’s pretty consistent, when I initially open the project it’s working as expected, then I remove the space in the string between "including" and "myString", I save the file, and then I put the space back, and I save again. Now the Rename action changes the string. And I can even find the Sorry I know this bug is annoying and hard to test especially since it’s not happening in VSCode. As I said I’m not encountering this in my day-to-day use, but I’d be happy to help in any way if I can. Please tell me if there’s any more information I can gather (like logging the contents of the file that were sent to the language server, logging the parsed AST…). Here’s the demonstration of the bug happening. When the log panel closes, it means I’m saving the file (after removing the space, and after putting the space back; it looks like saving twice matters in order to reproduce the bug…) |
Using the language server with Sublime Text 4, the "LSP: Rename" action is acting as a simple search-and-replace.
Expected Behavior
Consider the following file:
Executing the Rename action on
myString
should perform exactly three replacements: themyString
type annotation,myString
definition, and the reference to it inmain
. It should in no circumstances change the contents of a string.Current Behavior
The Rename action performs the three replacements mentioned above, as well as a fourth one, replacing the word
myString
in the string defined assomethingElse
.Possible Solution
It seems like the Rename action performs a search-and-replace looking for the function name in the file(s) as a whole word. If I remove the spaces in
somethingElse
, everything works as expected.Steps to Reproduce (for bugs)
Main.elm
myString
function definitionmyRenamedString
somethingElse
string between "including" and "myString", and putting it back again. It behaves like this when I reopen the project: 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.Context
I experienced a bug because of this, as I had a URL string like
"?action=doSearch"
that was being changed when renaming a function calleddoSearch
.Your Environment
The text was updated successfully, but these errors were encountered: