Custom Language - Find Usages: File structure not showing

Answered

Hello,

I'm trying to develop a custom language plugin using the tutorial (https://www.jetbrains.org/intellij/sdk/docs/tutorials/custom_language_support/find_usages_provider.html). I extended this by typical INI/config file format blocks and property referencing, meaning the syntax enables something similar to this:

[block1]
abc = xyz
property = value

[block2]
whatever = 123
test = $abc # references the property abc

Everything works fine, the structure view shows the properties under the blocks, but when I move the cursor on the property abc and try to find usages the usages are not listed under each block like in the structure view, although the file structure grouper is enabled. Also the location string is not displayed as promised by the description of getLocation() in ItemRepresentation. How can I find out what I am doing wrong? Does someone have a hint where to look, what to debug etc.? I'm using a ReferenceContributor to gather the references correctly. Is this okay?

Kind regards

5 comments
Comment actions Permalink

Could you please share your sources?

0
Comment actions Permalink

Thank you for your answer.

I cannot share it right now and I would need some weeks to audit every single bit of it before uploading.

Is there no general hint on where to look or at least some kind of documentation on how everything is intertwined? No command reference documentation (javadoc/doxygen/...) or similar? Maybe something people usually do wrong with file structures or find usages? Or where I could put a breakpoint to debug it?

0
Comment actions Permalink

I'm still not quite sure I understand what the exact problem is, but here's a guess: did you implement ElementDescriptionProvider? see https://www.jetbrains.org/intellij/sdk/docs/reference_guide/custom_language_support/find_usages.html last paragraph

0
Comment actions Permalink

No, but I tried it now and it only changes several displayed texts, depending on the second argument passed to the ElementDescriptionProvider. It does not change the file's structure inside the find usages window.

0
Comment actions Permalink

Okay I found out that you need to implement the FileStructureGroupRuleProvider and register it inside the plugin.xml like this:

<fileStructureGroupRuleProvider implementation="...YourFileStructureGroupRuleProvider"/>

It is not enough to modify your StructureViewModelBase to return your own Grouper and it is not enough that IntelliJ basically knows the structure through the PsiElements and the StructureViewModel.

0

Please sign in to leave a comment.