简体   繁体   English

即使启用了折叠功能,Eclipse JavaScript的折叠功能也消失了

[英]Eclipse JavaScript Fold Function Ability Disappeared Even With Folding Enabled

For a while now I could collapse and expand functions without any problems in my JavaScript files. 现在有一段时间,我可以折叠和扩展函数,而JavaScript文件中没有任何问题。 Suddenly all of the +/- buttons next to the line numbers disappeared for all functions. 突然,所有功能旁边的行号旁边的所有+/-按钮都消失了。 Folding for JavaScript is enabled and it is clear there is space next to the line numbers for the buttons. 启用了JavaScript折叠功能,很明显按钮的行号旁边有空格。

I'm using Eclipse Java EE IDE for Web Developers, Version: Neon.3 Release (4.6.3) 我正在使用面向Web开发人员的Eclipse Java EE IDE,版本:Neon.3版本(4.6.3)

The problem was that I had just created a new function and I had included in the function parameters the var declaration: 问题是我刚刚创建了一个新函数,并且在函数参数中包含了var声明:

// No functions could be folded
function foobar(var foo, var bar) {
...
}

Removing the var for each parameter solved the folding problems: 删除每个参数的var可解决折叠问题:

// All functions can now be folded again
function foobar(foo, bar) {
...
}

Just as an information, the shortcuts for expand or collapse in Eclipse are the following : 就像信息一样,在Eclipse中展开或折叠的快捷方式如下:

  • CTRL + / : activate collapsing (- or + appear next to the functions) CTRL + / :激活折叠(-或+出现在功能旁边)
  • CTRL + MAJ + / : collapse all functions CTRL + MAJ + / :折叠所有功能
  • CTRL + * : expand all functions CTRL + * :展开所有功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM