AdaCore / ada_language_server

Server implementing the Microsoft Language Protocol for Ada and SPARK
GNU General Public License v3.0
226 stars 54 forks source link

Renaming rarely works #1159

Open Joebeazelman opened 11 months ago

Joebeazelman commented 11 months ago

When I try to rename an identifier (the name of a function, procedure, variable, or type) using VS Code's Rename Symbol menu option, it complains that it can't rename it without providing a reason. On other occasions, it lets me go through the process of renaming it but nothing happens. There has only been a few times when it successfully renamed an identifier.

reznikmm commented 11 months ago

We have an improvement that shows more information of failed refactoring in the problem windows. This will be in the next release. We are interested in fixing renaming issue. Please send us any reproducer for this issue.

Joebeazelman commented 11 months ago

I would have to send you my project which is confidential.

johnperry-math commented 6 months ago

Please send us any reproducer for this issue.

In my experience, just about any Ada code at all will reproduce it. I used VS Code extensively during the 2023 Advent of Code, and the Rename feature didn't rename anything except the text I had clicked on. It wasn't able even to rename the label after an end keyword.

For example, the following steps reproduce the issue for me:

  1. alr init --bin test_rename
  2. cd test_rename
  3. codium .
  4. open src/test_rename.adb
  5. click on Test_Rename in line 1
  6. press f2
  7. rename Test_Rename to anything at all
  8. observe that line 4 still has end Test_Rename