|Rename fails if cursor is behind identifier [message #1838275]
||Sat, 20 February 2021 06:12
| Frank Benoit
Registered: July 2009
I have a grammar for variable declaration like this (stripped):
'var' Variable (',' Variable)* ";"
name ('=' Expression )?
var b = 1.0;
var a = 2.3, b;
Now a problem occurs during renaming:
If the cursor is directly behind the variable name (var a|;), then the IRenameContext targetElement is the VariableList, not the Variable. Hence in this case, the rename is not working.
I guess the selection is seen as the character after the cursor, and in that case this might be the semicolon or the comma.
There is the solution to customize the RenameContextFactory, detect there the VariableList and change the targetElement to the right Variable.
Is there a better way? Can this be done without the customized context factory?
Is there a way to make clear that the cursor position behind the variable name (identifier) belong to it?
[Updated on: Sat, 20 February 2021 06:36]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01707 seconds