mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-146198 Gradle: cannot resolve sourceSets
This commit is contained in:
+11
-1
@@ -55,6 +55,8 @@ class GradleJavaContributor : GradleMethodContextContributor {
|
||||
groovyClosure().withAncestor(2, sourceSetClosure),
|
||||
groovyClosure().inMethod(or(psiMethod(GRADLE_API_SOURCE_SET, "java"),
|
||||
psiMethod(GRADLE_API_SOURCE_SET, "resources"))))
|
||||
|
||||
val sourceDirectorySetClosureCandidate = groovyClosure().inMethod(psiMethodInClass(GRADLE_API_SOURCE_SET))
|
||||
}
|
||||
|
||||
override fun getDelegatesToInfo(closure: GrClosableBlock): DelegatesToInfo? {
|
||||
@@ -93,10 +95,18 @@ class GradleJavaContributor : GradleMethodContextContributor {
|
||||
if (!processor.execute(methodBuilder, state)) return false
|
||||
}
|
||||
}
|
||||
if (place.parent is GrReferenceExpression || psiElement.withTreeParent(sourceSetsClosure).accepts(place)) {
|
||||
|
||||
if (!psiElement.inside(sourceDirectorySetClosureCandidate).accepts(place)
|
||||
&& (place.parent is GrReferenceExpression || psiElement.withTreeParent(sourceSetsClosure).accepts(place))) {
|
||||
val variable = GrLightVariable(place.manager, name, GRADLE_API_SOURCE_SET, place)
|
||||
if (!processor.execute(variable, state)) return false
|
||||
}
|
||||
|
||||
if (psiElement.inside(sourceDirectorySetClosureCandidate).accepts(place)) {
|
||||
if (!GradleResolverUtil.processDeclarations(psiManager, processor, state, place, GRADLE_API_SOURCE_DIRECTORY_SET)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.scope.BaseScopeProcessor
|
||||
import com.intellij.psi.scope.ElementClassHint
|
||||
import com.intellij.psi.scope.NameHint.KEY
|
||||
import com.intellij.psi.scope.PsiScopeProcessor
|
||||
import org.jetbrains.plugins.groovy.lang.psi.patterns.GroovyPatterns
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
@@ -67,4 +68,6 @@ class ComponentProcessor(val delegate: PsiScopeProcessor, val place: PsiElement,
|
||||
else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun psiMethodInClass(containingClass: String) = GroovyPatterns.psiMethod().definedInClass(containingClass)
|
||||
Reference in New Issue
Block a user