Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 489893

Summary: [tern] Add tests and fix indexes for indexed library plug-ins
Product: [ECD] Orion Reporter: Curtis Windatt <curtis.windatt.public>
Component: JS ToolsAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Michael_Rennie, steve_northover
Version: 12.0   
Target Milestone: 12.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Curtis Windatt CLA 2016-03-17 17:40:56 EDT
The templates supplied by Tern plug-ins for indexed libraries (express, amqp, etc.) were broken at some point (Bug 489873).
With cross file linting, we have found that the express index was not accurate and had to be created. (Bug 489589).

This suggests that we review and improve on our indexed library plugins.

1) Add tests for both the templates and the indexed types.
2) Fix the templates to work with the improved prefix handling.
3) If the type index does not have doc or appears incorrect, we should recreate the index from the source.
4) If cross file linting sees any issues in an example use case of the library, we should manually modify the index to work.
Comment 1 Curtis Windatt CLA 2016-03-17 17:45:00 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=e673f21919074ec23608f1f2bb8944531a8b1e40
Test cases for the already corrected Tern index.
Comment 2 Curtis Windatt CLA 2016-03-21 14:15:41 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=ae258f5290671742bab04b5b49334724d905d1cf
Adds all the template tests
Recreated AMQP index
Add tests for AMQP
Comment 3 Curtis Windatt CLA 2016-03-21 17:35:46 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=b5788b18a7f61f27aae3b3dbda3b148590c404a0
Fixed the rest in master
I only had to recreate the index for Express and AMQP.
I tried recreating the index for mysql but the results caused errors in def.
I had to manually add an on() function for Redis, similar to Express.
There is a markdown file in with the plug-ins expalining all the steps I took.
Comment 4 Curtis Windatt CLA 2016-03-21 17:38:14 EDT
Steve, there is now test coverage for at least the basic scenarios for our indexed libraries.  I generally used whatever code snippet they had on their github readme.

If you run into any more 'foo is undefined' when working with a library, open a bug and I can look into whether the index needs to be updated.
Comment 5 Steve Northover CLA 2016-03-21 17:49:19 EDT
I will try this tomorrow.  Right now, I am not getting express content assist but it could be because I am not running the latest.
Comment 6 Curtis Windatt CLA 2016-03-21 18:09:34 EDT
(In reply to Steve Northover from comment #5)
> I will try this tomorrow.  Right now, I am not getting express content
> assist but it could be because I am not running the latest.

Also check that you don't have a .tern-project file with a plug-ins entry.
Comment 7 Steve Northover CLA 2016-03-21 18:36:16 EDT
Should it work now on orion.eclipse.org?
Comment 8 Steve Northover CLA 2016-03-21 18:36:42 EDT
{
	"libs": ["ecma5"],
	"ecmaVersion": 5,
	"loadEagerly": [
		"public/index.html"
	]
}
Comment 9 Steve Northover CLA 2016-03-21 18:37:42 EDT
> I am not getting express content assist

Can you recreate this or do I need to enter a bug?  Here is the file:

/*eslint-env node, express */

// Initialize Express
var express = require('express');
var app = express();
 
// Set up a simple static server for the public directory
app.use('/', express.static(__dirname + "/public"));

// Get IP of the Cloud Foundry DEA (Droplet Execution Agent) that hosts this application
var host = process.env.VCAP_APP_HOST || 'localhost';

// Get the port on the DEA for communication with the application
var port = process.env.VCAP_APP_PORT || 3000;

// Serve the application
//TODO - print when the server is ready
app.listen(port, host);
Comment 10 Curtis Windatt CLA 2016-03-22 09:40:47 EDT
(In reply to Steve Northover from comment #9)
> > I am not getting express content assist
> 
> Can you recreate this or do I need to enter a bug?  Here is the file:

The problem is Bug 490182.