Android Extensions: support identifiers with packages (KT-10841)

This commit is contained in:
Yan Zhulanow
2016-03-25 16:25:09 +03:00
parent 0494e1d258
commit 9e33b7d3bc
10 changed files with 64 additions and 32 deletions
@@ -36,6 +36,6 @@ class AndroidSimpleNameReferenceExtension : SimpleNameReferenceExtension {
if (resolvedElement !is XmlAttributeValue || !AndroidResourceUtil.isIdDeclaration(resolvedElement)) return null
val newSyntheticPropertyName = androidIdToName(newElementName) ?: return null
return psiFactory.createNameIdentifier(newSyntheticPropertyName)
return psiFactory.createNameIdentifier(newSyntheticPropertyName.name)
}
}
@@ -24,8 +24,9 @@ import com.intellij.psi.xml.XmlTag
import org.jetbrains.kotlin.android.synthetic.AndroidConst
import org.jetbrains.kotlin.android.synthetic.androidIdToName
import org.jetbrains.kotlin.android.synthetic.isWidgetTypeIgnored
import org.jetbrains.kotlin.android.synthetic.res.ResourceIdentifier
class AndroidXmlVisitor(val elementCallback: (String, String, XmlAttribute) -> Unit) : XmlElementVisitor() {
class AndroidXmlVisitor(val elementCallback: (ResourceIdentifier, String, XmlAttribute) -> Unit) : XmlElementVisitor() {
override fun visitElement(element: PsiElement) {
element.acceptChildren(this)
@@ -84,7 +84,7 @@ class IDEAndroidLayoutXmlFileManager(val module: Module) : AndroidLayoutXmlFileM
val attributes = arrayListOf<PsiElement>()
val visitor = AndroidXmlVisitor { retId, wClass, valueElement ->
if (retId == propertyName) attributes.add(valueElement)
if (retId.name == propertyName) attributes.add(valueElement)
}
layoutFiles.forEach { it.accept(visitor) }