[Lazarus] CodeTools knowledge about a project - find a class

Mattias Gaertner nc-gaertnma at netcologne.de
Fri May 26 22:03:28 CEST 2017


On Fri, 26 May 2017 19:29:00 +0300
Kostas Michalopoulos via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

> Actually it works fine, after peppering the code with writelns to see the
> flow, i figured out what was the issue: there is a 10 minute interval (by
> default) between saves and the dictionary is only saved at the interval. I
> expected it to be saved when exiting the IDE regardless of when the last
> save was.

Saving takes some time when the file is big. I prefer a fast closing
IDE.
Maybe some option can be added.

 
> I added a Save; call right at the beginning of the OnIDEClose callback,
> like this
> 
> procedure TCodyUnitDictionary.OnIDEClose(Sender: TObject);
> begin
>   Save; // Save the dictionary before closing the IDE
>   fClosing:=true;
>   FreeAndNil(fTimer);
> end;
> 
> And it seems to behave as i expect it now. This way it wont lose any data
> when i restart the IDE (which i do often when working with custom controls).

Why that? Simply start a second instance for testing.

 
> TBH i'm not sure the approach of only scanning what you have loaded is
> enough since it still wont show anything from a unit i haven't already
> loaded before.

Yes, the empty database on first use is currently the show stopper.
It would be great, if it somehow (TM) knows at least the FPC and Lazarus
sources after install.


>[...]
> I think there needs to be a way for the dialog to also know whatever is or
> can be known with the currently loaded packages and units, not just
> whatever you have encountered so far. That information seems to already be
> available in the IDE in other places.

The IDE parses the sources on demand when information is needed. It is
not available per se.
Since parsing a project can take some seconds even on fast machines,
this is not done automatically.
Maybe the dictionary can start parsing the project on idle when it is
shown to update its database.

Mattias


More information about the Lazarus mailing list