Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323529 - Investigate a Rhino builder
Summary: Investigate a Rhino builder
Status: ASSIGNED
Alias: None
Product: JSDT
Classification: WebTools
Component: Debug (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: Future   Edit
Assignee: Michael Rennie CLA
QA Contact: Simon Kaegi CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-24 14:00 EDT by Michael Rennie CLA
Modified: 2011-09-15 14:05 EDT (History)
2 users (show)

See Also:


Attachments
fix (55.69 KB, patch)
2010-11-16 10:23 EST, Michael Rennie CLA
no flags Details | Diff
updated builder (51.95 KB, patch)
2010-11-19 10:53 EST, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2010-08-24 14:00:10 EDT
We should investigate the viability of providing a Rhino builder for JavaScript - something like what the JSDT validator does, except powered by Rhino.
Comment 1 Michael Rennie CLA 2010-11-16 10:23:09 EST
Created attachment 183230 [details]
fix

The patch provides a Rhino incremental builder, that creates Rhino JavaScript
Problems for any errors it finds.

The build can be set up on any kind of project using the standard Configure >
popup menu and selecting Enable Rhino Builder (or Disable Rhino Builder if you
want to remove it).

The placement of error markers is a bit off sometimes due to the reported
problem offsets from the Rhino parser. I opened
https://bugzilla.mozilla.org/show_bug.cgi?id=612346 to track the issue.
Comment 2 Michael Rennie CLA 2010-11-17 10:20:08 EST
After using this for a day or so installed in my host, I find it useful that I get incremental errors if I forget a semi-colon or this like, but far more annoying because the errors reported from Rhino are often cryptic (and reported in the wrong spot).

Take for example this error:

Description	Resource	Path	Location	Type
missing name after . operator	activation.js	/firebug1.7/content/firebug	line 63	Rhino JavaScript Problem

on the snippet: 

// Import annotation service.
 Components.utils.import(<error marker here>"resource://firebug/firebug-annotations.js");

or this one:

Description	Resource	Path	Location	Type
missing ) after argument list	debugger.js	/firebug1.7/content/firebug	line 2507	Rhino JavaScript Problem

on the snippet:

filterMenuUpdate: <error marker here>function()
{

I think to make this truly useful we would have to beef up the messages that are reported to give more information about what is being reported and why.
Comment 3 Michael Rennie CLA 2010-11-19 10:53:30 EST
Created attachment 183474 [details]
updated builder

Updated builder with progress + better performance, still does not handle the cryptic messages though
Comment 4 Nitin Dahyabhai CLA 2010-11-19 11:38:03 EST
So the output from Rhino completely uncontrollable?
Comment 5 Michael Rennie CLA 2010-11-19 14:35:04 EST
(In reply to comment #4)
> So the output from Rhino completely uncontrollable?

It depends what you mean by controllable. If you mean can I interrupt the parser in some way at any given point, than yes it seems to be uncontrollable. 

Otherwise you do get a fair amount of information during the parse like:
1. the kind of problem (error / warning) 
2. the string line of source the problem occurs on, 
3. the offset into that line that the problem is reported against
4. the human readable error message for the problem

There could be more, and there could also be additional ways to hook the parser, this builder was a quick experiment to see if it could be done (not necessarily the best way to do it).