$E_FN crashes or uses the wrong file outside :ExecutorRun

オープン 初心者向け
#45 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
lua, neovim
領域
devtools

調査の方向性

まず run_one_off_cmd、set_task_command、get_relative_buffer_name を読み、issue で古い、または nil のバッファーパスが報告されている箇所を確認してください。Neovim で両方のケースを再現します。:ExecutorRun の前に :ExecutorOneOff を実行し、その後、:ExecutorRun の実行後に別のバッファから実行してください。該当するパスのバッファー選択を更新し、$E_FN がクラッシュせずに現在のファイルを使うことを確認してください。

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

説明

:ExecutorRun records the current buffer, and $E_FN uses that recorded buffer. Other ways of running or setting a command do not record it first, so $E_FN either crashes or uses the wrong file.

Steps to reproduce

Crash

  1. Start Neovim and open any file.
  2. Before running :ExecutorRun, run :ExecutorOneOff echo $E_FN.
  3. The command fails with Invalid 'buf': Expected Lua number. The error comes from nvim_buf_get_name(nil) in get_relative_buffer_name.

Wrong file

  1. Open a.js and run :ExecutorRun once.
  2. Switch to b.js.
  3. Run :ExecutorOneOff echo $E_FN. The command runs on a.js instead of b.js.

Affected paths

last_active_buf_id is set only in Executor.run(). These paths read it before it is set, or after it has gone stale:

  • :ExecutorOneOff (run_one_off_cmd).
  • Choosing a preset. set_task_command runs before Executor.run() records the buffer.
  • Choosing an entry from the history picker. This path also calls set_task_command before Executor.run().
  • require("executor").api.set_task_command and api.run_task.

Possible fix

Record the current buffer in run_one_off_cmd and set_task_command. Alternatively, read the current buffer directly when last_active_buf_id is nil.

主要言語
Lua
スター
161
フォーク
12
平均マージ
25分
マージ済み PR(30日)
1

環境構築

はじめの一歩

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

google/executor.nvim のほかの issue

google/executor.nvim の issue をすべて見る

似ている issue

Lua の issue をもっと見る

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

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