简体   繁体   中英

Stop NetBeans “fixing” imports

How do I stop Netbeans (8.2) automatically "fixing" imports, on every keystroke?

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' ].

  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)

To be honset I don't get your question exactly. What you describe seems to be not the default behaviour of 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 ).

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

It saves every 1 second but that causes imports to be fixed every 1 second.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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