Mattias Gaertner wrote:

> I wrote an example in codebrowser.pas:
> function TCodeBrowserView.GetCodeHelp

Thank you for this example. Now you effectively implemented almost all
the things I wanted to do.

My latest (not working) version before I read your answer was using
Tool.BuildSubTreeAndFindDeepestNodeAtPos() and
Tool.MoveCursorToProcName() and Tool.MoveCursorToPropName() and *almost*
worked (worked in some cases but not always), sometimes the node that it
returned was correct, sometimes it did not make any sense at all and
began and ended at some completely wrong positions and had a completely
wrong Desc. (btw: what is a "clean" position and what is the difference
between just the absolute position and the clean position? Is this
important or is there no difference at all? At one Point I tried a
method that looked like it was supposed to convert column and line to a
"cleanpos" but it returned a number three times as large as the entire
file size)

Please don't remove your comments in this example again, although they
might seem obvious to anybody who knows the codetools, they are very
helpful and explain things about the codetools that are not obvious from
looking at the code alone. I would have for example never found the
method CodeToolBoss.Explore() or known that I needed to call it (I have
seen some of the examples but I didn't notice this method call before,
probably because it is implicitely called by something else) and also I
don't know what exactly LazarusIDE.BeginCodeTools() does.

Because I felt that the reason for BuildSubTreeAndFindDeepestNodeAtPos()
sometimes but not always returning anything useful was that the tool
itself was not properly initialized, I was looking for something that
would tell the tool to properly initialize itself and parse the whole
file but I looked for a method of the codetool class and not a method of
the codetoolboss. I tried Tool.BuildTree() but it didn't seem to help.

The understanding of the codetools seems to be essential for doing any
non-trivial thing inside the IDE. We need a document that describes the
architecture of the codetools, the lifespan of such a tool, when and how
to create it or where to find an instance of an already initialized
tool, how to properly initialize it, what does happen internally when
initializing it, generally what is going on inside these tool objects,
what is needed for them to operate, what should be avoided, what can go
wrong when using them, what is the codetoolboss and what is its role in
this whole thing (I have now seen at least 3 or 4 ways of how and from
where to get such a codetool instance and they all look slightly
different), what steps are done by the boss and what steps are done by
the tool, How does the whole containment hierarchy of these objects that
are found "inside" (or belong to) other objects look like (maybe
visualize it with a diagram), etc.

Bernd

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to