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

Bug 372249

Summary: Integrate an esprima-based outliner
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: JS ToolsAssignee: Mark Macdonald <mamacdon>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: aclement, andrew.eisenberg, curtis.windatt.public, davidleonigit-eclipse, john.arthorne, Michael_Rennie, simon_kaegi
Version: 0.4Keywords: helpwanted
Target Milestone: 5.0 M1   
Hardware: PC   
OS: All   
Whiteboard:

Description Mark Macdonald CLA 2012-02-22 11:12:01 EST
Once we get approval to use the Esprima parsing library [1] in Orion, we should incorporate an Esprima-based outline view for JavaScript that shows your functions in a tree. This would replace the flat view (powered by JSLint) that ships with Orion 0.4. 

It would also serve as a good jumping-off point for figuring out how to power our various JS tools (outline, validation, etc) from a common AST rather than one-shot tools that each parse the input file separately.

Andy Clement's plugin [2] would be a good place to start. (I find its inclusion of local variables clutters the outline somewhat, but we can tweak it as desired.)

[1] http://www.esprima.org/
[2] http://aclement.github.com/esprima-outline/esprimaOutlinerPlugin.html
Comment 1 Mark Macdonald CLA 2012-04-26 11:51:38 EDT
The CQ for Esprima has been approved, so we can do this now.

In addition to the plugin I mentioned above, there's also 2 other JS outline providers that currently use uglify-js as their parsing library, but could be retrofitted to use esprima instead:

- 'Nonymous' https://github.com/johnjbarton/outliner/
- 'outliner' https://github.com/mamacdon/outliner

The 'outliner' shows a pretty straightforward tree of functions. The 'Nonymous' outliner packs in a lot more info, but displays things in using a rather esoteric syntax.
Comment 2 Andrew Clement CLA 2012-05-09 15:51:14 EDT
yes, the local vars in mine are clutter - it was a bit of a learning experiment.

The nonymous one is good - but I do feel we ought to agree on whether that kind of format for function names is acceptable to all.  Coming up with good names for anonymous function uses is tricky but seems important - and  I haven't seen any other approaches than the one suggested in the paper upon which nonymous was based.
Comment 3 Simon Kaegi CLA 2012-05-28 12:41:31 EDT
Hi Mark -- please target.
Comment 4 John Arthorne CLA 2012-05-28 13:20:16 EDT
This was really Andy and Andrew working on it. I believe it is waiting on CQ 6526 for Esprima 0.9.9, so I suspect this won't make it for 0.5.
Comment 5 Michael Rennie CLA 2013-11-22 13:05:26 EST
Closing this as a dupe of bug 422080, since we will be using esprima / estraverse to improve that outline

*** This bug has been marked as a duplicate of bug 422080 ***