Resolving Properties
Hi,
In XML files, especially in spring configurations, when we add the .properties file path to the .xml file, IDEA is able to resolve ${} property placeholder values and display the value instead of placeholder in the .xml file view.
Is there a way to programatically add a .properties file so that IDEA would resolve properties from that file as well? Is there an API for that?
An example would be as below
Please sign in to leave a comment.
You may only iterate over all unresolved properties and then create its using com.intellij.lang.properties.psi.PropertiesFile#addProperty(java.lang.String, java.lang.String) or similar method from PropertiesFile class
This would add a property value to the XML file right? What want is that the property to be shown resolved in the UI, but when you hover over the resolved property, the actual placeholder is shown as seen in above screenshot.
After digging a little bit further into IC code, I have found out that this feature is given by code folding. Hence, I've implemented a custom CodeFoldingBuilder extending FoldingBuilderEx and registered is as below
Still, the property placeholders are not folded as shown in below screenshot. Below is the code of my codef olding builder
Are you expect to see foldings inside a popup in screenshot? Or you mean that your code doesn't work at all?
I'm expecting to see the folding in a pop-up. But so far, my code doesn't work at all. I've debugged the code as well. It correctly resolve the descriptors as well. But no pop-ups. Am I giving a wrong text range?
Finally got it to work. I had to always return true for isCollapsedByDefault method. Is there a way to make it permanently folded?