1+ package oap.application.plugin.ref
2+
3+ import com.intellij.codeInspection.LocalInspectionTool
4+ import com.intellij.codeInspection.ProblemHighlightType
5+ import com.intellij.codeInspection.ProblemsHolder
6+ import com.intellij.openapi.project.Project
7+ import com.intellij.psi.PsiElement
8+ import com.intellij.psi.PsiElementVisitor
9+ import com.intellij.psi.stubs.StubIndex
10+ import oap.application.plugin.gen.psi.OapModuleDependsOnName
11+ import oap.application.plugin.psi.ModuleUtils
12+ import oap.application.plugin.stub.OapModuleNameIndex
13+
14+ class ValidParametersInspection : LocalInspectionTool () {
15+ override fun buildVisitor (holder : ProblemsHolder , isOnTheFly : Boolean ): PsiElementVisitor {
16+ return object : PsiElementVisitor () {
17+ override fun visitElement (element : PsiElement ) {
18+ if (element is OapModuleDependsOnName ) {
19+ // val project: Project = element.project
20+ //
21+ // var allKeys: Collection<String> = StubIndex.getInstance().getAllKeys(OapModuleNameIndex.KEY, project)
22+ //
23+ // val moduleName: String? = element.text
24+ //
25+ // val thisModuleName: String? = ModuleUtils.getModuleName(element.containingFile)
26+ //
27+ // if (thisModuleName != null && thisModuleName == moduleName) {
28+ // holder.registerProblem(
29+ // element,
30+ // "Cycle reference to self",
31+ // ProblemHighlightType.ERROR
32+ // )
33+ // }
34+ //
35+ // if (!allKeys.contains(moduleName)) {
36+ // holder.registerProblem(
37+ // element,
38+ // "Module '${moduleName ?: ""}' not found",
39+ // ProblemHighlightType.ERROR
40+ // )
41+ // }
42+ } else {
43+ super .visitElement(element)
44+ }
45+ }
46+ }
47+ }
48+ }
0 commit comments