Prevent Code Collapsing


We are currently developing a plugin in intellij and we implemented a custom FoldingBuilder which extends the FoldingBuilderEx and it creates Folding Regions for code blocks starting with "// &begin" and end with "// &end ".
It works fine but the problem is that Intellij also add FoldingRegions on its own by default which create FoldingRegions for multiple comment lines e.g
(//this is a normal comment
// &begin
Some code here
// &end)
In this example Intellij overrides our custom FoldingRegions.
Is there any way to prevent intellij overriding our FoldingRegions ?


Faulty Example


without adjacent comments

1 comment


Could you please provide a minimal reproducible plugin example and a test project?


Please sign in to leave a comment.