Multi-line formatting broken for JSON injections

I have some code in a Scala source file that looks like this:

val config1 =
  """
    {
      "Experiment": {
        "simulationMode": true,
        "minutesAhead": [1, 5, 30],
        "stepSize": 60
      }
    }
  """


I can mark that manually for JSON syntax injection, and then do "Edit JSON fragment" to edit the text in a separate pane.

However, the text in the new pane looks like this:

{          "Experiment": {            "simulationMode": true,            "minutesAhead": [1, 5, 30],            "stepSize": 60          }        }


That's not very nice to edit.

Oddly, the reverse situation also happens - if I change my Scala code to this:

val config1 =
  "\n        {\n          \"Experiment\": {\n            \"simulationMode\": true,\n            \"minutesAhead\": [1, 5, 30],\n            \"stepSize\": 60\n          }\n        }\n      "
 
then the "Edit JSON fragment" pane shows up nicely like this:
{
  "Experiment": {
    "simulationMode": true,
    "minutesAhead":
[1, 5, 30],
    "stepSize": 60
  
}
}
 
Any way to have my cake & eat it too here, so that it's formatted nicely in both contexts?
  
2 comments
Comment actions Permalink

Please file a bug at http://youtrack.jetbrains.com/issues/WEB with the sample file to reproduce this issue.

0

Please sign in to leave a comment.