Copy command silently no-ops; Move At crashes with NameError on open files
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 90/100
調査の方向性
advanced_new_file/commands/copy_file_command.py と advanced_new_file/commands/move_file_command.py を読み、それぞれの _try_prompt_if_dest_exists メソッドと move_from_argument の経路を比較する。上書き警告をオフにした状態でのコピー動作と、移動元をタブで開いた状態での移動動作を再現する。通常のケースでコピーが続行され、Move At が NameError なしで完了すれば完了。
索引モデルが issue の本文から書いたものです。
説明
Bug 1: AdvancedNewFileCopyCommand silently does nothing
_try_prompt_if_dest_exists in advanced_new_file/commands/copy_file_command.py has no fallback return:
def _try_prompt_if_dest_exists(self, target):
if self.settings.get(WARN_OVERWRITE_ON_COPY_SETTING, False):
if os.path.exists(target):
return sublime.ok_cancel_dialog(
target + " already exists. Copy will overwrite existing file. Continue?"
)
It implicitly returns None whenever warn_overwrite_on_copy is off (the default) or the target doesn't already exist — i.e. in almost every normal case. _copy_file then does:
if not self._try_prompt_if_dest_exists(path):
return (False, path)
Since not None is True, the copy is skipped unconditionally in that case. The visible symptom: the "Copy" input panel appears, you type a path, press enter, and nothing happens — no file is created, no error shown.
This has been present since the overwrite-warning feature was introduced in d4e1fc5 ("warn overwrite on copy command"). The sibling implementation in move_file_command.py's _try_prompt_if_dest_exists does this correctly (it has return True at the end) — copy_file_command.py's version is just missing that line.
Fix:
def _try_prompt_if_dest_exists(self, target):
if self.settings.get(WARN_OVERWRITE_ON_COPY_SETTING, False):
if os.path.exists(target):
return sublime.ok_cancel_dialog(
target + " already exists. Copy will overwrite existing file. Continue?"
)
return True
Bug 2: AdvancedNewFileMoveCommand.move_from_argument references an undefined window
In advanced_new_file/commands/move_file_command.py:
def move_from_argument(self, source, target):
file_view = self._find_open_file(source)
if file_view is not None:
self.view.run_command("save")
window.focus_view(file_view)
window.run_command("close")
...
window is never assigned in this method (every other method in the file does window = self.window first). This path is hit via "Move At" (sidebar context menu → Move) when the targeted file is also currently open in a tab, and raises NameError: name 'window' is not defined.
Fix: use self.window instead of the bare window in both places.
Happy to open a PR with both one-line fixes if that's useful.
- 主要言語
- Python
- スター
- 833
- フォーク
- 96
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SublimeText/AdvancedNewFile のほかの issue
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
SublimeText/AdvancedNewFile#196 · リアクション 1 件 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
SublimeText/AdvancedNewFile#195 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
SublimeText/AdvancedNewFile#193 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
SublimeText/AdvancedNewFile#183 · コメント 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
SublimeText/AdvancedNewFile#180 ·
SublimeText/AdvancedNewFile の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Imbad0202/academic-research-skills#987 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
Pull-through from gcr.io returns 500 when pulling using podman/buildah対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンIssue Triage-Needed
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
pulp/pulp_container#2581 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ROCm/rocm-systems#13754 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信