FIR IDE: fix duplicating diagnostics collection
This commit is contained in:
+2
-8
@@ -54,16 +54,10 @@ internal class FileStructure(
|
|||||||
fun getAllDiagnosticsForFile(): Collection<Diagnostic> {
|
fun getAllDiagnosticsForFile(): Collection<Diagnostic> {
|
||||||
val containersForStructureElement = buildList {
|
val containersForStructureElement = buildList {
|
||||||
add(ktFile)
|
add(ktFile)
|
||||||
ktFile.forEachDescendantOfType<KtDeclaration>(
|
addAll(ktFile.declarations)
|
||||||
canGoInside = { psi -> psi !is KtFunction && psi !is KtValVarKeywordOwner }
|
|
||||||
) { declaration ->
|
|
||||||
if (FileStructureUtil.isStructureElementContainer(declaration)) {
|
|
||||||
add(declaration)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
val structureElements = containersForStructureElement.map(::getStructureElementFor)
|
val structureElements = containersForStructureElement.map(::getStructureElementFor)
|
||||||
return buildList {
|
return buildSet {
|
||||||
structureElements.forEach { it.diagnostics.forEach { diagnostics -> addAll(diagnostics) } }
|
structureElements.forEach { it.diagnostics.forEach { diagnostics -> addAll(diagnostics) } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user