redhat-developer / redhat-developer/vscode-java
Quick fixes do not provide good support for readonly files
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 546
- 平均合并
- 20 小时 1 分钟
- 30 天内合并 PR
- 11
描述
Description of issue
The Quick Fix menu in VS Code provides several options to fix common compiler errors, such as creating a missing method in a class.
However, this menu can be misleading for users when the affected files are marked as readonly in VS Code using the files.readonlyInclude workspace setting.
When a file is marked readonly, a Quick Fix option may still be presented to add a method or other class member to it. Selecting that option seems to have a couple of different possible behaviors:
- If the file is not open in an editor tab, the Quick Fix operation has no effect but presents no message to the user explaining why
- If the file is open in an editor tab, the Quick Fix operation will seem to apply the requested change, and the language server receives updated content for the file (meaning the red squiggle goes away). However, the updated content is not actually written to disk. Builds will fail with compilation errors. If the editor tab is closed, then the language server will refresh from the file on-disk and the red squiggle will return. Even though the changes are in-memory-only, the file does not show the white circle on the tab header indicating unsaved changes.
Requested change
Change to a more intuitive behavior for the Quick Fix options:
- Hide (or gray out) any Quick Fix options that would require changes to readonly files
- Present a popup message to the user after the Quick Fix is selected explaining that it can't be used on readonly files
At the least, the Quick Fix should not make in-memory-only changes.
Software versions
VS Code: Tested on both 1.96.2 and 1.106.3
Java Extension: 1.50.0
OS: MacOS 15.6.1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先跟踪 Quick Fix 菜单,以及 language server 对匹配 VS Code files.readonlyInclude 设置的文件的处理。分别复现文件未打开和在编辑器中打开这两种情况,然后验证只读文件的修复是否会被隐藏或禁用,说明它们为什么无法运行,并确保绝不会留下仅存在于内存中的更改。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java, typescript, vscode
- 领域
- developer-experience, tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100