[Lazarus] ctrl-c code completion

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Nov 8 15:45:54 CET 2016


On Tue, 8 Nov 2016 13:49:16 +0000
Graeme Geldenhuys via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

> On 2016-11-08 13:14, Mattias Gaertner via Lazarus wrote:
> > In this case codetools don't have enough information. Because it does
> > not know the former connection.  
> 
> By why does it work if I do them one at a time. eg: Change the first
> interface declaration and do code completion. Change the second
> interface declaration and do code completion. That works.

Because this case is unambiguous. There is only one possible mapping.

 
> But doing them at the same time it doesn't.

Yes, with two you have two possible mappings. Three has six and so
forth. Basic math: n!

So, as Ondrej wrote:
Just do changes one by one and you are good to go.

>[...]
> So why would CodeTools not know the connection when both interface
> declarations are updated at the same time?  I don't know how CodeTools
> works, but I would imagine it has some memory lookup (line numbers)
> where interface declaration xyz has an implementation at line 123. So
> when the declaration xyz changes (by the developer), go to line 123 and
> change it there too?

Codetools only sees the sources when the IDE invokes it (e.g. code
completion). It has no idea what happens since last time in the IDE
and it does not store old states, so it can't compare versions.

Theoretically something similar to synedits Syncro-Edit could be
implemented for procedure declaration/implementation.
Or even better: something similar to rename-identifier, but for
procedures: rename, remove parameter, move parameter, insert parameter,
and all references are updated too. I started that, but it needs much
work.

Mattias


More information about the Lazarus mailing list