Skip to content

feat: 複数行コメントの対象範囲を表示する - #237

Merged
kyu08 merged 10 commits into
mainfrom
feat/comment-range-indicator
Oct 9, 2026
Merged

kyu08 merged 10 commits into
mainfrom
feat/comment-range-indicator

Conversation

@kyu08

@kyu08 kyu08 commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

概要

複数行コメントはその範囲の最終行にだけ表示されるため、どこから始まる範囲へのコメントなのかがわからなかった。範囲をラベル、行番号の色、カーソル連動の表示で示すようにする。

Closes #131

before

after

変更内容

  • inlineスタイルのコメントボックスの見出しに範囲を出す(Comment L20-L29 [pending])
    • 範囲はスレッド単位の情報なので、[resolved thread] と同じくスレッド先頭のボックスにだけ出し、返信には繰り返さない
    • 単一行コメントには出さない。ボックスの直上の行なので情報が増えないため
  • 複数行コメントの範囲の行番号を常に色付けする(comment_range.number_hl、両スタイル共通)
    • extmarkのnumber_hl_groupを使い、sign columnや本文の背景を使わない。gitsignsのサインやdiffの背景色と取り合わないようにするため
  • コメント行(範囲の最終行)にカーソルが乗っている間だけ、範囲を強調する
    • 範囲の行番号をcomment_range.cursor_number_hlに切り替え、開始行の行末に↓ comment L20-L29を出す
    • 💡ヒントと同じnamespaceに置き、ヒントと一緒に消える
    • 背景色(line_hl_group)での範囲ハイライトも試したが、diffの色を塗りつぶして読みづらくなったので採用しなかった
  • 3つの設定はどれもfalseで無効にできる

テスト計画

  • 既存テスト全パス(make all)
  • 新規テスト追加: tests/fude/comments_spec.lua(get_multiline_ranges)、tests/fude/ui_spec.lua(format_line_range、build_range_start_marker、見出しラベル)、tests/fude/extmarks_integration_spec.lua(行番号の色付け、カーソル連動の表示と解除、背景を使わないこと、各設定の無効化)
  • 手動確認: 複数行のpendingコメントがあるPRで、見出しラベル、行番号の色、カーソル連動の表示を確認した

備考

  • 行番号の色付けはnumber/relativenumberが無効だと見えない
  • カーソル連動の表示はヒントと同じく、コメント行に乗ったときだけ反応する。範囲の途中の行では出ない

Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 9, 2026 15:37
@kyu08
kyu08 marked this pull request as ready for review October 9, 2026 15:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

コメント更新後もカーソル範囲のextmarkが古い位置に残る問題を修正する必要があります。

3 open findings
What changed in this PR

複数行コメントの対象範囲を、見出し・行番号・カーソル連動マーカーで可視化する変更です。

Changes:

  • 複数行範囲の抽出・ラベル生成を追加
  • extmarkによる行番号強調と開始位置マーカーを追加
  • 設定、ドキュメント、単体・統合テストを更新
File Description
lua/​fude/​comments/​data.lua 複数行範囲の収集処理
lua/​fude/​comments.lua 範囲収集APIの公開
lua/​fude/​ui/​format.lua 範囲ラベルの整形
lua/​fude/​ui/​inline.lua コメント見出しへの範囲表示
lua/​fude/​ui/​extmarks.lua 行番号強調と開始マーカー
lua/​fude/​ui.lua 整形APIの公開
lua/​fude/​config.lua 表示設定の追加
tests/​fude/​comments_spec.lua 範囲収集テスト
tests/​fude/​ui_spec.lua ラベル・見出しテスト
tests/​fude/​extmarks_integration_spec.lua extmark統合テスト
README.md 設定例の追加
doc/​fude.txt ヘルプと設定仕様の追加
CLAUDE.md アーキテクチャ説明の更新

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lua/fude/ui/extmarks.lua
Comment thread README.md Outdated
Comment thread doc/fude.txt Outdated
Copilot AI balanced review requested due to automatic review settings October 9, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

同一バッファを複数ウィンドウで表示すると、非アクティブ側の再描画がカーソル連動ヒントを移動または消去します。

1 open finding
3 resolved since last review

🧠 Review effort: Balanced

Comment thread lua/fude/ui/extmarks.lua
Comment on lines +555 to +559
if current_hint.buf ~= buf then
return
end
M.clear_inline_hint()
M.update_inline_hint()
Copilot AI balanced review requested due to automatic review settings October 9, 2026 15:45
@kyu08
kyu08 merged commit 66adcf9 into main Oct 9, 2026
9 checks passed
@kyu08
kyu08 deleted the feat/comment-range-indicator branch October 9, 2026 15:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

複数windowで同一バッファを表示すると、非フォーカスwindowの再描画によってカーソル連動ヒントが誤った行へ移動します。

1 open finding

🧠 Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

複数行に対してのコメントの場合、コメント範囲がどこからどこまでかをわかるようにする

2 participants