Rename Assistant

Olivier JG olivier.jg at gmail.com
Mon Oct 18 03:10:20 UTC 2010


  @David Nolden?

I took a look at the assistant architecture a bit yesterday, to see the 
possibilities for a renaming assistant.
Here's how things look to me now:
1. User makes a change (either insert or remove)
2. Code Assistant makes a new assistant
3. Assistant takes a look at what happened (before the declarations are 
updated) and decides what to do
4. Parser finishes its business and updates the DUChain

The only thing that stops this from being a walk in the park is that the 
user is unlikely to want to perform a rename every time he adds/removes 
a character to his variable (although I must say, making that happen 
automatically could be awesome, though probably too prone to breakage to 
consider). In order to get past that the rename assistant would probably 
have to extend its lifetime beyond a single change, and so wouldn't be 
recreated on every change. It could then, with a bit of work, track the 
changes that happen by comparing the given range of change, and offer 
the rename accordingly.
Then comes the more sticky issue: the signature assistant gets to look 
at every change, but right after that, the DUChain does too. Once the 
first change is done and the second rolls around, you get a different 
declaration (one that has no uses, obviously), and the useful 
declaration is gone. In order to avoid having to study the DUChain too 
extensively, I thought I'd ask... Can the RenameAssistant save the 
original declaration and use it for the rename, or would it get 
deleted/broken/make-bad-things-happen?

Am I seeing this right? Any insight on this?

-Olivier JG




More information about the KDevelop-devel mailing list