Skip to content

Debugging tern.js with Nodeclipse

paulvi edited this page Dec 8, 2014 · 10 revisions

When you develop a JavaScript tern plugin you can debug it with breakpoints by using :

This section explains step by step how to debug with breakpoints RequireJS tern plugin with Nodeclipse

Note that the procedure is a litlle complex and not perfect and should be improved.

Installation

  • Install Nodeclipse
  • Install tern.java >= 0.4.0

Create sample project

  • Create a simple project
  • Convert the project to tern
  • Select Closure Library in the property page Tern -> Modules

Configure Remote Access

In the global preferences Tern -> Node.js, select Remote access with 1234 port.

Create tern Nodeclipse project

  • Create a Nodeclipse project that you can name with tern
  • Go to your eclipse/plugins folder and copy/paste the content of the node_modules of tern.core plugin
  • Rename tern\bin\tern to tern\bin\tern.js

Start tern in debug mode

  • Select tern\bin\tern.js and open the contextual menu with Debug As -> Node Application
  • Stop the debug.
  • Edit the launch which has be created :
  • Program arguments: --port 1234
  • Working Directory: ${workspace_loc:/test-requirejs}
  • Restart the debug

Go go go for the debug

  • Open tern\plugin\requirejs.js
  • set a breakpoint after infer.registerFunction("requireJS"
  • go the the sample project and type require and Ctrl+Space

It calls tern.js server and breakpoint is executed.

Clone this wiki locally