redhat-developer / redhat-developer/vscode-java

Cannot disable Language Support for Java in `node_modules`

Open
#3,271 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

Issue description

When I open a react-native project, the Language Support for Java scans all the files inside node_modules and shows an error if they have some invalid syntax. I want to be able to disable running the Language Support scan inside node_modules, since then the problem is emphasised in the Project Explorer tab:

Screenshot 2023-09-04 at 16 28 41
Environment
  • Operating System: macOS
  • JDK version: 17.0.8
  • Visual Studio Code version: 1.81.1
  • Java extension version: 1.21.0
Steps To Reproduce
  1. Create a React-Native project: (i.e. npx react-native init testProject);
  2. Add a dependency which has some invalid syntax recognized by the extension: (yarn add @react-native-clipboard/clipboard);
  3. Open the project in VSCode with the extension installed and wait until the error pops up.
Current Result

If you followed the steps above you should get in the error panels a log like:

[{
	"resource": "/Users/test/testProject/node_modules/@react-native-clipboard/clipboard/android/.settings/org.eclipse.buildship.core.prefs",
	"owner": "_generated_diagnostic_collection_name_#4",
	"code": "0",
	"severity": 8,
	"message": "Invalid Gradle project configuration file: .settings/org.eclipse.buildship.core.prefs",
	"source": "Java",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 1
}]
Expected Result

The extension should not trigger any error in the node_modules folder, since it should be skipped as indicated by the default config java.project.resourceFilters, which is ["node_modules",".git"].

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the diagnostic with the reported React Native project and trace how the java.project.resourceFilters setting handles node_modules. Confirm that the default filters suppress Language Support diagnostics there while Java scanning continues normally outside excluded folders.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, react-native, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.