简体   繁体   English

停止NetBeans“修复”导入

[英]Stop NetBeans “fixing” imports

How do I stop Netbeans (8.2) automatically "fixing" imports, on every keystroke? 如何在每次击键时停止Netbeans(8.2)自动“修复”导入?

For example, 例如,

  1. deleting an import statement halfway through typing the statement [presumably because 'import x' isn't used when you are trying to type 'import xy' ]. 在键入语句的途中删除一个import语句[大概是因为当您尝试键入'import xy'时未使用'import x']。

  2. Removing all the imports when I type a ", /*. {, or anything that makes the rest of the program syntactically invalid [presumably because it is "not using" the imports. 当我键入“,/ *。{或使程序的其余部分在语法上无效的任何内容时,请删除所有导入内容[大概是因为它”没有使用“导入内容。

It is annoying to have to 'fix-imports' on almost every keystroke, but awful when fix-imports gets it wrong (eg. a program that using java.awt.* and java.util.List, but not java.awt.List) 几乎在每次击键时都必须“修复导入”是很烦人的,但是当修复导入弄错时却很糟糕(例如,使用java.awt。*和java.util.List而不是java.awt的程序。名单)

To be honset I don't get your question exactly. 不好意思,我不完全知道你的问题。 What you describe seems to be not the default behaviour of NetBeans. 您所描述的似乎不是NetBeans的默认行为。

From you question it seems that you're writing your imports on you own. 从您的问题看来,您似乎是自己编写导入文件。 This is not necessary. 这不是必需的。 When you want to use an no imported class just use autocompletion ( Strg + Space ) or organize imports ( Strg + Shift + i ). 当您要使用不导入的类时,只需使用自动补全Strg + Space )或组织导入( Strg + Shift + i )。

I never had the issues you described. 我从来没有遇到您描述的问题。 You've might installed some additional plugins. 您可能已经安装了一些其他插件。

The particular plugin that seemed to be causing the problem is 似乎引起问题的特定插件是

https://github.com/rsmz/AutoSaveModified https://github.com/rsmz/AutoSaveModified

It saves every 1 second but that causes imports to be fixed every 1 second. 它每1秒保存一次,但是这会使导入每1秒固定一次。

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

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