Fix displaying diff line when instant applying in jetbrains extensions (#10627)

This commit is contained in:
Pyroboomka 2026-03-10 10:19:19 +03:00 • committed by GitHub
parent 37e86e18a1
commit 86b074e3e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -247,7 +247,7 @@ class DiffStreamHandler(
currentBlock = createDiffBlock()
currentBlock!!.startLine = currentLine
}
currentBlock!!.addedLines.add(text)
currentBlock.addNewLineForHighlightOnly(text, currentLine);
currentLine++
}
DiffLineType.SAME -> {

View file

@ -91,6 +91,13 @@ class VerticalDiffBlock(
addedLines.add(text)
}
fun addNewLineForHighlightOnly(text: String, line: Int) {
val greenKey = EditorUtils(editor).createTextAttributesKey("CONTINUE_DIFF_NEW_LINE", 0x3000FF00)
editor.markupModel.addLineHighlighter(greenKey, line, HighlighterLayer.LAST)
addedLines.add(text)
}
fun onLastDiffLine() {
// Handles the case where we are invoking one last time on last line of diff stream, but the block has
// already been rendered