Eclipse is hanged on copy/paste in JavaScript files

十年热恋 提交于 2019-11-29 16:49:45

问题


I've been running Eclipse Helios 3.6 using the Java/CFEclipse IDEs, and finding some very strange and aggravating errors when trying to edit Javascript files. After the .js file reaches a certain size (~250 lines of code), Eclipse will randomly hang whenever I try to select, copy-paste selections, or save. Clicking after the hang starts will result in the "file edit source ... help" bar being whited out, and clicking again leads to the windows "(not responding)" message displayed in the program header. The hang then goes away after another 5-10 seconds of waiting. This is the case for all JavaScript files I try to edit, although shorter ones don't hang as long and don't bring up the "(not responding)" message.

I've thought it was a problem with the Javascript validation/autocomplete options, and have accordingly turned those off; however, the copy-paste hang problem still persists. I've also tried the Javascript IDE - same problem. Is this a problem with Eclipse Javascript handling, period? Has anyone else gotten errors like these? And if it's a fundamentally Eclipse problem, would anyone be able to suggest a better Javascript/Coldfusion editor?

EDIT: For more information, log output from the latest hang:

!ENTRY org.eclipse.wst.jsdt.ui 4 2 2010-08-18 11:25:54.699
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.wst.jsdt.ui".
!STACK 0
java.lang.NullPointerException
    at org.eclipse.wst.jsdt.internal.compiler.lookup.ArrayBinding.getExactMethod(ArrayBinding.java:233)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:401)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getMethod(Scope.java:1813)
    at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:307)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolve(Expression.java:477)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
    at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:280)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
    at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:280)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
    at org.eclipse.wst.jsdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:191)
    at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:337)
    at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:139)
    at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:291)
    at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:362)
    at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:394)
    at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:859)
    at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:527)
    at org.eclipse.wst.jsdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:862)
    at org.eclipse.wst.jsdt.core.dom.ASTParser.createAST(ASTParser.java:647)
    at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:581)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:574)
    at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:509)
    at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:150)
    at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:135)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

!ENTRY org.eclipse.wst.jsdt.ui 4 0 2010-08-18 11:25:54.824
!MESSAGE Error in JSDT Core during AST creation
!STACK 0
java.lang.NullPointerException
    at org.eclipse.wst.jsdt.internal.compiler.lookup.ArrayBinding.getExactMethod(ArrayBinding.java:233)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:401)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getMethod(Scope.java:1813)
    at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:307)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolve(Expression.java:477)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
    at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:280)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
    at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:280)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
    at org.eclipse.wst.jsdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:191)
    at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:337)
    at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:139)
    at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:291)
    at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:362)
    at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:394)
    at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:859)
    at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:527)
    at org.eclipse.wst.jsdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:862)
    at org.eclipse.wst.jsdt.core.dom.ASTParser.createAST(ASTParser.java:647)
    at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:581)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:574)
    at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:509)
    at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:150)
    at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:135)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

回答1:


For me the solution was disable this option...

Preferences/JavaScript/Editor/Typing{When pasting}/Update imports




回答2:


Ok, I think I found a brute force solution to this. I went into windows>preferences>javascript>[all sub menus] and just unchecked as many things as I could stomach to uncheck. I did that a couple of weeks ago and it's only hung once since then (I think it was unrelated as I had to force quit after 5 minutes).




回答3:


First time met as Eclipse hangs on copy/cut for JavaScript files, and https://github.com/Nodeclipse/nodeclipse-1/issues/159

Current summary:

  • size matters: big project can cause Eclipse JSDT to freeze (this is old issue as @andreialecu has collected https://github.com/Nodeclipse/nodeclipse-1/issues/159#issuecomment-68098716)
  • hammer 100% solution is to remove JsNature for that one project
  • more subtle is to disable only some JSDT features
    Window>Preferences>JavaScript>Editor>Mark Occurrences and maybe even Window->Preferences->General->Editors->Text Editors->Hyperlinking
  • recommended by JSDT maintainers (for further observation): (by @vrubezhny )
    • get latest JSDT version
    • increase available memory settings
  • use resource filters to hide more files in folders like build/dist/bower/vendor (by @ppartida )

And generally:

  • pay attention what step you have taken when working with any software.
  • experiment with little changes

Please add more answers here (the first issue raised Aug 18 '10)



来源:https://stackoverflow.com/questions/3515422/eclipse-is-hanged-on-copy-paste-in-javascript-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!