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

22,089

Solution 1

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.

Solution 2

Opening JavaScript files in text editor helps. You may like to change the default default file association for js files to Text Editor.

Share:
22,089
Swatantra Kumar
Author by

Swatantra Kumar

Swatantra is a technology evangelist and a thought leader. He has deep roots in software engineering, architecture design, server administration and program management. When he is not working, he enjoys reading about new technologies. He has written, co-written and published many articles in international journals, on various topics including Open Source, Networks, Performance Management, and Low-Code. He made a proposal for a social network and media platform for students at the University during his graduation days. Microsoft Certified: Azure Solutions Architect Expert Microsoft Certified: Azure Administrator Associate AWS Certified Solutions Architect Associate The Open Group Certified: TOGAF®9 Certified OutSystems Associate Tech Lead OutSystems Associate Web Developer OutSystems Associate Sales Certified ScrumMaster® SAFe®5 Agilist Agile Business Expert – Agile Coach IBM Enterprise Design Thinking Practitioner PRINCE2® Practitioner Certificate in Project Management ITIL® Foundation Certificate in IT Service Management

Updated on July 30, 2020

Comments

  • Swatantra Kumar
    Swatantra Kumar almost 4 years

    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?

  • pille
    pille about 11 years
    Just for completeness' sake, with the Mac version (I'm on Eclipse Helios) the shortcut to Toggle Mark Occurrences is <kbd>ALT</kbd>+<kbd>CMD</kbd>+<kbd>O</kbd> (the letter O, not the number zero).
  • azizunsal
    azizunsal almost 11 years
    Altough this is the correct answer to eliminate the bug, there is a topic here And the accepted answer worth reading