-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for excluding files from the problem tab #2150
Allow for excluding files from the problem tab #2150
Comments
@FieteO you can try to add the following property
to <your_projects>/.settings/org.eclipse.jdt.core.prefs |
Thanks for the suggestion @snjeza this does help, but is applied to the whole project. It kind of misses the point of ignoring problems for some subfolders though... |
Could using Supporting something like this properly might be possible, though maybe not as high priority given there's some ways of achieving roughly the same thing. I see that on the Eclipse side, the problem view filter settings are stored in the workspace in a file like |
@rgrunber I am not sure I fully understand what you are suggesting. Are you saying I should add |
I mean adding the If applying them to the whole project is too much, then this should be a bit more granular as I don't think there is a way to suppress warnings on just those source files under a certain package. |
Apologies if I am missing your point and at the risk of repeating myself: In our setup the source files (i.e the restcontrollers) are completely transient, they are not versioned and rebuild with each |
I just took a look on the openapi-generator issue tracker and found this related feature request to add |
You're right. I missed the "generated code" part in your first comment. Ok, so that workaround won't help in this case. It shouldn't be too difficult to implement some sort of diagnostic filtering. Just a question of whether such a capability should be done at the client (VS Code) level given how such a feature would likely be useful across many languages. |
I tried setting: "settings": {
"java.import.generatesMetadataFilesAtProjectRoot": true, Then opening the generated .classpath and adding the ignore_optional_problems attribute like: <classpathentry kind="src" output="target/classes" path="target/generated-sources/openapi/src/gen/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
</attributes>
</classpathentry> Clean Language Server Workspace and the problems are gone. It would be great to be able to enable this for any "target/generated-sources" folder without the need to set java.import.generatesMetadataFilesAtProjectRoot and manually editing .classpath. |
NOTE: It's curious that for annotations and test-annotations the ignore_optional_problems attribute is automatically set: <classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry> |
Interesting! I didn't know about Only disadvantage is according to |
Any updates on this? |
Just a question for those interested in this feature. What should happen when you open a file that is in the "file exclude" list for problems ? If you type something in that file, and it's a compilation error, do you still expect the incorrect tokens to be annotated as errors ? The problems view is linked to this workflow so you can't have the errors show up in the file and not the problems view (as far as I understand). Should the exclude filter for a file only be active when a file isn't open and having focus ? Are there certain kinds of errors that you specifically want excluded, and others that you never want to exclude (eg. compilation errors) ? |
I'll say that this should work just as annotations and test-annotations that automatically set the That said, if there is a way to explicitly set what files should be ignored for error check... that should be obeyed... no error should be reported for those files. Again, that said, I'll suggest to provide both a way to ignore all errors for specified files and another way to ignore only optional problem for specified files (so it would work as the annotations and test-annotations but manually specifying the files instead of automatically recognizing that the files are auto-generated). |
This should be resolved with |
I have a java project that has a rather large proportion of files that are generated by openapi-generator. The generated code contains a lot of problems that I will not resolve (i.e
The import XY is never used
). This is cluttering the problems view.I know that this view can be filtered and that there is the
files.exclude
option. I also found feature requests (#22289, #43135) for vscode to include afiles.problemExclude
option.However this comment made me wonder if this could/should be rather implemented by this extension to ignore particular folders in the problem analysis.
The text was updated successfully, but these errors were encountered: