File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
model/src/main/kotlin/org/digma/intellij/plugin/ui/model/errors Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -42,22 +42,19 @@ class FlowStacks {
4242 private fun filterWorkspaceOnly (currentStack : List <ListViewItem <FrameListViewItem >>): List <ListViewItem <* >> {
4343
4444 val result = ArrayList <ListViewItem <* >>()
45+ var latestSpan: ListViewItem <FrameListViewItem >? = null
4546
4647 for (n in currentStack.withIndex()){
47-
4848 val toAdd =
4949 when (n.value.modelObject) {
5050 is FrameStackTitle -> {
5151 // always add FrameStackTitle
5252 n.value
5353 }
5454 is SpanTitle -> {
55- // check if we need to add this span title , if the frame following it has workspaceUri
56- val index = n.index
57- // element after span title must be FrameItem, if that fails then we have a bug when the list was built.
58- // if it fails on index out of bounds then we have a bug too
59- val frame: FrameItem = currentStack[index+ 1 ].modelObject as FrameItem
60- if (frame.isInWorkspace()) n.value else null
55+ // keep the latest span, we may need to add it if there is a frame under it that is in workspace
56+ latestSpan = n.value
57+ null
6158 }
6259 is FrameItem -> {
6360 val frame: FrameItem = n.value.modelObject as FrameItem
@@ -66,7 +63,11 @@ class FlowStacks {
6663 else -> throw RuntimeException (" Unknown modelObject ${n.value.modelObject} " )
6764 }
6865
69- if (toAdd != null ){
66+ if (toAdd != null ) {
67+ if (toAdd.modelObject is FrameItem && latestSpan != null ) {
68+ result.add(latestSpan)
69+ latestSpan = null
70+ }
7071 result.add(toAdd)
7172 }
7273
You can’t perform that action at this time.
0 commit comments