Questions about structure view
Hi,
I implemented a structure view in my custom language plugin, but I have two questions related to this:
- my StructureViewModel implements StructureViewModel.ExpandInfoProvider to automatically collapse certains nodes, but why does it only work in the structure tool window, not the popup?
- how can I add more than one color in a StructureViewTreeElement's label? It seems that PresentationData supports it via its myColoredText attribute, but it's never populated in PresentationData.updateFrom(ItemPresentation presentation)
For the second question, it seems that the only way to achieve this is to create a whole new component for the structure view, I didn't find any way to override TreeElementWrapper#update(PresentationData presentation).
Perhaps you could add a method named getColoredFragments() in ColoredItemPresentation, or add a new interface like ColoredFragmentAware, and handle this change in PresentationData.updateFrom(ItemPresentation presentation) ?
请先登录再写评论。
In relation to question1: I also created a InheritedMembersNodeProvider to show parent members, but they are only shown in the tool window, not in the popup?!
Also, I noticed a strange thing: I have a filter that implements FileStructureFilter, so that it's also shown in the structure popup. Note that this filter is not reverted. Now, when I open the structure popup, the nodes matched by the filters are not displayed, although the checkbox is not checked. The correct behaviour should be: the nodes shouldn't be displayed only if the checkbox is checked (unless the filter is reverted).
I traced it down to FileStructurePopup#addCheckbox(JPanel, TreeAction), which assumes the filter is always reverted:
Hello Bastien!
Good catch! Also, I think we should add extra check a few lines below as well. Take a look at the patch attached
Attachment(s):
fix_FileStructurePopup_for_non-reverted_File_Structure_Filters.patch.zip
Yes, I saw that too. I submitted an issue to track the bug and a created a PR a few hours ago to fix it:
https://youtrack.jetbrains.com/issue/IDEA-142411
https://github.com/JetBrains/intellij-community/pull/285
I also made a similar change in FileStructureDialog, even though I don't know where it's used.
About my other problems, I submitted a second PR to allow multiple colors in nodes shown in the structure view:
https://github.com/JetBrains/intellij-community/pull/286
I would be grateful if you could merge those pull requests :)
Thanks
Is the behavior in the following screenshot normal?
The tool window shows members inherited from Object in both classes, but the popup does not show every inherited member under Test2, because it considers they are duplicates of those under Test1. In my opinion, this is not the correct behavior. What do you think?