mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-10 12:10:14 +00:00
fix: toolwindow response editor diff action
This commit is contained in:
parent
516183ee3f
commit
2c68d2e1be
1 changed files with 4 additions and 13 deletions
|
|
@ -27,23 +27,14 @@ object EditorDiffUtil {
|
|||
val mainEditor = project.service<FileEditorManager>().selectedTextEditor ?: return
|
||||
val mainEditorFile =
|
||||
service<FileDocumentManager>().getFile(mainEditor.document) ?: return
|
||||
val tempFile = createTempDiffFile(mainEditor, toolwindowEditor, highlightedText)
|
||||
val tempFile = LightVirtualFile(
|
||||
mainEditorFile.name,
|
||||
createTempDiffContent(mainEditor, toolwindowEditor, highlightedText)
|
||||
)
|
||||
DiffManager.getInstance()
|
||||
.showDiff(project, createDiffRequest(project, tempFile, mainEditor, mainEditorFile))
|
||||
}
|
||||
|
||||
private fun createTempDiffFile(
|
||||
mainEditor: Editor,
|
||||
toolwindowEditor: Editor,
|
||||
highlightedText: String
|
||||
): VirtualFile {
|
||||
val diffContent = createTempDiffContent(mainEditor, toolwindowEditor, highlightedText)
|
||||
val toolwindowEditorFile =
|
||||
service<FileDocumentManager>().getFile(toolwindowEditor.document)
|
||||
?: throw IllegalStateException("Toolwindow editor file not found")
|
||||
return LightVirtualFile("content_diff_${toolwindowEditorFile.name}", diffContent)
|
||||
}
|
||||
|
||||
private fun createTempDiffContent(
|
||||
mainEditor: Editor,
|
||||
toolwindowEditor: Editor,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue