From 5434b4290d3735f32a86d31e9dff44611c9dc156 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Wed, 19 Jul 2023 15:13:44 +0800 Subject: [PATCH] feat: init llm inlay manager --- .../unitmesh/devti/editor/LLMInlayManager.kt | 26 +++++++++++++++++++ .../devti/editor/LLMInlayManagerImpl.kt | 19 ++++++++++++++ src/main/resources/META-INF/autodev-core.xml | 3 +++ 3 files changed, 48 insertions(+) create mode 100644 src/main/kotlin/cc/unitmesh/devti/editor/LLMInlayManager.kt create mode 100644 src/main/kotlin/cc/unitmesh/devti/editor/LLMInlayManagerImpl.kt diff --git a/src/main/kotlin/cc/unitmesh/devti/editor/LLMInlayManager.kt b/src/main/kotlin/cc/unitmesh/devti/editor/LLMInlayManager.kt new file mode 100644 index 0000000000..3229e586af --- /dev/null +++ b/src/main/kotlin/cc/unitmesh/devti/editor/LLMInlayManager.kt @@ -0,0 +1,26 @@ +package cc.unitmesh.devti.editor + +import com.intellij.openapi.Disposable +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.project.Project +import com.intellij.util.concurrency.annotations.RequiresEdt + +interface LLMInlayManager : Disposable { + override fun dispose() {} + + @RequiresEdt + fun isAvailable(editor: Editor): Boolean + + @RequiresEdt + fun applyCompletion(project: Project, editor: Editor) + + @RequiresEdt + fun disposeInlays(editor: Editor) + + companion object { + fun getInstance(): LLMInlayManager { + return ApplicationManager.getApplication().getService(LLMInlayManager::class.java) + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/cc/unitmesh/devti/editor/LLMInlayManagerImpl.kt b/src/main/kotlin/cc/unitmesh/devti/editor/LLMInlayManagerImpl.kt new file mode 100644 index 0000000000..0ae290a448 --- /dev/null +++ b/src/main/kotlin/cc/unitmesh/devti/editor/LLMInlayManagerImpl.kt @@ -0,0 +1,19 @@ +package cc.unitmesh.devti.editor + +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.project.Project + +class LLMInlayManagerImpl : LLMInlayManager { + override fun isAvailable(editor: Editor): Boolean { + return false + } + + override fun applyCompletion(project: Project, editor: Editor) { + return + } + + override fun disposeInlays(editor: Editor) { + return + } + +} diff --git a/src/main/resources/META-INF/autodev-core.xml b/src/main/resources/META-INF/autodev-core.xml index 0c6a720d80..56f49e3f24 100644 --- a/src/main/resources/META-INF/autodev-core.xml +++ b/src/main/resources/META-INF/autodev-core.xml @@ -9,6 +9,9 @@ id="cc.unitmesh.devti.settings.AutoDevSettingsConfigurable" displayName="AutoDev"/> +