在VS Code中声明了未使用的变量会有警告信息和绿色波浪线提示,强迫症看着难受。查了很多方法,终于找到解决方法:
https://stackoverflow.com/questions/49667888/visual-studio-code-java-disable-serialversionuid-warning
Currently Java Support for VSCode reads a file called .settings/org.eclipse.jdt.core.prefs as part of its Eclipse project support. That’s a folder called .settings in the root folder of the project, then a file called org.eclipse.jdt.core.prefs in that folder.
In this file, we can suppress the serialVersionUID warning by adding the following line: org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
Now just restart VS Code, and those warnings will no longer show up.
参照这个方法,在org.eclipse.jdt.core.prefs文件中添加“org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore”解决问题!、
org.eclipse.jdt.core.prefs文件所有配置项:
https://github.com/jenkinsci/analysis-core-plugin/blob/master/.settings/org.eclipse.jdt.core.prefs
本文介绍如何在VSCode中禁用未使用的变量警告,通过编辑项目的.settings/org.eclipse.jdt.core.prefs文件,添加特定配置行,实现对警告信息的忽略,适合对代码整洁度有高要求的开发者。
1万+

被折叠的 条评论
为什么被折叠?



