Eclipse hangs on copy/cut for JavaScript files
Asked Answered
K

4

29

I have Eclipse Kepler and NodeEclipse plugin installed. For NodeEclipse's performance reasons I have disabled content assistant for JavaScript files.

Problem: Whenever I copy or cut some lines in JS files (ctrl+c / ctrl+x), the CPU usages goes 100% and the eclipse process eats up all memory (>1GB). I think some GC thrashing is happening. Increasing JVM max memory more is an option, but isn't 1GB enough for eclipse?

This could be some memory leak. Is this specific problem with Nodeclipse? Are there any workarounds/settings in eclipse to diable?

Edited: When I double click a variable, CPU pumps to 100% for 3-4 seconds, comes down. I have mark occurences already disbled. This is happending only for route/*.js files and not for public folder. Investigating more, I find that commenting line containing require('<package-name>') solves this problem, why?

Kaseykasha answered 5/12, 2013 at 6:12 Comment(3)
Are you on Kepler or Kepler SR1?Unfledged
Using Kepler Service Release 1Kaseykasha
Also hangs for me, but doing the Mark Occurrences reduces the hang enourmously (from 5-10 seconds to 1 second). Eclipse Info: Enide Studio 2014 based on preview of Eclipse 4.4 M4 Luna Version: 0.11 Build id: org.apache.maven.model.Build@7e6abaffBalch
C
37

found the solution:

go to Window>Preferences>JavaScript>Editor>Mark Occurrences and unselect the checkboxes. That should do it.

Reason for this problem:

When u press ctrl for copy/paste, it assumes that is a "ctrl+mouseOver" operation, that we do before clicking on a method/variable name to reach its declaration point, or access its documentation. Hence, it tries to find all the occurrences of the text currently under the mouse cursor, along with its declaration point and documentation.

Hope this helps :)

Cq answered 18/6, 2014 at 10:5 Comment(2)
You mean the JS editor is anticipating the behaviour of the user by precomputing occurences before the arrow key is being pressed? Who in his sane mind would come up with such a stupid idea? Is there no Quality Control for such things? It is maybe only in one or two percent of the cases that I do ctrl+arrow instead of ctrl+c/x/v.Inexperienced
on ctrl+mouseover, u generally get options for going to the declaration of that method/variable, on which you have the cursor. i guess in case of javascript, it takes considerable time to find the declaration of the method/variableCq
S
19

Navigate to Window -> Preferences -> JavaScript -> Editor -> Typing -> When pasting

then uncheck Update imports.

Performance improved tremendously in my case. Hat tip to the comment left by @Alexander Taylor.

Strigil answered 21/10, 2015 at 11:51 Comment(2)
Thank you for this note, it made that comment more visible and actually was the solution for me when working inside the bower_components directory.Diantha
I confirmed that it improved performance of pasting as well as copying. This sounds odd, but actually Eclipse no longer hangs when pasting either.Buryat
S
4

This is first Nodeclipse performance related issue I hear.

I think memory usage limits are to insure that bad routines don't eat memory without stop (and affecting all operating system performance). Usually eclipse takes 200-400MB. If your eclipse average is above 500MB I guess you installed too many plugins into 1 Eclipse instance.

Raise an issue for Nodeclipse developers https://github.com/Nodeclipse/nodeclipse-1/ and give exact OS, Java, Eclipse, Nodeclipse versions. Also because it is performance issue you should give your PC configuration CPU, RAM size. Without that exact information it is impossible to investigate. You can also try yourself on other PC, other Eclipse version, other Java version etc and compare, find best combination. Please raise an issue even if you discovered solution yourself.

Read http://www.nodeclipse.org/ carefully. (You should have read before using for at least to learn some tips, and how to get help.) I am not sure it is Nodeclipse issue, but if it is reproduce-able, then it is to be solved quick or Eclipse bugzilla bug to be raise if it is some Eclipse project related.

For information (as of Nodeclipse 0.10)
1) Nodeclipse has 2 Editors: JSDT-based and TextEditor-based. Both have code completion. Trying TextEditor-based can tell if the issue is JSDT related.
2) For validation JSHint validation is used. JSHint is run on Rhino engine that is not so quick, and potentially can take time on large projects. However JSHint Integration is quite mature project and there are options to stop validation after certain number of warnings.

Spohr answered 3/2, 2014 at 2:35 Comment(0)
S
4

Also if your .js file is huge, like 10000+ lines that maybe the cause. See old Eclipse is hanged on copy/paste in JavaScript files

Spohr answered 5/2, 2014 at 9:38 Comment(2)
even when i'm working on a small file but with many other files in the project, i was having this issue. felipe's answer on above linked question worked for me: disable this: Preferences/JavaScript/Editor/Typing{When pasting}/Update importsDistributor
This was THE solution for me when working inside the bower_components directory, thank you!Diantha

© 2022 - 2024 — McMap. All rights reserved.