How can i create a plugin to create custom java code folding when every open java file ?
已回答
I hava see demo : SimpleFoldingBuilder in sdk-code-example , but the deom can not collapse code every open file.
but in impl of AbstractBundle , when a param annoation by @propertyKey, every open file while folding code then display property value, how can i get the same effect: collapse custom Java code when open file
请先登录再写评论。
Hi,
I'm not sure I understand the case. Do you mean that some foldings are not enabled when you open the file? Is it random behavior?
Please describe what is happening in detail, with screenshots.
hi
expect:
1.open file ,all folding area are collapsed
2.expand all filding area
3.close file
4.reopen file
when reopen file,all folding area are collapsed,like first step.
“message” method is
What's above is what I expect. i think it may achieve by PropertyFoldingBuilder,but i find there is non diff between PropertyFoldingBuilder and SimpleFoldingBuilder .
actual:
but when i do like this https://plugins.jetbrains.com/docs/intellij/folding-builder.html#define-a-folding-builder,
1.first use Intellij idea open file, folding area are collapsed
2.expand folding area
3.close file
4.reopen file , folding area don not collapse .
May I ask how to achieve the desired results?
Hi,
Thank you for the explanation. This is the expected behavior. Folding state should be remembered even between IDE restarts.
Hi,
But why does the code that calls the "message" method get folded every time the file is reopened, regardless of whether it was folded before opening? What can I do if I want to achieve this effect?
may this feature call i18n folding? i really want to know how this ,and use in my plugin .Please help me .
And i find the feature only effect in UE , CE is not support
Hi,
I can't reproduce your behavior with message(). When I open a file:
In short, the state is remembered and restored on file reopening or the IDE restart.
If you experience it, I think this is an unexpected behavior. I don't see any configuration option that allows controlling it. Is it possible that your folding state is not remembered due to cleaning up the IDE state (e.g., when using sandbox IDE)?
Hi,
Thinks for your reply,
I open same project use UE edition and CE edition Intellij Idea, the effect I want is in the video of UE.
Intellij Idea 2023.3.4 UE edition :
https://www.youtube.com/watch?v=PKe1XP_CkVg
The project in two video is from :https://github.com/Nasller/CodeGlancePro
For successful build you need to find and delete the following code,
please open file :com.nasller.codeglance.config.CodeGlanceConfigurable ,
locate:
then repeat your previous steps.
Looking forward to your reply.
My plugin is not executed once my file is opened.
I make a folding region for call of method named 'getBoolean' in com.example.myinlayhints.MyFoldingBuilder,
and the test class in video is Test.java in Test directory.
there is my plugin video :https://www.youtube.com/watch?v=voMmpe5ydXE
and there is my code : https://github.com/adgai/MyFoldingPlugin.
Looking forward to your reply.
Hi,
This is the correct behavior, and your video https://www.youtube.com/watch?v=PKe1XP_CkVg looks like a bug (I suggest reporting it).
I checked both projects and everything worked as expected for me. In both projects, the folding state is remembered after a file is reopened. This is also presented on your last video (https://www.youtube.com/watch?v=voMmpe5ydXE).
Unfortunately, resetting the state after editor reopening is not currently supported. Please vote and follow this issue:
https://youtrack.jetbrains.com/issue/IJPL-791/Add-possibility-of-resetting-code-folding-state-to-the-default-after-editor-reopening
thinks for your reply,i will follow the issue