redhat-developer / redhat-developer/vscode-java

Cannot disable Language Support for Java in `node_modules`

未关闭
#3,271 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
2.3k
派生
546
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

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"].

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先使用报告中的 React Native 项目重现该诊断,并跟踪 java.project.resourceFilters 设置如何处理 node_modules。确认默认筛选器会抑制其中的 Language Support 诊断,同时 Java 扫描会在排除文件夹之外正常继续。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, react-native, typescript, vscode
领域
developer-experience, tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。