Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An internal error occurred during: "Requesting JavaScript AST from selection"

I'm facing unique error/alert-popup while editing JavaScript files in Eclipse and it pops up this error every time I place the cursor on that line.

JS: NullPointerException when cursor is placed at the end of the line containing return statement.

foo.bar = function(x) {
    if (xyz) {
      return fn(x);«error»
    }

    return fn(x);«error»

    return (fn(x));«error»

    return new fn(x);«ok»

    return x;«sometimes»

    return "";«error» 

    return x+"x";«error» 

    return this.x;«error»

    return fn(
        x);«error»

    return new fn(
        x);«ok»

    return;«error»  
};
  • «» — cursor position
  • «ok» — no error
  • «error» — triggers error
  • «sometimes» — I have code that never triggers an exception in that case, but I don’t see a pattern.

If cursor is at the end of the line of a return, this exception happens:

An internal error occurred during: "Requesting JavaScript AST from selection".
java.lang.NullPointerException

The Eclipse error is:

'Requesting JavaScript AST from Selection' has encountered a problem. 
An internal error occured during "Requesting JavaScript AST from selection". 
java.lang.NullPointerException

Is there a solution or workaround available to fix the problem?

like image 593
Swatantra Kumar Avatar asked Dec 18 '12 14:12

Swatantra Kumar


1 Answers

Simplest solution:

  • Turn off Toggle Mark Occurrences (Alt-Shift-O or the paintbrush icon on the toolbar, which handily, will show you your current state).

    • It's just disabling the feature of highlighting other occurrences of whatever variable, etc you have your cursor on.

Official solution:

  • You can track the official bug here.

  • There is a patch posted here which you might try.

like image 113
Swatantra Kumar Avatar answered Oct 12 '22 16:10

Swatantra Kumar