问题
I have a Scala app built with Lift framework. It has a few .conf files. When I open those .conf files in my IntelliJ IDEA Ultimate Fancy Pants Edition, I do not see any buttons to fold those curly braces in those files. Hotkeys do not do it either. Browsed for plugins, none applicable found. Is there any solution to enable code folding in .conf files?
Update:
Here is an illustration of what would be lovely. Those "-" and "+" icons do not appear in .conf files:
回答1:
Those .conf
files are of HOCON type ("Human-Optimized Config Object Notation"). To enable folding them, you have to force the editor treat them as such. In IntelliJ settings, configure it as illustrated:
Preferences->Editor->File Types
, and there add filename patterns to HOCON filetype.
回答2:
One relevant plugin is the Scala plugin. Another is the HOCON plugin.
To install either, go to your IntelliJ Settings/Preferences dialog (Ctrl+Alt+S for Windows; ⌘+Comma for Mac) and select Plugins, then click Marketplace and search for, then install, one or both of these. Restart IntelliJ to enable it/them.
To confirm, go back to your IntelliJ Settings/Preferences dialog and you should now see Human-Optimized Config Object Notation (HOCON) file types among those listed. Click HOCON and you should see *.conf
under "Registered Patterns".
All your .conf
files should now appear in IntelliJ with syntax highlighting and code folding.
来源:https://stackoverflow.com/questions/44642314/intellij-idea-plugin-to-fold-conf-files