Request for feedback on Signature Assistant

Olivier JG olivier.jg at gmail.com
Mon Nov 1 01:01:34 UTC 2010


On 10/31/2010 07:26 PM, David Nolden wrote:
> IMO the signature-assistant has one big conceptual problem: It always
> rewrites the whole function declaration line. Since in C++ there is
> many redundant ways how to write type-names, this will always cause
> problems.
>
> I think the right way to work would be remembering a sequence of
> edits, like for example:
> - Replace 1st argument with ...
> - Remove 3rd argument
> - Remove 4th argument
>
> And then replaying those changes on the other side. That way, we would
> overwrite only those parts that were actually changed, and we might
> also solve matching-problems in places where the argument-declaration
> names don't match properly etc.
>
> Greetings, David
This is precisely what I want to do, but the problem is accurate 
tracking, since I'm unable to get the ranges for the decls' types (and 
the const, but I'd settle for types).
What happens, then, is a race against the clock: If the user can manage 
to change (add/remove/rename/retype) more than one parameter before the 
parse finishes, all bets are off on tracking.

It seems the best I can do without the ability to get the return type 
range, is to simply not offer anything unless there's only one change 
per parse.
Of course, even if I could get the ranges and therefore not have to wait 
for the parse, the user could, ie, remove two arguments at once, and I 
wouldn't be able to safely offer anything, but that's an acceptable 
compromise, I think (and likely one I could account for with a little 
extra work).

As I see it, either I get those type ranges, or I have two options:
1. Cripple the sig assistant, but allow it to rename uses
2. Leave the sig assistant as is, unable to rename uses

I hope I'm overlooking something, because neither of those is 
particularly nice. We got bug 255706 within 12 hours of the rename 
assistant going in, because the signature assistant does look broken 
when it doesn't rename uses now.

How hard is it to add support to the DUChain for getting the type range 
from a declaration?

-Olivier JG




More information about the KDevelop-devel mailing list