Merge pull request #3607 from lkk214/fix/inlay-dispose-thread
fix: Clear all diff blocks before streaming and ensure dispose is run…
This commit is contained in:
commit
4fc564ae7c
2 changed files with 14 additions and 2 deletions
|
|
@ -469,6 +469,10 @@ class IdeProtocolClient(
|
|||
}
|
||||
|
||||
|
||||
val diffStreamService = project.service<DiffStreamService>()
|
||||
// Clear all diff blocks before running the diff stream
|
||||
diffStreamService.reject(editor)
|
||||
|
||||
val llmTitle = (llm as? Map<*, *>)?.get("title") as? String ?: ""
|
||||
|
||||
val prompt =
|
||||
|
|
@ -501,7 +505,6 @@ class IdeProtocolClient(
|
|||
rif?.range?.end?.line ?: (editor.document.lineCount - 1),
|
||||
{}, {})
|
||||
|
||||
val diffStreamService = project.service<DiffStreamService>()
|
||||
diffStreamService.register(diffStreamHandler, editor)
|
||||
|
||||
diffStreamHandler.streamDiffLinesToEditor(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.github.continuedev.continueintellijextension.editor
|
|||
import com.github.continuedev.continueintellijextension.utils.getAltKeyLabel
|
||||
import com.github.continuedev.continueintellijextension.utils.getShiftKeyLabel
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.invokeLater
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.LogicalPosition
|
||||
|
|
@ -11,6 +12,7 @@ import com.intellij.openapi.editor.markup.HighlighterLayer
|
|||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.ui.JBColor
|
||||
import com.intellij.util.application
|
||||
import java.awt.*
|
||||
import javax.swing.BorderFactory
|
||||
import javax.swing.JButton
|
||||
|
|
@ -41,7 +43,14 @@ class VerticalDiffBlock(
|
|||
}
|
||||
|
||||
fun clearEditorUI() {
|
||||
deletionInlay?.dispose()
|
||||
deletionInlay?.let {
|
||||
// Ensure that dispose is executed on EDT
|
||||
if (application.isDispatchThread) {
|
||||
it.dispose()
|
||||
} else {
|
||||
invokeLater { it.dispose() }
|
||||
}
|
||||
}
|
||||
removeGreenHighlighters()
|
||||
removeButtons()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue