Git Product home page Git Product logo

tern.java's Introduction

โš ๏ธ Tern.java is now OUTDATED, it's recommended to use Eclipse Wild Web Developer instead

tern.java

Build Status Eclipse install

tern.js is a stand-alone code-analysis engine for JavaScript written in Javascript.

tern.java provides the capability to use tern.js with Java context. It provides several tern server implementation :

As Tern is very CPU and memory intensive, the implementation with Rhino is very slow when JavaScript document is big. So it's better to use node.js or javv8. Nashorn is a little slow compare to J2V8 or node.js

Core Features

Once that Tern Server is created with Java using core module, you can use it in any Java context (Eclipse, Netbeans, etc). tern.java provides the capability to use Tern Server with SWT :

  • contentassist which uses tern.java. If you start the SWT TernEditor demo, you will see contentassist available for JavaScript :

SWT Tern Editor

Eclipse IDE

On top of core module Tern.java provides an Eclipse IDE integration with Tern. For more information please read Tern Eclipse IDE.

To install Tern IDE, please read Installation - Update site section.

Plugins based on Tern IDE

Tern Tooling

There are also advanced tools for creators of tern plugins, see wiki pages Tern-Toolings, Tern-Console and Debugging.

Who is using tern.java?

See http://tools.jboss.org/blog/2014-06-19-beta2-for-luna.html#better-javascript for more informations.

  • Liferay IDE 2.2 for :
  • YUI, AUI support
  • Liferay support

See http://www.liferay.com/fr/web/gregory.amerson/blog/-/blogs/liferay-ide-2-2-release for more informations.

  • Nodeclipse for :

  • node, express, support

  • mongodb native, mongoose support

  • MyEclipse and [Webclipse (JSjet)] (https://www.genuitec.com/products/webclipse/) :

  • content assist

  • jump to definition

  • element documentation

  • tern.java is used as a base for:

    • refactoring
    • occurences highlighting
    • outline
    • type hierarchy
    • call hierarchy

See https://www.genuitec.com/tag/tern/ for more informations.

Build

See cloudbees job: https://opensagres.ci.cloudbees.com/job/tern.java/

tern.java's People

Contributors

angelozerr avatar ayman-abdelghany avatar demonfiddler avatar dgolovin avatar fbricon avatar gamerson avatar grdryn avatar mickaelistria avatar nickboldt avatar orlandoibm avatar pascalleclercq avatar phasereditor2d avatar piotrtomiak avatar sosahvictor avatar vrubezhny avatar zielu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tern.java's Issues

Manage dependency between tern defs/plugin

Some tern defs, plugisn depends on other tern defs. For instance 'jquery' tern def depends on Element structure declared in the 'browser' tern def.

It should be cool

  • to see this dependencies in the UI tree of tern plugins/defs.
  • give the capability to check automaticly tern def depdencies. Ex : you select "jquery" and you click on a button "Add dependencies" and "browser" is checked.

To know those dependencies, I have created ternjs/tern#330 otherwise I will do that in tern.java

Problem when TernServer instance is used in several threads

There is a problem when TernServer instance is used in several threads, because the
TernFileManager which update a list of files which are indexed is not synchronized (so the files could be indexed several times). TernFileManager should be improved :

  • indexedFiles access should be synchronized.
  • indexedFiles should be updated on the end of the tern request (if the request was done with none error).

Load scripts files in JS Editor from defined script path

When completion is done in JS Editor, some JS files must be parsed by tern (if those files are not already parsed). Today the only JS file which is parsed is teh JS coming from the editor. The compeltion in JS Editor should use the script paths defined in the preferences to load it.

check out on Windows - Filename too long

D:\workspaces\Enide-Studio-2014-011\tern.java-CRLF>git checkout -f HEAD
fatal: cannot create directory at 'eclipse/tern.eclipse.ide.server.nodejs.embed.linux.gtk.x86/nodejs/node-v0.10.22-linux-x86/lib/node_modules/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream': Filename too long

FYI, on Windows 7 32bit

There were no such problem before on Windows.

NullPointerException on Tern Node.js Preference page

When selecting a custom Node.js install (Node.js install: -- Choose your node.js install --) the following NullPointerException occurs:

!ENTRY org.eclipse.ui 4 0 2014-03-22 00:42:39.731
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
at tern.eclipse.ide.server.nodejs.internal.ui.preferences.TernNodejsPreferencesPage$1.fireValueChanged(TernNodejsPreferencesPage.java:88)
at org.eclipse.jface.preference.ComboFieldEditor$1.widgetSelected(ComboFieldEditor.java:180)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4425)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3773)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3393)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:832)
at org.eclipse.jface.window.Window.open(Window.java:808)
at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:215)
at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:65)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:519)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4425)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3773)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3393)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1119)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1003)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:147)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:630)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:574)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:125)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:133)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:103)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:378)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:232)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1462)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

Use fragments for platform-specific artifacts

Similarly to what SWT does, it would be better to use fragments for platform-specific artifacts. Then all those fragments could be part of the same feature, and installing the feature would select the right fragment to install.
This would avoid having platform-specific features and would make consumption easier.

Usage Instructions

It would be great if there were instructions in the readme concerning how to set up tern with Eclipse.

"Add Folder" as script path

Today it exists "Add Page" in the Tern->Script path property to add an HTML/JSP file which contains script elements.

But loading script can be done with sevreal mean (requireJS, head.js, etc). I think it's hard to provide all frameworks which loads JS. I think a generci mean is to manage a "folder" script path. A new button "Add Folder"could select a folder which contains JS files to load.

Tern runtime plugin

Today tern.js (defs, lib, plugins) are hosted in the node.js tern server implementation tern.java\core\tern.server.nodejs\node_modules.

Other tren server implementation (like Rhino) doesn't use this tern.js files. It should be better to provide a new plugin "Tern runtime plugin" like tern.eclipse.ide.runtime which hosts tern.js files. With this plugin, every tern server implementation can share the same tern.js files.

An idea is to provide to the capability to override tern.js files by customizing with Runtime Add in the Preferences, a folder which contains custom tern.js files.

Merge tern def/plugin selection in the same treeview

Today, we have 2 treeviews for tern definition and tern plugin. I think it should be better to merge those treeview in one treeview.

What do you think about that?

Which names could we use? Tern Plugins? Tern facets? Tern features? Tern capabilities?

Improve apply of completion for function

After apply of completion function, it shoud be good to :

  • select the first parameter of the function
  • set the cursor inside the function
  • use tab to select next parameter of the function.

Improve starts of node.js server

When tern is started with node.js starts, it waits 1 seconds (can be configurated in settings) and try to get the port of the started of node.js to know the URL of the server.

With big Tern plugin (like AUI, YUI), 1 sec is not enough. To fix that, we can configure settings to 2 sec, but I think we should add new settings (number of times that it must retry to get the port) to avoid waiting 2 sec each time.

Help to develop custom tern defs/plugin

Today tern.java provides several tern defs/plugin (official (jquery, browser, ecma5, etc) and not official (liferay, aui/yui, grunt, cordova). But it's possible to develop your own tern def/plugin. This issue is about improving tern.java to support custom tern defs/plugin, but too to help and explain how to develop custom tern defs/plugin.

Tern IDE

Tern IDE must be improved with thoses issues :

  • develop tern plugin runtime : #30
  • add custom tern defs #19
  • add custom tern plugin #20

Tern defs

Tern defs is a JSON type definition which describes the JS object structures. See for instance https://github.com/marijnh/tern/blob/master/defs/browser.json

Tern IDE could provide a wizard which initialize tern def (but it's not very important).
Done -> https://github.com/angelozerr/tern.java/wiki/Tern-Toolings#json-type-definitions

Tern plugin

Tern plugin uses tern def and gives the capability to add some behaviour on some functions (like inject some value).

Tern IDE should provide a wizard which create tern plugin (more interesting than tern def wizard).
Done -> https://github.com/angelozerr/tern.java/wiki/Tern-Toolings#server-plugins

How to develop tern def/plugin?

With WebBrowser

In my case I'm developping tern def/plugin with Chrome Web Browser to debug tern plugin (I use CodeMirror addon => https://github.com/angelozerr/tern.java/tree/master/core/tern.core.tests/CodeMirror/codemirror-javascript/demo)

The issue #41 can be useful to generate HTML page with CodeMirror/ACE and tern.js with customtern defs/plugins.

With Eclipse IDE

Tern IDE provides tern console (active tern console in the tern project preferences). Select your tern def and after try it with JS editor. If you change your tern def file, stop the server with "Stop" button of the console.

@paulvi : do you think it's possible to launch tern server with node.js in debug mode with nodeclipse? If it's possible we could debug tern plugin with Eclipse IDE.

Use libraries from Orbit?

I see that some libraries (Rhino & json-simple) are copied in the repository. Are they modified compared to the official releases of these libraries? Would it be possible to consume directly the one shipped by Eclipse Orbit ?
If you don't see any issue with using Orbit bundles and OSGi reference in MANIFEST (instead of lib inclusion), I could provide a pull request.

cc @dgolovin.as related to https://issues.jboss.org/browse/JBIDE-17160

Wizard to generate HTML page with Tern & CodeMirror/ACE

Provide a wizard to generate HTML page with Tern & CodeMirror/ACE/Orion.

  • first page shows list of tern defs+plugin to check.
  • second page shows checkbox CodeMirror or ACE to choose the editor.

Finish button generate a folder which contains :

  • scripts folder :
    • Tern JS files
    • CodeMirror or ACE JS files
  • HTML page which contains CodeMirror/ACE JS editor and initialize tern server with checked tern defs/plugin.

This wizard will be very useful to generate demo or gives a good start to integrate CodeMirror/ACE editor with tern in a Web Application.

Note : for ACE+tern, see https://github.com/angelozerr/tern.ace

Limitation of tern, sponsoring tern?

This issue is about tern limitation that I find and I create this issues if some company (JBoss, Liferay?) wishes to sponsor tern.js to pay @marijnh for developping missing features in tern :

  • tern lint : in other words use tern/acorn to validate JS files. I have started to develop this tern plugin. See #37
  • completion for JSON object litteral : in other words provides completion for JSON object. See angelozerr/tern.yuidoc#7 and ternjs/tern#311
  • completion inside string like document.getElementById(' to retrieve list of HTML ids, require(' to retrieve list of node modules, YUI().use(' to retrieve list of modules . See ternjs/tern#318 and angelozerr/tern.yuidoc#2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.