mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IJPL-160366 IDEA-104009 patch: fix typing latency in .patch files
GitOrigin-RevId: f832cf47c4558668988dd47be0bb4b60758d12dc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0beee36468
commit
cb94bd7cff
@@ -5,7 +5,10 @@ import com.intellij.diff.editor.DiffEditorViewerFileEditor
|
||||
import com.intellij.diff.requests.DiffRequest
|
||||
import com.intellij.diff.requests.ErrorDiffRequest
|
||||
import com.intellij.diff.requests.MessageDiffRequest
|
||||
import com.intellij.diff.tools.combined.*
|
||||
import com.intellij.diff.tools.combined.CombinedBlockProducer
|
||||
import com.intellij.diff.tools.combined.CombinedDiffComponentProcessor
|
||||
import com.intellij.diff.tools.combined.CombinedDiffManager
|
||||
import com.intellij.diff.tools.combined.CombinedDiffRegistry
|
||||
import com.intellij.diff.util.DiffUtil
|
||||
import com.intellij.ide.structureView.StructureViewBuilder
|
||||
import com.intellij.openapi.ListSelection
|
||||
@@ -36,9 +39,11 @@ import com.intellij.openapi.vcs.changes.ui.ChangeDiffRequestChain
|
||||
import com.intellij.openapi.vcs.changes.ui.MutableDiffRequestChainProcessor
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.SingleRootFileViewProvider
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue
|
||||
import com.intellij.util.ui.update.Update
|
||||
import com.intellij.util.ui.update.queueTracked
|
||||
import com.intellij.vcsUtil.VcsUtil
|
||||
import org.jetbrains.annotations.Nls
|
||||
import java.util.*
|
||||
|
||||
internal class DiffPatchFileEditorProvider : FileEditorProvider, StructureViewFileEditorProvider, DumbAware {
|
||||
/**
|
||||
@@ -63,7 +68,9 @@ internal class DiffPatchFileEditorProvider : FileEditorProvider, StructureViewFi
|
||||
processor.setBlocks(buildCombinedDiffModel(document))
|
||||
|
||||
val editor = DiffEditorViewerFileEditor(file, processor)
|
||||
document.addDocumentListener(CombinedViewerPatchChangeListener(processor), editor)
|
||||
|
||||
val updateQueue = MergingUpdateQueue("DiffPatchFileEditorProvider", 300, true, editor.component, editor)
|
||||
document.addDocumentListener(CombinedViewerPatchChangeListener(processor, updateQueue), editor)
|
||||
|
||||
return editor
|
||||
}
|
||||
@@ -72,7 +79,9 @@ internal class DiffPatchFileEditorProvider : FileEditorProvider, StructureViewFi
|
||||
val processor = MutableDiffRequestChainProcessor(project, chain)
|
||||
|
||||
val editor = DiffEditorViewerFileEditor(file, processor)
|
||||
document.addDocumentListener(RequestProcessorPatchChangeListener(processor), editor)
|
||||
|
||||
val updateQueue = MergingUpdateQueue("DiffPatchFileEditorProvider", 300, true, editor.component, editor)
|
||||
document.addDocumentListener(RequestProcessorPatchChangeListener(processor, updateQueue), editor)
|
||||
|
||||
return editor
|
||||
}
|
||||
@@ -110,15 +119,25 @@ private fun createDiffRequestProducers(document: Document): List<ChangeDiffReque
|
||||
}
|
||||
}
|
||||
|
||||
private class CombinedViewerPatchChangeListener(val processor: CombinedDiffComponentProcessor) : DocumentListener {
|
||||
private class CombinedViewerPatchChangeListener(
|
||||
val processor: CombinedDiffComponentProcessor,
|
||||
val queue: MergingUpdateQueue,
|
||||
) : DocumentListener {
|
||||
override fun documentChanged(event: DocumentEvent) {
|
||||
processor.setBlocks(buildCombinedDiffModel(event.document))
|
||||
queue.queueTracked(Update.create(this) {
|
||||
processor.setBlocks(buildCombinedDiffModel(event.document))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private class RequestProcessorPatchChangeListener(val processor: MutableDiffRequestChainProcessor) : DocumentListener {
|
||||
private class RequestProcessorPatchChangeListener(
|
||||
val processor: MutableDiffRequestChainProcessor,
|
||||
val queue: MergingUpdateQueue,
|
||||
) : DocumentListener {
|
||||
override fun documentChanged(event: DocumentEvent) {
|
||||
processor.chain = PatchDiffRequestChain(event.document)
|
||||
queue.queueTracked(Update.create(this) {
|
||||
processor.chain = PatchDiffRequestChain(event.document)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user