redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.07k stars 433 forks source link

Exclude default folders from file watching #3703

Open Nightenom opened 2 months ago

Nightenom commented 2 months ago

In my scenario I'm working with Gradle projects, but the context should also apply to Maven and normal project.

After opening project it would be nice if .gradle/** and build/** were automatically excluded from fileWatch by this extension, for Maven I believe it's target/**. Whether to exclude bin/** is up to you, but for me it makes no sense to watch it too, since IDE should be aware of its own folders? Obviously these folders are configurable so mby this should be also some kind of config based on type of project import?

The point of this is to prevent unnecessary autoBuild triggers and similar, which may even result in permanent refresh loop like this

Environment
Steps To Reproduce
  1. Open Gradle project
  2. Notify any file in eg. build
  3. See extension being notified of file change
Current Result

Entire project being file watched, causing unnecessary eclipse-jdtls trigger

Expected Result

Don't watch files that aren't "source" relevant

Additional Informations

May provide my .vscode/settings.json if needed

Mobius0526 commented 2 months ago

I need this too

snjeza commented 2 months ago

I can't reproduce the issue.

Java LS watches the following files:

It doesn't watch the project output folders: target/, bin/, build/**, ... @Nightenom @Mobius0526 Could you attach a project example reproducing the error.

Nightenom commented 1 month ago

Feel free to close for now, because upstream library changed with updates and i cant no longer replicate there. However my point is that you can have */.java in folders like /build/ etc which are generated using build system and that might trigger endless loop of refreshing. So I think it might be good to automatically exclude build target directories. (I made sure I don't have that file as classpath source)