@@ -14,7 +14,6 @@ import com.intellij.openapi.editor.EditorCustomElementRenderer
14
14
import com.intellij.openapi.editor.Inlay
15
15
import com.intellij.openapi.editor.ex.EditorEx
16
16
import com.intellij.openapi.editor.impl.ImaginaryEditor
17
- import com.intellij.openapi.extensions.ExtensionPoint
18
17
import com.intellij.openapi.fileEditor.FileDocumentSynchronizationVetoer
19
18
import com.intellij.openapi.project.Project
20
19
import com.intellij.openapi.util.Disposer
@@ -30,7 +29,6 @@ class LLMInlayManagerImpl : LLMInlayManager {
30
29
companion object {
31
30
private val logger = logger<LLMInlayManagerImpl >()
32
31
private val KEY_LAST_REQUEST = Key .create<CodeCompletionRequest >(" llm.editorRequest" )
33
- val KEY_DOCUMENT_SAVE_VETO = Key .create<Boolean >(" llm.docSaveVeto" )
34
32
private val KEY_PROCESSING = KeyWithDefaultValue .create(" llm.processing" , false )
35
33
private val KEY_EDITOR_SUPPORTED = Key .create<Boolean >(" llm.editorSupported" )
36
34
}
@@ -66,32 +64,16 @@ class LLMInlayManagerImpl : LLMInlayManager {
66
64
if (project.isDisposed) return @runWriteCommandAction
67
65
val document = editor.document
68
66
try {
69
- KEY_DOCUMENT_SAVE_VETO [document] = true
70
- wrapWithTemporarySaveVetoHandler {
71
- document.insertString(request.offset, currentCompletion)
72
- editor.caretModel.moveToOffset(request.offset + currentCompletion.length)
73
- return @wrapWithTemporarySaveVetoHandler
74
- }
67
+ document.insertString(request.offset, currentCompletion)
68
+ editor.caretModel.moveToOffset(request.offset + currentCompletion.length)
75
69
} finally {
76
- KEY_DOCUMENT_SAVE_VETO [document] = null
70
+ //
77
71
}
78
72
})
79
73
80
74
return true
81
75
}
82
76
83
- @Suppress(" UnstableApiUsage" )
84
- private fun wrapWithTemporarySaveVetoHandler (runnable : Runnable ) {
85
- val disposable = Disposer .newDisposable()
86
- try {
87
- val ep = ApplicationManager .getApplication().getExtensionArea()
88
- .getExtensionPoint(FileDocumentSynchronizationVetoer .EP_NAME )
89
- ep.registerExtension(LLMEditorSaveVetoer (), disposable)
90
- runnable.run ()
91
- } finally {
92
- Disposer .dispose(disposable)
93
- }
94
- }
95
77
96
78
@RequiresEdt
97
79
override fun collectInlays (editor : Editor , startOffset : Int , endOffset : Int ): List <LLMInlayRenderer > {
0 commit comments