vmware-archive / scripted

The Scripted code editor
Eclipse Public License 1.0
1.56k stars 166 forks source link

Open outline view escapes to defaul browser action when hitting esprima error #253

Open kdvolder opened 11 years ago

kdvolder commented 11 years ago

I have outline view bound to CTRL-O which is also the 'Open File' action in the browser itself.

This all works fine if the file in the editor has no parse errors.

However insert some garbage code (e.g I add this on line 67 of 'template-provider.js'):

    broken(#, * (}]

Then when I press CTRL-O to open the outline view... the browsers 'Open file' dialog pops open. If I close that one, then underneath I also see the Scripted 'outline' view but it has no contents.

In the error log I get these info and error messages which are likely related:

Problem parsing file

scriptedLogger.js (line 83)

Line 67: Unexpected token ILLEGAL

scriptedLogger.js (line 83)

throwError@http://localhost:7261/scripts/lib/esprima/esprima.js:1200 advance@http://localhost:7261/scripts/lib/esprima/esprima.js:1128 lookahead@http://localhost:7261/scripts/lib/esprima/esprima.js:1157 match@http://localhost:7261/scripts/lib/esprima/esprima.js:1280 parseFunctionSourceElements@http://localhost:7261/scripts/lib/esprima/esprima.js:2982 wrapTrackingFunction/</<@http://localhost:7261/scripts/lib/esprima/esprima.js:3435 parseFunctionDeclaration@http://localhost:7261/scripts/lib/esprima/esprima.js:3063 wrapTrackingFunction/</<@http://localhost:7261/scripts/lib/esprima/esprima.js:3435 parseSourceElement@http://localhost:7261/scripts/lib/esprima/esprima.js:3163 parseSourceElements@http://localhost:7261/scripts/lib/esprima/esprima.js:3203 parseProgram@http://localhost:7261/scripts/lib/esprima/esprima.js:3217 wrapTrackingFunction/</<@http://localhost:7261/scripts/lib/esprima/esprima.js:3435 parse@http://localhost:7261/scripts/lib/esprima/esprima.js:3726 .parse@http://localhost:7261/scripts/plugins/esprima/esprimaVisitor.js:38 EsprimaJavaScriptContentAssistProvider.prototype._internalFindDefinition@http://localhost:7261/scripts/plugins/esprima/esprimaJsContentAssist.js:2280 EsprimaJavaScriptContentAssistProvider.prototype.computeHover@http://localhost:7261/scripts/plugins/esprima/esprimaJsContentAssist.js:2364 makeEditor/<@http://localhost:7261/scripts/scripted/editor/scriptedEditor.js:760 Editor.prototype._getTooltipInfo@http://localhost:7261/scripts/orion/editor/editor.js:442 .getTooltipInfo@http://localhost:7261/scripts/orion/editor/editor.js:536 Tooltip.prototype.show@http://localhost:7261/scripts/orion/textview/tooltip.js:116 Tooltip.prototype.setTarget/self._showTimeout<@http://localhost:7261/scripts/orion/textview/tooltip.js:109

scriptedLogger.js (line 83)

Problem parsing file

scriptedLogger.js (line 83)

Line 67: Unexpected token ILLEGAL

scriptedLogger.js (line 83)

throwError@http://localhost:7261/scripts/lib/esprima/esprima.js:1200 advance@http://localhost:7261/scripts/lib/esprima/esprima.js:1128 lookahead@http://localhost:7261/scripts/lib/esprima/esprima.js:1157 match@http://localhost:7261/scripts/lib/esprima/esprima.js:1280 parseFunctionSourceElements@http://localhost:7261/scripts/lib/esprima/esprima.js:2982 wrapTrackingFunction/</<@http://localhost:7261/scripts/lib/esprima/esprima.js:3435 parseFunctionDeclaration@http://localhost:7261/scripts/lib/esprima/esprima.js:3063 wrapTrackingFunction/</<@http://localhost:7261/scripts/lib/esprima/esprima.js:3435 parseSourceElement@http://localhost:7261/scripts/lib/esprima/esprima.js:3163 parseSourceElements@http://localhost:7261/scripts/lib/esprima/esprima.js:3203 parseProgram@http://localhost:7261/scripts/lib/esprima/esprima.js:3217 wrapTrackingFunction/</<@http://localhost:7261/scripts/lib/esprima/esprima.js:3435 parse@http://localhost:7261/scripts/lib/esprima/esprima.js:3726 .parse@http://localhost:7261/scripts/plugins/esprima/esprimaVisitor.js:38 getOutline@http://localhost:7261/scripts/plugins/outline/esprimaOutliner.js:120 openDialog@http://localhost:7261/scripts/scripted/dialogs/outlineDialog.js:291 attachOutlineClient/<@http://localhost:7261/scripts/scripted/editor/editorPane.js:256 TextView.prototype._doAction@http://localhost:7261/scripts/orion/textview/textView.js:3517 TextView.prototype._handleKeyDown@http://localhost:7261/scripts/orion/textview/textView.js:2771 TextView.prototype._hookEvents/<.handler@http://localhost:7261/scripts/orion/textview/textView.js:4999

scriptedLogger.js (line 83)

TypeError: node is null [Break On This Error]

switch (node.type) {

esprim...iner.js (line 41)

kdvolder commented 11 years ago

Evidently, the outline view can't really populate when it can't get a parse tree, but the errors should be handled more gracefully.