File tree Expand file tree Collapse file tree 5 files changed +50
-2
lines changed
kotlin/cc/unitmesh/python/indexer/provider
kotlin/cc/unitmesh/rust/context
main/kotlin/cc/unitmesh/rust/indexer/provider Expand file tree Collapse file tree 5 files changed +50
-2
lines changed Original file line number Diff line number Diff line change
1
+ package cc.unitmesh.python.indexer.provider
2
+
3
+ import cc.unitmesh.devti.indexer.provider.LangDictProvider
4
+ import com.intellij.openapi.application.runReadAction
5
+ import com.intellij.openapi.project.Project
6
+ import com.intellij.psi.search.FileTypeIndex
7
+ import com.intellij.psi.search.ProjectScope
8
+ import com.jetbrains.python.PythonFileType
9
+
10
+ class PythonLangDictProvider : LangDictProvider {
11
+ override suspend fun collectFileNames (project : Project ): List <String > {
12
+ val searchScope = ProjectScope .getProjectScope(project)
13
+ val javaFiles = runReadAction {
14
+ FileTypeIndex .getFiles(PythonFileType .INSTANCE , searchScope)
15
+ }
16
+
17
+ val filenames = javaFiles.mapNotNull {
18
+ it.nameWithoutExtension
19
+ }
20
+
21
+ return filenames
22
+ }
23
+ }
Original file line number Diff line number Diff line change 30
30
<relatedClassProvider
31
31
language =" Python"
32
32
implementationClass =" cc.unitmesh.python.provider.PythonRelatedClassProvider" />
33
+
34
+ <langDictProvider implementation =" cc.unitmesh.python.indexer.provider.PythonLangDictProvider" />
33
35
</extensions >
34
36
</idea-plugin >
Original file line number Diff line number Diff line change @@ -12,8 +12,6 @@ import org.rust.lang.core.psi.RsStructItem
12
12
import org.rust.lang.core.psi.ext.RsStructOrEnumItemElement
13
13
import org.rust.lang.core.psi.ext.expandedFields
14
14
import org.rust.lang.core.psi.ext.implementingType
15
- import org.rust.lang.core.types.asTy
16
- import org.rust.lang.core.types.implLookup
17
15
18
16
class RustClassContextBuilder : ClassContextBuilder {
19
17
override fun getClassContext (psiElement : PsiElement , gatherUsages : Boolean ): ClassContext ? {
Original file line number Diff line number Diff line change 22
22
23
23
<testContextProvider language =" Rust" implementation =" cc.unitmesh.rust.provider.RustTestService" />
24
24
<codeModifier language =" Rust" implementationClass =" cc.unitmesh.rust.provider.RustCodeModifier" />
25
+
26
+ <langDictProvider implementation =" cc.unitmesh.rust.indexer.provider.RustLangDictProvider" />
25
27
</extensions >
26
28
</idea-plugin >
Original file line number Diff line number Diff line change
1
+ package cc.unitmesh.rust.indexer.provider
2
+
3
+ import cc.unitmesh.devti.indexer.provider.LangDictProvider
4
+ import com.intellij.openapi.application.runReadAction
5
+ import com.intellij.openapi.project.Project
6
+ import com.intellij.psi.search.FileTypeIndex
7
+ import com.intellij.psi.search.ProjectScope
8
+ import org.rust.lang.RsFileType
9
+
10
+ class RustLangDictProvider : LangDictProvider {
11
+ override suspend fun collectFileNames (project : Project ): List <String > {
12
+ val searchScope = ProjectScope .getProjectScope(project)
13
+ val javaFiles = runReadAction {
14
+ FileTypeIndex .getFiles(RsFileType , searchScope)
15
+ }
16
+
17
+ val filenames = javaFiles.mapNotNull {
18
+ it.nameWithoutExtension
19
+ }
20
+
21
+ return filenames
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments