Templated javascript source code

Hello,
I have the following problem (sorry for my bad english) :
- our custom build system use NANT to deploy web resources (html, js, css)
- during the "build" process we need some "template solving" (with token replace) in the *.js files.
- the custom tags in the javascript source code are like @NAMESPACE.CUSTOM_TAG@

Now, i'd like to take advantage of the features of the IDE, like "code formatting, code analysis, etc...", but my custom TAGS make impossible for the parser to work correctly; it detects the TAGS as "errors" ... obviously :)

So, my question is : is there a way to tell WS something like "when you work on .js file IGNORE this patterns or regex" ? And, if not, is there other way to make my files working fine ?

Thanks!

3 comments

Hi there,

So, my question is : is there a way to tell WS something like "when you work on .js file IGNORE this patterns or regex" ? And, if not, is there other way to make my files working fine ?

IDE, in order to do it's job (like code formatting; syntax check etc), must understand full structure fo the file (in other words: file must be valid in IDE eyes). The only way to make such syntax valid is to code support for it (be it in IDE itself (part of original JavaScript support) or via 3rd party plugin written by somebody) and currently IDE does not support such custom templates.

My only suggestion: use proper but unique names instead of template variables (@NAMESPACE.CUSTOM_TAG@) -- in such case even simple search/replace should work fine when converting from template to final product.

0

Thanks Andriy,
it is logic, but, at this point, is there a way to "define a custom language" that inherits from Javascript and only add some basic custom rules ?

Thanks

0

Unfortunately no. It has to be coded via plugin. Otherwise you would not need a ticket for IcedCoffeeScript if it would be so easy to extend existing language. The same goes for "normal" templating engines (languages?) -- it's not about custom template delimiter, it's more than that, which currently can not be done via configuration-only approach.

0

Please sign in to leave a comment.