File tree Expand file tree Collapse file tree 1 file changed +4
-17
lines changed
src/main/kotlin/io/runescript/plugin/lang/psi Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Original file line number Diff line number Diff line change 1
1
package io.runescript.plugin.lang.psi
2
2
3
- import com.intellij.openapi.project.Project
4
- import com.intellij.openapi.project.guessProjectDir
5
- import com.intellij.openapi.roots.ProjectFileIndex
3
+ import com.intellij.openapi.module.ModuleUtil
6
4
import com.intellij.psi.PsiElement
7
5
import com.intellij.psi.util.parentOfType
6
+ import io.runescript.plugin.ide.neptune.findNeptuneProjectRoot
8
7
9
8
val RsStatement .controlFlowHolder: RsControlFlowHolder ?
10
9
get() = parentOfType<RsControlFlowHolder >()
@@ -72,19 +71,7 @@ fun RsLocalVariableExpression.isForArrayAccess(): Boolean {
72
71
return parent is RsArrayAccessExpression && this == = parent.expressionList[0 ]
73
72
}
74
73
75
- fun Project.isRsProject (): Boolean {
76
- val file = guessProjectDir()?.findChild(" neptune.toml" )
77
- return file != null
78
- }
79
-
80
74
fun PsiElement.isSourceFile (): Boolean {
81
- if (! project.isRsProject()) {
82
- return false
83
- }
84
- val containingFile = containingFile?.virtualFile ? : return false
85
- val fileIndex = ProjectFileIndex .getInstance(project)
86
- if (fileIndex.isExcluded(containingFile)) {
87
- return false
88
- }
89
- return fileIndex.isInContent(containingFile)
75
+ val module = ModuleUtil .findModuleForFile(containingFile) ? : return false
76
+ return module.findNeptuneProjectRoot() != null
90
77
}
You can’t perform that action at this time.
0 commit comments