Skip to content

Commit

Permalink
feat(rust): init context
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Aug 23, 2023
1 parent 4489358 commit 4e7cd19
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
Expand Up @@ -12,7 +12,15 @@ class RustClassContextBuilder : ClassContextBuilder {
if (psiElement !is RsStructOrEnumItemElement) return null
when (psiElement) {
is RsStructItem -> {
// TODO: Implement
return ClassContext(
psiElement,
psiElement.text,
psiElement.name,
emptyList(),
emptyList(),
emptyList(),
emptyList()
)
}

is RsEnumItem -> {
Expand Down
@@ -0,0 +1,16 @@
package cc.unitmesh.rust.provider

import cc.unitmesh.devti.provider.context.ChatContextItem
import cc.unitmesh.devti.provider.context.ChatContextProvider
import cc.unitmesh.devti.provider.context.ChatCreationContext
import com.intellij.openapi.project.Project

class RustContextProvider : ChatContextProvider {
override fun isApplicable(project: Project, creationContext: ChatCreationContext): Boolean {
return true
}

override suspend fun collect(project: Project, creationContext: ChatCreationContext): List<ChatContextItem> {
return listOf()
}
}
2 changes: 1 addition & 1 deletion rust/src/main/resources/cc.unitmesh.rust.xml
Expand Up @@ -15,6 +15,6 @@

<contextPrompter language="Rust" implementation="cc.unitmesh.rust.provider.RustContextPrompter"/>

<!-- <chatContextProvider implementation="cc.unitmesh.rust.provider.RustContextProvider"/>-->
<chatContextProvider implementation="cc.unitmesh.rust.provider.RustContextProvider"/>
</extensions>
</idea-plugin>

0 comments on commit 4e7cd19

Please sign in to comment.