Eclipse 在复制/剪切 JavaScript 文件时挂起

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20392791/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:22:25  来源:igfitidea点击:

Eclipse hangs on copy/cut for JavaScript files

javascripteclipsenode.jseclipse-keplernodeclipse

提问by ankitjaininfo

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

我安装了 Eclipse Kepler 和 NodeEclipse 插件。出于 NodeEclipse 的性能原因,我禁用了 JavaScript 文件的内容助手。

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?

问题:每当我在 JS 文件中复制或剪切一些行(ctrl+c / ctrl+x)时,CPU 使用率都会达到 100%,并且 eclipse 进程会吃掉所有内存(> 1GB)。我认为一些 GC 颠簸正在发生。增加 JVM 最大内存是一种选择,但是 1GB 对 Eclipse 来说还不够吗?

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

这可能是一些内存泄漏。这是 Nodeclipse 的特定问题吗?eclipse 中是否有任何解决方法/设置可以禁用?

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?

编辑:当我双击一个变量时,CPU 将在 3-4 秒内泵入 100%,然后下降。我有标记出现已经禁用。这仅发生在 route/*.js 文件而不是公共文件夹中。查了下,发现注释行包含require('<package-name>')解决了这个问题,为什么呢?

回答by Biman Tripathy

found the solution:

找到了解决办法:

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

转到Window>Preferences>JavaScript>Editor>Mark Occurrences并取消选中复选框。那应该这样做。

Reason for this problem:

出现此问题的原因:

When u press ctrlfor 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.

当您按下ctrl复制/粘贴时,它假定这是一个“ctrl+mouseOver”操作,我们在单击方法/变量名称以到达其声明点或访问其文档之前执行该操作。因此,它会尝试查找当前在鼠标光标下出现的所有文本,以及其声明点和文档。

Hope this helps :)

希望这可以帮助 :)

回答by Saheed

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

导航到窗口 -> 首选项 -> JavaScript -> 编辑器 -> 键入 -> 粘贴时

then uncheckUpdate imports.

然后取消选中更新导入

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

在我的情况下,性能得到了极大的提高。@Alexander Taylor 留下的评论的帽子提示。

回答by Paul Verest

This is first Nodeclipse performance related issue I hear.

这是我听到的第一个与 Nodeclipse 性能相关的问题。

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.

我认为内存使用限制是为了确保不良例程不会不停地消耗内存(并影响所有操作系统性能)。通常eclipse需要200-400MB。如果您的 Eclipse 平均值高于 500MB,我猜您在 1 个 Eclipse 实例中安装了太多插件。

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.

为 Nodeclipse 开发人员提出问题https://github.com/Nodeclipse/nodeclipse-1/并提供确切的操作系统、Java、Eclipse、Nodeclipse 版本。也因为它是性能问题,你应该给你的 PC 配置 CPU、RAM 大小。没有这些确切的信息,就不可能进行调查。您也可以在其他 PC、其他 Eclipse 版本、其他 Java 版本等上试用并进行比较,找到最佳组合。即使您自己发现了解决方案,也请提出问题。

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.

仔细阅读http://www.nodeclipse.org/。(你应该在使用前阅读至少了解一些技巧,以及如何获得帮助。)我不确定这是不是 Nodeclipse 问题,但如果它是可重现的,那么它是快速解决的或 Eclipse bugzilla 错误如果它是一些与 Eclipse 项目相关的,则要提高。

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 JSDTrelated.
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 Integrationis quite mature project and there are options to stop validation after certain number of warnings.

有关信息(截至 Nodeclipse 0.10)
1) Nodeclipse 有 2 个编辑器:基于 JSDT 和基于文本编辑器。两者都有代码完成。尝试基于 TextEditor 可以判断问题是否与JSDT相关。
2) 对于验证,使用 JSHint 验证。JSHint 在 Rhino 引擎上运行,速度不是那么快,并且在大型项目上可能需要时间。然而JSHint 集成是一个相当成熟的项目,并且有一些选项可以在出现一定数量的警告后停止验证。

回答by Paul Verest

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

此外,如果您的 .js 文件很大,比如 10000 多行,这可能是原因。请参阅旧的Eclipse 挂在 JavaScript 文件中的复制/粘贴