generated from JetBrains/intellij-platform-plugin-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: change inlay complete code trigger: use shortcut key instead of…
… automatic
- Loading branch information
1 parent
30b9757
commit 581e56d
Showing
6 changed files
with
68 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/cc/unitmesh/devti/actions/InlayCompleteCodeAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package cc.unitmesh.devti.actions | ||
|
||
import cc.unitmesh.devti.editor.inlay.LLMInlayManager | ||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.actionSystem.CommonDataKeys | ||
import com.intellij.openapi.command.CommandProcessor | ||
|
||
/** | ||
* A quick insight action is an action that can be triggered by a user, | ||
* user can input custom text to call with LLM. | ||
*/ | ||
class InlayCompleteCodeAction : AnAction() { | ||
override fun actionPerformed(e: AnActionEvent) { | ||
val dataContext = e.dataContext | ||
val editor = dataContext.getData(CommonDataKeys.EDITOR) ?: return | ||
val project = dataContext.getData(CommonDataKeys.PROJECT) ?: return | ||
if (project.isDisposed) return; | ||
|
||
val commandProcessor = CommandProcessor.getInstance() | ||
if (commandProcessor.isUndoTransparentActionInProgress) return | ||
|
||
val llmInlayManager = LLMInlayManager.getInstance() | ||
llmInlayManager.editorModified(editor) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters