mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
gradle: resolve properties with closure type and related method calls
This commit is contained in:
+32
-20
@@ -207,38 +207,50 @@ class GradleExtensionsContributor : GradleMethodContextContributor {
|
||||
}
|
||||
}
|
||||
|
||||
if (!shouldProcessMethods && shouldProcessProperties && place is GrReferenceExpression && !place.isQualified) {
|
||||
for (gradleTask in extensionsData.tasks) {
|
||||
if (name == gradleTask.name) {
|
||||
if (name != null && place is GrReferenceExpression && !place.isQualified) {
|
||||
if (!shouldProcessMethods && shouldProcessProperties) {
|
||||
for (gradleTask in extensionsData.tasks) {
|
||||
if (name == gradleTask.name) {
|
||||
val docRef = Ref.create<String>()
|
||||
val variable = object : GrLightVariable(place.manager, name, gradleTask.typeFqn, place) {
|
||||
override fun getNavigationElement(): PsiElement {
|
||||
val navigationElement = super.getNavigationElement()
|
||||
navigationElement.putUserData(DOCUMENTATION, docRef.get())
|
||||
return navigationElement
|
||||
}
|
||||
}
|
||||
val doc = getDocumentation(gradleTask, variable)
|
||||
docRef.set(doc)
|
||||
place.putUserData(DOCUMENTATION, doc)
|
||||
if (!processor.execute(variable, state)) return false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val propExecutionResult = extensionsData.findProperty(name)?.let {
|
||||
if (!shouldProcessMethods && shouldProcessProperties) {
|
||||
val docRef = Ref.create<String>()
|
||||
val variable = object : GrLightVariable(place.manager, name, gradleTask.typeFqn, place) {
|
||||
val variable = object : GrLightVariable(place.manager, name, it.typeFqn, place) {
|
||||
override fun getNavigationElement(): PsiElement {
|
||||
val navigationElement = super.getNavigationElement()
|
||||
navigationElement.putUserData(DOCUMENTATION, docRef.get())
|
||||
return navigationElement
|
||||
}
|
||||
}
|
||||
val doc = getDocumentation(gradleTask, variable)
|
||||
val doc = getDocumentation(it, variable)
|
||||
docRef.set(doc)
|
||||
place.putUserData(DOCUMENTATION, doc)
|
||||
if (!processor.execute(variable, state)) return false
|
||||
break
|
||||
return processor.execute(variable, state)
|
||||
}
|
||||
}
|
||||
|
||||
val propExecutionResult = extensionsData.findProperty(name)?.let {
|
||||
val docRef = Ref.create<String>()
|
||||
val variable = object : GrLightVariable(place.manager, name, it.typeFqn, place) {
|
||||
override fun getNavigationElement(): PsiElement {
|
||||
val navigationElement = super.getNavigationElement()
|
||||
navigationElement.putUserData(DOCUMENTATION, docRef.get())
|
||||
return navigationElement
|
||||
else if (shouldProcessMethods && it.typeFqn == GROOVY_LANG_CLOSURE) {
|
||||
val returnClass = psiManager.createTypeByFQClassName(GROOVY_LANG_CLOSURE, resolveScope) ?: return true
|
||||
val methodBuilder = GrLightMethodBuilder(place.manager, name).apply {
|
||||
returnType = returnClass
|
||||
}
|
||||
return processor.execute(methodBuilder, state)
|
||||
}
|
||||
val doc = getDocumentation(it, variable)
|
||||
docRef.set(doc)
|
||||
place.putUserData(DOCUMENTATION, doc)
|
||||
processor.execute(variable, state)
|
||||
true
|
||||
}
|
||||
if(propExecutionResult != null && propExecutionResult) return false
|
||||
}
|
||||
|
||||
+3
-1
@@ -79,6 +79,8 @@ class ProjectExtensionsDataBuilderImpl implements ModelBuilderService {
|
||||
static String getType(object) {
|
||||
def clazz = object?.getClass()?.canonicalName
|
||||
def decorIndex = clazz?.lastIndexOf('_Decorated')
|
||||
!decorIndex || decorIndex == -1 ? clazz : clazz.substring(0, decorIndex)
|
||||
def result = !decorIndex || decorIndex == -1 ? clazz : clazz.substring(0, decorIndex)
|
||||
if(!result && object instanceof Closure) return "groovy.lang.Closure"
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user