Skip to content

Commit 58a7d07

Browse files
committed
refactor(diff): remove redundant line drop in DiffStreamHandler
Remove the unnecessary `dropLast(1)` operation on `value` since it is no longer needed for processing the code lines.
1 parent a9d0d7d commit 58a7d07

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

core/src/main/kotlin/cc/unitmesh/devti/diff/DiffStreamHandler.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ class DiffStreamHandler(
130130
suggestion.append(char)
131131
val code = CodeFence.parse(suggestion.toString())
132132
var value: List<String> = code.text.lines()
133-
value = value.dropLast(1)
134-
135133
if (value.isEmpty()) return@collect
136134

137135
val newLines = if (lastLineNo < value.size) {
@@ -170,7 +168,7 @@ class DiffStreamHandler(
170168
val newLines = newContent.lines()
171169

172170
isRunning = true
173-
cc.unitmesh.devti.util.AutoDevCoroutineScope.scope(project).launch {
171+
AutoDevCoroutineScope.scope(project).launch {
174172
streamDiff(lines, flowOf(*newLines.toTypedArray())).collect {
175173
ApplicationManager.getApplication().invokeLater {
176174
WriteCommandAction.runWriteCommandAction(project) {

0 commit comments

Comments
 (0)