Re: Continue Eclipse Freemarker DLTK?

Daniel Dekany <[email protected]> Thu, 25 Jul 2013 17:35:16 +0200
Newsgroups gmane.comp.web.freemarker.devel
Message-ID <[email protected]>
Thursday, July 25, 2013, 4:40:28 PM, Angelo zerr wrote:

> Hi Daniel,
>
> OK I understand why you don't want expose the AST API. Thank's for your information.
>
> The DLTK ASTNode is used for several features like folding,
> refactoring, search, codeassist.
>
> You can read info about ASTNode at
> http://wiki.eclipse.org/DLTK_Core_Architecture
> It's difficult for me to tell you now which info are required  to
> build a DLTK ASTNode.

Then, to start somewhere... I think, org.freemarker:tooling will give
you an abstract FTLVisitor class, which however will only have two
kind of visit-s for now: visit(ElementInfo) and visit(ExpressionInfo).
(That's so that the plugin or other tools won't assume that they know
all the directives and expression types.) (Note that the 3.0 API
didn't visit expressions at all, only elements.) And then I start
adding properties to these XxxInfo-s as the need arises. Like,
isFoldable(), isOutlineNode and getOutlineNodeLabel for starters. The
initial "accept" method of the tools API could have a Query object (a
JavaBean again) as parameter, in which you can specify what are you
interested in (like, folding and/or outline nodes and/or variables
used, etc). So as you move ahead, we will see if it's appropriate at
all. And of course I'm open for suggestions.

> I will try to switch to 2.3 and I will see what we need.
>
> My work about AST was very simply (I have just managed #assign in
> the AST to display the variable name of assign in the Outline View).
> But perhaps for Freemarker, the Outline View should display more
> info like JBoss IDE

JBoss IDE's outline is useless IMAO. It shows far too much. After all,
the goal of an outline view is to show you a summary that's good for
navigation (among others). Although I'm not entirely sure how the
outlook should look. It has to show #macro and #function, and that's
already useful, but what else?

> and your idea about freemaker-tool.jar is perhaps a good idea.

(I wonder what's the proper term is. "tooling" or "tools"? Like
"FreeMarker Tooling API" or "FreeMarker Tools API"... or even
"tool-helpers"...)

> I have not experimented a lot the capability of the DLTK ASTNode
> but at the end of the http://wiki.eclipse.org/DLTK_Core_Architecture
> it says "Use of the DLTK AST is not mandatory, but some DLTK
> features like folding may rely on it and it can greatly simplify implementation."
>
> For the completion (interpolation) I don't use the ASTNode but I
> think I should to use it (so I need a more complex AST).

For that you need the variable names used, in a hierarchy. Like, on
the top-level you have "user" and "department", but after "user." the
possibilities are different, like "user.name" etc. If DLTK can extract
such info from the AST, we might as well add that in ExpressionInfo.
Also there's the case where some of the data-model variables has a
known class (that's not a FreeMarker feature).

> So I must switch to 2.3, my first idea is to try to remove the use
> of DLTK ASTNode an dmanage other features like syntax errors and debug.
>
> Regards Angelo

-- 
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk