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

Kostas Michalopoulos badsectoracula at gmail.com
Fri May 26 18:29:00 CEST 2017


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.

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).

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. For example if i show the dialog looking for TGraphic it
will only show up after i have already used it at least once. So if i have
an empty database i get this:

1. Open the identifier db dialog (i have set it up as Alt+`)
2. Start typing TGraph
3. Nothing shows up
4. Press Ctrl+Space in a form code (e.g. Unit1 in the default empty project)
5. Start typing TGraph so that it shows in the completion dialog
6. Press esc to cancel the completion dialog
7. Open the identifier db dialog again
8. Start typing TGraph
9. Now TGraphic (and other stuff) show up

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.


On Fri, May 26, 2017 at 6:38 PM, Mattias Gaertner via Lazarus <
lazarus at lists.lazarus-ide.org> wrote:

> On Fri, 26 May 2017 18:24:12 +0300
> Kostas Michalopoulos via Lazarus <lazarus at lists.lazarus-ide.org> wrote:
>
> > > No. It stores all learned identifiers in a file:
> > >
> >
> > But then why does it behave as i mentioned? When i restart Lazarus it has
> > forgotten everything.
>
> What platform?
>
> What happens when you click on Tools / Options / Codetools / IDE
> Integration / Save dictionary now?
>
> Move the mouse over the button and wait for the hint to find out where
> it stores the file.
>
> Mattias
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus-ide.org
> http://lists.lazarus-ide.org/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170526/6c5f68b2/attachment-0001.html>


More information about the Lazarus mailing list