@@ -7,18 +7,15 @@ import com.intellij.openapi.editor.ex.EditorEx
7
7
import com.intellij.openapi.project.Project
8
8
import com.intellij.openapi.vfs.LocalFileSystem
9
9
import com.intellij.openapi.vfs.VirtualFile
10
- import com.intellij.openapi.vfs.readText
11
- import ee.carlrobert.codegpt.CodeGPTKeys
12
10
import ee.carlrobert.codegpt.completions.AutoApplyParameters
13
11
import ee.carlrobert.codegpt.completions.CompletionRequestService
14
12
import ee.carlrobert.codegpt.toolwindow.chat.editor.ResponseEditorPanel
15
13
import ee.carlrobert.codegpt.toolwindow.chat.editor.ResponseEditorPanel.Companion.RESPONSE_EDITOR_STATE_KEY
16
- import ee.carlrobert.codegpt.toolwindow.chat.editor.RetryListener
14
+ import ee.carlrobert.codegpt.toolwindow.chat.editor.AutoApplyListener
17
15
import ee.carlrobert.codegpt.toolwindow.chat.editor.diff.DiffEditorManager
18
16
import ee.carlrobert.codegpt.toolwindow.chat.editor.factory.EditorFactory
19
17
import ee.carlrobert.codegpt.toolwindow.chat.parser.Code
20
18
import ee.carlrobert.codegpt.toolwindow.chat.parser.Segment
21
- import ee.carlrobert.codegpt.toolwindow.chat.parser.SseMessageParser
22
19
23
20
@Service(Service .Level .PROJECT )
24
21
class EditorStateManager (private val project : Project ) {
@@ -42,22 +39,13 @@ class EditorStateManager(private val project: Project) {
42
39
return state
43
40
}
44
41
45
- fun handleRetryForFailedSearch (replaceContent : String ) {
46
- val editor = currentState?.editor ? : return
47
- val virtualFile =
48
- CodeGPTKeys .TOOLWINDOW_EDITOR_FILE_DETAILS .get(editor)?.virtualFile ? : return
49
-
50
- getCodeEditsAsync(replaceContent, virtualFile, editor)
51
- }
52
-
53
42
fun getCodeEditsAsync (
54
43
content : String ,
55
44
virtualFile : VirtualFile ,
56
45
editor : EditorEx ,
57
46
) {
58
47
val params = AutoApplyParameters (content, virtualFile)
59
- val messageParser = SseMessageParser ()
60
- val listener = RetryListener (project, messageParser, this ) { newEditor ->
48
+ val listener = AutoApplyListener (project, this ) { newEditor ->
61
49
val responseEditorPanel = editor.component.parent as ? ResponseEditorPanel
62
50
? : throw IllegalStateException (" Expected parent to be ResponseEditorPanel" )
63
51
responseEditorPanel.replaceEditor(editor, newEditor)
0 commit comments