Neovim 0.12 互換: JSON null (vim.NIL) チェックの統一#112
Merged
Conversation
…ompat Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Neovim 0.12 で vim.json.decode が JSON null を vim.NIL(truthy)として返す変更に対応するため、nil のみを前提にした既存の null 判定を is_null ヘルパーに統一し、0.11/0.12 両対応の挙動に揃えるPRです。
Changes:
lua/fude/util.luaを追加し、nilとvim.NILを同一視するis_null(v)を導入lua/fude/comments/data.lua/lua/fude/comments/sync.luaのnilチェックをis_nullベースに置換し、vim.NILの truthy 罠を回避vim.NILケースをカバーするテストを追加(tests/fude/util_spec.lua、tests/fude/comments_spec.lua)
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lua/fude/util.lua | nil/vim.NIL を統一的に判定する is_null を追加 |
| lua/fude/comments/data.lua | line/original_line/in_reply_to_id 等の null 判定を is_null に統一 |
| lua/fude/comments/sync.lua | pending review comment の line 解決条件を is_null で正しく判定 |
| tests/fude/util_spec.lua | is_null の単体テストを追加 |
| tests/fude/comments_spec.lua | vim.NIL を含むコメントデータのフォールバック/スキップ等のテストを追加 |
| CLAUDE.md | util.lua と is_null の役割を開発ドキュメントに追記 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
Neovim 0.12 では
vim.json.decodeが JSON null をvim.NILとして返すようになった。fude.nvim の複数箇所でnilのみチェックしておりvim.NIL(truthy)を考慮していなかったため、is_nullヘルパーで統一的に修正。Neovim 0.11/0.12 両対応。変更内容
lua/fude/util.luaを新規作成し、is_null(v)ヘルパーを定義(nilとvim.NILの両方を検出)comments/data.luaの 6 箇所をis_nullで置き換え:line_from_diff_hunk: 引数の null チェックbuild_comment_map:lineフォールバックと null ガードget_comment_thread:in_reply_to_idのルート判定(2箇所)build_pending_comments_from_review:line/start_lineフォールバックget_reply_target_id:in_reply_to_idの truthy チェックis_outdated_comment:is_nullで簡潔化comments/sync.luaのfetch_comments内でc.line/c.original_lineの null チェックを修正テスト計画
make all)tests/fude/util_spec.lua(8テスト),tests/fude/comments_spec.lua(8テスト追加)備考
pull_request_review_id == pending_review_idの比較は変更不要と判断。vim.NIL == numberはfalseを返し、「ペンディングレビューに属さない」という正しい結果になるためui/format.luaは既にtype(entry.line) == "number"で型チェック済みのため変更不要Generated with Claude Code