File tree Expand file tree Collapse file tree 5 files changed +9
-6
lines changed
core/src/main/kotlin/cc/unitmesh/devti/provider
exts/devins-lang/src/main/resources/agent/toolExamples
java/src/main/kotlin/cc/unitmesh/idea/provider
javascript/src/main/kotlin/cc/unitmesh/ide/javascript/provider
kotlin/src/main/kotlin/cc/unitmesh/kotlin/provider Expand file tree Collapse file tree 5 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import com.intellij.lang.LanguageExtension
5
5
import com.intellij.openapi.project.Project
6
6
import com.intellij.psi.PsiElement
7
7
import com.intellij.psi.PsiFile
8
+ import com.intellij.psi.PsiNamedElement
8
9
9
10
/* *
10
11
* The `RelatedClassesProvider` interface is used to provide related classes for a given element.
@@ -28,10 +29,10 @@ interface RelatedClassesProvider {
28
29
*/
29
30
fun lookupIO (element : PsiElement ): List <PsiElement >
30
31
31
- fun lookupCallee (project : Project , element : PsiElement ): List <PsiElement > = emptyList()
32
-
33
32
fun lookupIO (element : PsiFile ): List <PsiElement >
34
33
34
+ fun lookupCallee (project : Project , element : PsiElement ): List <PsiNamedElement > = emptyList()
35
+
35
36
companion object {
36
37
private val languageExtension: LanguageExtension <RelatedClassesProvider > =
37
38
LanguageExtension (" cc.unitmesh.relatedClassProvider" )
Original file line number Diff line number Diff line change 1
- 从 API 调用链来进行分析
1
+ 从 API 调用链来进行分析,默认 depth = 2(不可修改),即 Controller 到 Repository 的调用链
2
2
/knowledge:GET#/api/blog/* [注:这里 * 代表 blog slug,等同于 SpringMVC 的 @PathVariable]
3
3
从 Controller 到 Repository 的调用链
4
4
/knowledge:BlogController#getBlogBySlug
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class JavaRelatedClassesProvider : RelatedClassesProvider {
27
27
}
28
28
}
29
29
30
- override fun lookupCallee (project : Project , element : PsiElement ): List <PsiElement > {
30
+ override fun lookupCallee (project : Project , element : PsiElement ): List <PsiNamedElement > {
31
31
return when (element) {
32
32
is PsiMethod -> findCallees(project, element)
33
33
else -> emptyList()
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import com.intellij.lang.javascript.psi.JSRecursiveWalkingElementVisitor
8
8
import com.intellij.openapi.project.Project
9
9
import com.intellij.psi.PsiElement
10
10
import com.intellij.psi.PsiFile
11
+ import com.intellij.psi.PsiNamedElement
11
12
12
13
class JavaScriptRelatedClassProvider : RelatedClassesProvider {
13
14
override fun lookupIO (element : PsiElement ): List <PsiElement > = JSTypeResolver .resolveByElement(element)
@@ -16,7 +17,7 @@ class JavaScriptRelatedClassProvider : RelatedClassesProvider {
16
17
override fun lookupCallee (
17
18
project : Project ,
18
19
element : PsiElement
19
- ): List <PsiElement > {
20
+ ): List <PsiNamedElement > {
20
21
return when (element) {
21
22
is JSFunction -> findCallees(project, element)
22
23
else -> emptyList()
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import cc.unitmesh.kotlin.util.KotlinTypeResolver
5
5
import com.intellij.openapi.project.Project
6
6
import com.intellij.psi.PsiElement
7
7
import com.intellij.psi.PsiFile
8
+ import com.intellij.psi.PsiNamedElement
8
9
import org.jetbrains.kotlin.idea.structuralsearch.visitor.KotlinRecursiveElementWalkingVisitor
9
10
import org.jetbrains.kotlin.psi.KtCallExpression
10
11
import org.jetbrains.kotlin.psi.KtNamedFunction
@@ -18,7 +19,7 @@ class KotlinRelatedClassProvider : RelatedClassesProvider {
18
19
return KotlinTypeResolver .resolveByElement(element).values.filterNotNull().toList()
19
20
}
20
21
21
- override fun lookupCallee (project : Project , element : PsiElement ): List <PsiElement > {
22
+ override fun lookupCallee (project : Project , element : PsiElement ): List <PsiNamedElement > {
22
23
return when (element) {
23
24
is KtNamedFunction -> findCallees(project, element)
24
25
else -> emptyList()
You can’t perform that action at this time.
0 commit comments