Changesets · Branches · Tags · Compare
| Changeset | 8daf96c029f5e119d16b888e552f75a2239a0d4ebc9993ee5c0ea77875dbdbdd |
|---|---|
| Author | Jakub Błach <jakubblach@gmail.com> · 2025-09-18 21:30 +02:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-18 12:30 -07:00 |
| Parents | 1bb8efeda114 |
2 files changed
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt +15 −17
| @@ -61,26 +61,13 @@ | ||
| 61 | 61 | |
| 62 | 62 | class FocusContinueInputWithoutClearAction : ContinueToolbarAction() { |
| 63 | 63 | override fun toolbarActionPerformed(project: Project) { |
| 64 | - project.getBrowser()?.sendToWebview("focusContinueInputWithoutClear") | |
| 65 | - project.getBrowser()?.focusOnInput() | |
| 64 | + FocusActionUtil.sendHighlightedCodeWithMessageToWebview(project, "focusContinueInputWithoutClear") | |
| 66 | 65 | } |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | 68 | class FocusContinueInputAction : ContinueToolbarAction() { |
| 70 | - override fun toolbarActionPerformed(project: Project) = | |
| 71 | - focusContinueInput(project) | |
| 72 | - | |
| 73 | - companion object { | |
| 74 | - fun focusContinueInput(project: Project?) { | |
| 75 | - val browser = project?.getBrowser() | |
| 76 | - ?: return | |
| 77 | - browser.sendToWebview("focusContinueInputWithNewSession") | |
| 78 | - browser.focusOnInput() | |
| 79 | - val rif = EditorUtils.getEditor(project)?.getHighlightedRIF() | |
| 80 | - ?: return | |
| 81 | - val code = HighlightedCodePayload(RangeInFileWithContents(rif.filepath, rif.range, rif.contents)) | |
| 82 | - browser.sendToWebview("highlightedCode", code) | |
| 83 | - } | |
| 69 | + override fun toolbarActionPerformed(project: Project) { | |
| 70 | + FocusActionUtil.sendHighlightedCodeWithMessageToWebview(project, "focusContinueInputWithNewSession") | |
| 84 | 71 | } |
| 85 | 72 | } |
| 86 | 73 | |
| @@ -115,5 +102,16 @@ | ||
| 115 | 102 | } |
| 116 | 103 | } |
| 117 | 104 | |
| 118 | - | |
| 105 | +object FocusActionUtil { | |
| 106 | + fun sendHighlightedCodeWithMessageToWebview(project: Project?, messageType: String) { | |
| 107 | + val browser = project?.getBrowser() | |
| 108 | + ?: return | |
| 109 | + browser.sendToWebview(messageType) | |
| 110 | + browser.focusOnInput() | |
| 111 | + val rif = EditorUtils.getEditor(project)?.getHighlightedRIF() | |
| 112 | + ?: return | |
| 113 | + val code = HighlightedCodePayload(RangeInFileWithContents(rif.filepath, rif.range, rif.contents)) | |
| 114 | + browser.sendToWebview("highlightedCode", code) | |
| 115 | + } | |
| 116 | +} | |
| 119 | 117 |
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToolTipComponent.kt +2 −2
| @@ -1,4 +1,4 @@ | ||
| 1 | -import com.github.continuedev.continueintellijextension.actions.FocusContinueInputAction | |
| 1 | +import com.github.continuedev.continueintellijextension.actions.FocusActionUtil | |
| 2 | 2 | import com.github.continuedev.continueintellijextension.editor.openInlineEdit |
| 3 | 3 | import com.intellij.openapi.editor.Editor |
| 4 | 4 | import com.intellij.openapi.editor.colors.EditorColorsManager |
| @@ -92,7 +92,7 @@ | ||
| 92 | 92 | editButton = StyledButton("Edit (${cmdCtrlChar}+I)") |
| 93 | 93 | |
| 94 | 94 | addToChatButton.addActionListener { e: ActionEvent? -> |
| 95 | - FocusContinueInputAction.focusContinueInput(editor.project) | |
| 95 | + FocusActionUtil.sendHighlightedCodeWithMessageToWebview(editor.project, "focusContinueInputWithNewSession") | |
| 96 | 96 | editor.contentComponent.remove(this) |
| 97 | 97 | } |
| 98 | 98 | editButton.addActionListener { e: ActionEvent? -> |