rewrite
rewrite copied to clipboard
Enhance `VariableNameScopeVisitor` to track variable declarations in each scope
Track variable declarations in name scopes to enable similar renaming functionality as IntelliJ when there are namespace conflicts.
Currently, all names are included as a set of strings. So, using the set to detect conflicts may result in a new name that isn't necessary. I.E. name is detected as a conflict and name1 is generated to prevent a change in-app behavior.
I.E.
class SomeClass {
int name = 0;
void someMethod() {
int isRenamed = 1; // if isRenamed is changed to `name`, the reference to SomeClass.name may be changed to this.name.
name += 1;
}
}