Skip to content

Technical information

angelozerr edited this page Aug 28, 2014 · 8 revisions

#Technical information

Here some technical information about AngularJS Eclipse :

Angular HTML Editor

  • the HTML JFlex parser was modified (like JSP have done) to manage expression tokens {{}}. See AngularTokenizer.jflex. It allows to higlight {{}} expression (even in an attribute value).
  • a new content type "org.eclipse.angularjs.core.angularsource" was created and linked to this AngularTokenizer.jflex. This content type is applied to html file only if project has "org.eclipse.angularjs.core.AngularNature" nature.
  • the AngularJS HTML editor extends the WTP HTML Editor with WTP extensions point "org.eclipse.wst.sse.ui.editorConfiguration" for completion, hover, etc

AngularTokenizer is a good idea to highlight {{}} epression and manage completion, etc, but JSP editor doesn't benefit with Angular feature (see issue 2). We need to rewrite the JSP lexer to add {{}} expression token.

JS Features

  • to manage completion in HTML editor, tern which is is a stand-alone code-analysis engine for JavaScript , is used. tern gives several support (call plugins and defs) like AngularJS, require, ecma5, jquery...
  • As tern is written in Javacsript, AngularJS Eclipse uses tern.java.
  • tern.java gives you the capability to execute tern in Java context. It provides several implementation :
  • with Rhino, but it's bad idea to use it for big JavaScript file (slow and out of memory problem).
  • with node.js. this implementation starts tern with node.js process and call it with an HTTP client. It's the prefered mean to use Tern in Java.
  • to avoid installing node.js, tern.java provides for each OS, an embed node.js executable hosted in Eclipse plugins.

JSDT extension

tern.java provides an extension to add tern completion in their JavaScript Editor. See Tern Eclipse IDE