[BUG] Rename Symbol resulting in invalid python code.
Describe the bug "Rename Symbol" (Right click on variable name, or F2) is a great feature, but it does not rename properly in Python evaluations: it removes underscores that are necessary to have valid python variables.
To Reproduce Steps to reproduce the behavior:
- Right click on a variable which is also used in a inline python statement elsewhere.
- Click on "Rename Symbol".
- Add a space in the new variable name.
- The python code variable is not found because python does not support space in variable names.
If possible add some example source code like:
*** Variables ***
${MY VARIABLE} foo
*** Test Cases ***
A Test Case
Log ${MY VARIABLE}
IF len($MY_VARIABLE)>=3 No Operation
Expected behavior The spaces in the variable could be automatically converted to underscores in the resulting inline python code.
Screenshots/ Videos
BEFORE
AFTER
DESIRABLE
Desktop (please complete the following information): VS Code Version 1.87.2 RobotCode Version 0.78.4 OS: Windows Python Version 3.11.8 RobotFramework Version 7.0
Additional context As a side note, it might be useful to deny multiple space in these symbol renaming because it will result in RobotFramework considering it as multiple symbols rather than a single variable or keyword. It is then not possible to use rename symbol again to perform the rollback operation. Which could be fixed by a Ctrl+Z, except that the renaming is done on multiple files, while Ctrl+Z only works on the current file.
Sorry for the late answer, had some busy weeks...
Yes this is a bug and I will try to fix it.
At the moment I would say, dont use Spaces in Variable Name ;-)
About your additional context:
If you rename something that changes several files, Undo (Ctrl+Z) should work for all files changed before