Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode Java linting - disable specific warnings

I'm using the Language Support for Java(TM) by Red Hat extension in VS Code (notably not the other extensions in the Java extension pack, as they aren't relevant for what I'm doing).

The linter is largely helpful, but it also highlights many issues that I want to ignore. For example, I don't want it to warn me about either of these:

The declared package "" does not match the expected package ...

... is a non-project file, only syntax errors are reported

Every time I encounter warnings I want to ignore, I have to Google them and try to find the eclipse preference for that specific error. This is time consuming and not always possible (I haven't yet found out how to disable either of the above messages).

I've created a preferences file following this question that disables warnings like unused imports.

project_directory
├── .settings
│   └── org.eclipse.jdt.core.prefs
└── other_stuff

Often, as in the aforementioned question, I find lines like org.eclipse.jdt.core.compiler.problem.unusedImport=ignore.

Where do people find these preference ids? I found a partial list here, but it doesn't have any documentation.

Given an arbitrary error message, like the ones above, how do I know which preference will disable it?

like image 838
kviLL Avatar asked Jul 03 '26 15:07

kviLL


1 Answers

Use the "java.errors.incompleteClasspath.severity" setting in VS Code, set it to "ignore" to ignore errors.

    "java.errors.incompleteClasspath.severity":"ignore",
like image 181
JialeDu Avatar answered Jul 05 '26 06:07

JialeDu