question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.project.resourceFilters seems to be ignored when initializing workspace

See original GitHub issue

java.project.resourceFilters seems to be ignored when opening a workspace. I have the vague feeling that I’m doing something wrong rather than this being a bug with the extension, but I tried a few things now, nothing works.

The only other idea I have is the following: vscode-java.log The log seems to show, line 72, that the resource filters are only loaded once the workspace is already initialized. But, as seen in line 63, atm. it takes ~2 minutes to initialize. Unfortunately I have to integrate another project as a subfolder, so a lot more files. #1460 seems to suggest (to me, at least) that exactly this problem is solved in there.

If I can help you with any more information than the provided, I’d be happy to. Thanks you all for helping and developing this nice extension!

Environment
  • Operating System: WSL2, so Linux Docker from Windows 10
  • JDK version: openjdk:11.0.7
  • Visual Studio Code version: 1.50.0
  • Java extension version: 0.68.0
Steps To Reproduce
  1. Open Workspace in container
  2. Watch Java Build Status chewing through the mounted .git folder.

image

Current Result

Folders listed in java.project.resourceFilters are used.

Expected Result

No folders listed in java.project.resourceFilters should be used. One interesting part of this, is that even if I do not set my custom folders (so no “java.project.resourceFilters” in the settings.json), the .git folder is used. The Readme states, that the default value is [“node_modules”,“.git”]. I’d expect therefore, that even then, the .git-folder shouldn’t be parsed.

Additional Informations

A few additional infos, but I’m not sure if they are related to the issue: The .git folder is mounted from the underlying filesystem into the container.

I tried with another folder, too, no difference: the folder is used weather it is in java.project.resourceFilters or not.

My workspace settings file:

{
  "files.watcherExclude": {
    "**/bin/**": true,
    "**/lib/**": true
  },
  "java.project.resourceFilters": [
    ".git",
  ]
}

Here is the project I’m working on: https://gitlab.com/Girstenbrei/cpachecker/-/tree/2a6f9bfe77a33fc9a5b6963d6f0da5bde3bcedda . The settings from above are not yet in this commit, so I included it separately. If you check it out to start with docker, here a folder outside the workspace is mounted into it, just so you are aware.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
testforstephencommented, Dec 8, 2022

This definitely seems to work when you’ve got a .project file - that file gets updated live when you’ve got it

Note that this live-updating of the .project file happens even if java.import.generatesMetadataFilesAtProjectRoot is false - but since it does default to false it won’t be created and maybe the lack of it is causing issues for some people?

@jcrben .project is a necessary config file for Java extension, it can be provided by yourself or created by Java extension. If your workspace already contains a .project file, then Java extension prefers to use it regardless of the value of java.import.generatesMetadataFilesAtProjectRoot. Otherwise, Java extension will create one for you.

if java.import.generatesMetadataFilesAtProjectRoot is false, it just tells Java extension not to generate .project in your workspace but somewhere in cache (see screenshot if you’re interested).

image

1reaction
snjezacommented, Oct 15, 2020

java.project.resourceFilters seems to be ignored when opening a workspace.

@girstenbrei We can’t add any filters if a project doesn’t exist.

You can try to add

<projectDescription>
...
<filteredResources>
		<filter>
			<id>1602772612883</id>
			<name></name>
			<type>30</type>
			<matcher>
				<id>org.eclipse.core.resources.regexFilterMatcher</id>
				<arguments>.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
			</matcher>
		</filter>
	</filteredResources>
</projectDescription>

to your .project file - https://gitlab.com/Girstenbrei/cpachecker/-/blob/2a6f9bfe77a33fc9a5b6963d6f0da5bde3bcedda/.project

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way we can make the Java Language Server to skip ...
As of v0.66.0 of the extension, there is the java.project.resourceFilters setting. As it defaults to ["node_modules",".git"], your problem ...
Read more >
Java on Visual Studio Code Update – August 2020
project.resourceFilters”, where you can specify folders or files that should be excluded from your workspace's refreshing. By default, ' ...
Read more >
Eclipse Project Release Notes 4.25 | The Eclipse Foundation
Java sometimes has difficulty detecting whether a file system is writable. In particular, the method java.io.File.canWrite() appears to return ...
Read more >
Chapter 30. What is New? - DVT Eclipse IDE
DVT-18211 DVT CLI: Ignored non-CPP project nature in CPP mixed language projects when the CDT plugin is unavailable. 22.1.30 (11 October 2022). REMOVED....
Read more >
Linux Eclipse Dev - Google Git
Right-click on the “Java” perspective in the top-right corner and select “Close” to remove it. Create your project(s). First, turn off automatic workspace...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found