redhat-developer / redhat-developer/vscode-java

Quick fixes do not provide good support for readonly files

オープン
#4,275 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

enhancement
主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
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.
Image

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.
Image

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:

  1. 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
  2. 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.
Image Image
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、VS Code の files.readonlyInclude 設定に一致するファイルについて、Quick Fix メニューと language server の処理を追跡します。ファイルを開いていない場合とエディターで開いている場合の両方を再現し、その後、読み取り専用ファイルに対する修正が非表示または無効になることを確認し、なぜ実行できないのかを説明するとともに、メモリ上だけの変更を決して残さないようにします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, typescript, vscode
領域
developer-experience, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。