Repository navigation
Conversation
Collaborator
|
Hi @hektor, did you close it because it's duplicate of #587 and #593? A word of explanation would actually be helpful. And since this is the third such PR in a row, it would be helpful if people helped to figure out why this has started happening - where do these "incomplete" line ranges come from? My guess is that they are created by AI agents. |
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.
Opening a review that has an unsubmitted draft note with a multi-line range crashes when the commented file's buffer enters a diffview window:
The error is raised inside the
DiffviewDiffBufWinEnterautocmd, so it propagates out of diffview'snvim_win_calland tears down the whole async chain — selecting that entry in the file panel fails with a wall of tracebacks, and the file never opens.Cause
get_line_numbers_for_rangederives the range purely from the two line codes. Thedraft_notesAPI leavesline_codeempty insideline_range, and only fills in the line numbers:parse_line_code("")returnsnil, nil, sonew_end_line - new_start_lineis arithmetic onnil. (PositionInfo.line_codeis already annotated as optional inannotations.lua.)Fix
get_line_numbers_for_rangenow takes the twoPositionInfotables instead of two line-code strings, and resolves each end withparse_range_end: parse the line code, fall back to theold_line/new_linethe range end already carries. Both call sites (get_line_number_from_node,create_multiline_diagnostic) pass the tables.Testing
tests/spec/common_line_range_spec.luacovers a NEW SHA range, an OLD SHA range, and the draft-note range with empty line codes. Suite goes 69 → 72, all passing.stylua --check .andluacheckare clean.Verified against a real MR with two draft notes (lines 28 and 495–500): before the change, opening that file crashed; after, the diagnostics land at
lnum=27 end_lnum=27andlnum=494 end_lnum=499.