Skip to content

Commit 6136ed5

Browse files
committed
feat(provider): add DevInsCompletionProvider and modify references #101
This commit adds a new interface `DevInsCompletionProvider` and modifies the references accordingly. The `DevInsCompletionProvider` interface is used to lookup canonical names for different languages. This change also includes modifications to import statements and file locations to match the new structure.
1 parent 12ee328 commit 6136ed5

File tree

6 files changed

+43
-8
lines changed

6 files changed

+43
-8
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/provider/DevInsCustomAgentResponse.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import cc.unitmesh.devti.AutoDevNotifications
44
import cc.unitmesh.devti.language.DevInLanguage
55
import cc.unitmesh.devti.language.compiler.DevInsCompiler
66
import cc.unitmesh.devti.language.psi.DevInFile
7-
import cc.unitmesh.devti.provider.custom.AgentResponseProvider
8-
import cc.unitmesh.devti.provider.custom.CustomAgentContext
7+
import cc.unitmesh.devti.provider.devins.AgentResponseProvider
8+
import cc.unitmesh.devti.provider.devins.CustomAgentContext
99
import com.intellij.openapi.project.Project
1010
import com.intellij.psi.PsiFileFactory
1111
import java.util.*

src/222/main/resources/META-INF/autodev-core.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,15 @@
160160
interface="cc.unitmesh.devti.provider.context.ChatContextProvider"
161161
dynamic="true"/>
162162

163+
163164
<extensionPoint qualifiedName="cc.unitmesh.customAgentResponse"
164-
interface="cc.unitmesh.devti.provider.custom.AgentResponseProvider"
165+
interface="cc.unitmesh.devti.provider.devins.AgentResponseProvider"
165166
dynamic="true"/>
167+
168+
<extensionPoint qualifiedName="cc.unitmesh.customDevInsCompletionProvider"
169+
beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
170+
<with attribute="implementationClass" implements="cc.unitmesh.devti.provider.devins.DevInsCompletionProvider"/>
171+
</extensionPoint>
166172
</extensionPoints>
167173

168174
<applicationListeners>

src/233/main/resources/META-INF/autodev-core.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,13 @@
161161
dynamic="true"/>
162162

163163
<extensionPoint qualifiedName="cc.unitmesh.customAgentResponse"
164-
interface="cc.unitmesh.devti.provider.custom.AgentResponseProvider"
164+
interface="cc.unitmesh.devti.provider.devins.AgentResponseProvider"
165165
dynamic="true"/>
166+
167+
<extensionPoint qualifiedName="cc.unitmesh.customDevInsCompletionProvider"
168+
beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
169+
<with attribute="implementationClass" implements="cc.unitmesh.devti.provider.devins.DevInsCompletionProvider"/>
170+
</extensionPoint>
166171
</extensionPoints>
167172

168173
<applicationListeners>

src/main/kotlin/cc/unitmesh/devti/agent/CustomAgentChatProcessor.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ import cc.unitmesh.devti.gui.chat.ChatCodingPanel
88
import cc.unitmesh.devti.gui.chat.ChatRole
99
import cc.unitmesh.devti.llms.LLMProvider
1010
import cc.unitmesh.devti.provider.ContextPrompter
11-
import cc.unitmesh.devti.provider.custom.AgentResponseProvider
12-
import cc.unitmesh.devti.provider.custom.CustomAgentContext
11+
import cc.unitmesh.devti.provider.devins.AgentResponseProvider
12+
import cc.unitmesh.devti.provider.devins.CustomAgentContext
1313
import cc.unitmesh.devti.util.LLMCoroutineScope
1414
import cc.unitmesh.devti.util.parser.Code
1515
import com.intellij.openapi.components.Service
1616
import com.intellij.openapi.components.service
1717
import com.intellij.openapi.diagnostic.logger
1818
import com.intellij.openapi.project.Project
1919
import kotlinx.coroutines.launch
20-
import kotlinx.coroutines.flow.collect
2120
import kotlinx.coroutines.runBlocking
2221

2322
@Service(Service.Level.PROJECT)

src/main/kotlin/cc/unitmesh/devti/provider/custom/AgentResponseProvider.kt renamed to src/main/kotlin/cc/unitmesh/devti/provider/devins/AgentResponseProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cc.unitmesh.devti.provider.custom
1+
package cc.unitmesh.devti.provider.devins
22

33
import cc.unitmesh.devti.agent.model.CustomAgentConfig
44
import com.intellij.openapi.extensions.ExtensionPointName
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package cc.unitmesh.devti.provider.devins
2+
3+
import com.intellij.codeInsight.completion.CompletionParameters
4+
import com.intellij.codeInsight.lookup.LookupElement
5+
import com.intellij.lang.Language
6+
import com.intellij.lang.LanguageExtension
7+
import com.intellij.openapi.project.Project
8+
import com.intellij.psi.PsiElement
9+
10+
interface DevInsCompletionProvider {
11+
12+
/**
13+
* Lookup canonical name for different language
14+
*/
15+
fun lookupSymbol(project: Project, parameters: CompletionParameters, element: PsiElement): Iterable<LookupElement>
16+
17+
companion object {
18+
private val languageExtension: LanguageExtension<DevInsCompletionProvider> =
19+
LanguageExtension("cc.unitmesh.customDevInsCompletionProvider")
20+
21+
fun forLanguage(language: Language): DevInsCompletionProvider? {
22+
return languageExtension.forLanguage(language)
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)