vtst / ow

Various Eclipse plugins for web development
http://www.normalesup.org/~simonet/soft/
74 stars 29 forks source link

Soy: Improvement: Global declaration of library templates #177

Open bogdanb opened 10 years ago

bogdanb commented 10 years ago

In the same spirit of https://github.com/vtst/ow/issues/15 and for similar reasons, it would be very useful to have a way of telling the validator about templates defined outside the project.

As a concrete example, the Atlassian platform (used, among other things, for developping Jira plugins) makes available to all Soy files a large collection of templates for their UI library (called AUI). So my templates need to have references like {call aui.buttons.button data="$button" /} everywhere. Unfortunatelly these are all marked with errors in Eclipse (« Couldn't resolve reference to RegularTemplate 'aui.buttons.button'. »), and unless I’m missing something obvious there’s no way of getting rid of these other than copying the library in my project.

At the absolute minimum, that the Soy plugin should have a list where one can enter “template namespace patterns” (such as "aui.*", "aui.buttons." and "aui.buttons.button") that bypass the checks. (I.e., no error should be triggered by using one of them unless no ossible definition would make that usage correct.) This is a catch-all solution that should be easy and fast to implement and could be applied to almost any project that has this problem.

A more complicated solution would be to actually implement "external libraries". I see this as a config page similar to the Java libraries on in Eclipse. The user would declare any number of soy libraries (e.g., “Soy v.4” and “Soy v.5”), declare for each library their contents (either by linking them to an external source folder, or by entering template declarations (the “soydoc” part) in a textarea, and attach to each project the relevant soy libraries. But that might be complicated, and I think the first solution should be implemented ASAP because it should be quicker.