Search code examples
javaspringintellij-ideaproperties-filecode-folding

IntelliJ: view property values in code


In newer versions of IntelliJ, value of properties used in @Value annotation (and maybe in other contexts) are shown like this:

enter image description here

This doesn't work if you have clicked on the preview or because sometimes IntelliJ ignores it:

enter image description here

How is it possible to force IntelliJ show the property value?


Solution

  • Place the caret on the key inside @Value annotation and press Ctrl + - shortcut.
    To do the reverse (show the key), either click on the value preview or press Ctrl + + shortcut.

    I find this Ctrl + - shortcut to be very useful to fold any code block; for example you can use it inside a Javadoc to collapse it altogether.