mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[devkit] IJPL-194034: Do not report descriptor included via xi:included
GitOrigin-RevId: 85716b6370296b21f8feb51cb821c3bde94a783f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0da95d5974
commit
3166bc2b01
+12
-1
@@ -15,7 +15,11 @@ import com.intellij.openapi.roots.ModuleRootManager
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import com.intellij.psi.XmlElementVisitor
|
||||
import com.intellij.psi.createSmartPointer
|
||||
import com.intellij.psi.search.searches.ReferencesSearch
|
||||
import com.intellij.psi.util.parentOfType
|
||||
import com.intellij.psi.xml.XmlFile
|
||||
import com.intellij.psi.xml.XmlTag
|
||||
import com.intellij.xml.util.XmlUtil
|
||||
import org.jetbrains.idea.devkit.DevKitBundle
|
||||
import org.jetbrains.idea.devkit.dom.index.PluginIdDependenciesIndex
|
||||
import org.jetbrains.idea.devkit.util.DescriptorUtil
|
||||
@@ -26,7 +30,7 @@ internal class ModuleNotRegisteredAsPluginContentInspection : LocalInspectionToo
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
||||
return object : XmlElementVisitor() {
|
||||
override fun visitXmlFile(file: XmlFile) {
|
||||
if (DescriptorUtil.isPluginModuleFile(file) && isNotReferencedAsContentModule(file)) {
|
||||
if (DescriptorUtil.isPluginModuleFile(file) && isNotReferencedAsContentModule(file) && isNotXIncluded(file)) {
|
||||
val moduleName = getModuleName(file)
|
||||
holder.registerProblem(
|
||||
file,
|
||||
@@ -47,6 +51,13 @@ internal class ModuleNotRegisteredAsPluginContentInspection : LocalInspectionToo
|
||||
return PluginIdDependenciesIndex.findFilesIncludingContentModule(xmlFile.project, moduleVirtualFile).isEmpty()
|
||||
}
|
||||
|
||||
private fun isNotXIncluded(file: XmlFile): Boolean {
|
||||
return !ReferencesSearch.search(file).anyMatch {
|
||||
val xmlTag = it.element.parentOfType<XmlTag>() ?: return@anyMatch false
|
||||
xmlTag.namespace == XmlUtil.XINCLUDE_URI && xmlTag.localName == "include"
|
||||
}
|
||||
}
|
||||
|
||||
private fun fixIfPluginXmlFound(file: XmlFile, moduleName: String): Array<out LocalQuickFix> {
|
||||
val (pluginXmlFile, pluginId) = findParentModuleWithPluginXml(file) ?: return LocalQuickFix.EMPTY_ARRAY
|
||||
return arrayOf(AddAsContentModuleFix(pluginXmlFile.createSmartPointer(), pluginId, moduleName))
|
||||
|
||||
Reference in New Issue
Block a user