Skip to content
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

Exclude default folders from file watching #3703

Open
Nightenom opened this issue Jul 11, 2024 · 3 comments
Open

Exclude default folders from file watching #3703

Nightenom opened this issue Jul 11, 2024 · 3 comments

Comments

@Nightenom
Copy link

Nightenom commented Jul 11, 2024

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
  • note: env should be irrelevant for this issue
  • Operating System: Win 11 pro, latest update
  • JDK version: 21
  • Visual Studio Code version:
  • Java extension version:
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
Copy link

I need this too

@snjeza
Copy link
Contributor

snjeza commented Jul 30, 2024

I can't reproduce the issue.

Java LS watches the following files:

  • "**/*.java",
  • "**/.project",
  • "**/.classpath",
  • "**/.settings/*.prefs",
  • "/src/"
  • the project's source folders
  • the project's classpath libraries
  • java.settings.url
  • java.format.settings.url

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

@Nightenom
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants