Search code examples
javavisual-studio-codelint

How to disable warnings for unused imports in Java in Visual Studio Code?


I'm using the standard extension "Language Support for Java(TM) by Red Hat". How can I disable warnings for unused imports for Java projects in Visual Studio Code?

Maybe someone knows this and can help, because despite some extensive Google searches I can't find sufficient information on this. For other languages yes, but not for Java.


Solution

  • I finally figured it out. It seems that you need to configure this on project level.

    For ignoring all unused imports edit the file .settings/org.eclipse.jdt.core.prefs and add the following line:

    org.eclipse.jdt.core.compiler.problem.unusedImport=ignore