I started to develop Java in visual studio code but on our legacy project there are hundreds of unused fields. I'm getting 300+ warnings that "The value of the local variable XXXX is not used."
How can I ignore these warnings?
There is a file in the in the project root folder .settings/org.eclipse.jdt.core.prefs.
Add the following line, or edit it if exist:
org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
UPD: If you want edit more of your preferences, check this link.
Adding onto simply_sideways's answer.
If above settings don't work, you can add "java.settings.url":"/yourPathTo/org.eclipse.jdt.core.prefs" to settings.json file.
Visit https://github.com/redhat-developer/vscode-java/wiki/Settings-Global-Preferences for more settings global preferences.
Not a java expert but following worked for me in vscode
<setting id="org.eclipse.jdt.core.compiler.problem.unusedLocal" value="ignore"/>
Adding onto Vlad's answer for those that come across this question later:
It may be obvious for a more experienced developer but I spent time looking for that .settings folder in a new project, unaware that I could/should just create it myself if it didn't exist. Don't waste your time like me. Create the .settings folder and org.eclipse.jdt.core.prefs file yourself, then add Vlad's code (org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore). That link he gave helped me generalize to other issues.
Also, VS Code may hide a .settings folder that does already exist. To show it, open your settings.json file and add:
"files.exclude": {
"**/.settings": false
}