Scala plugin adds multiple brackets around try

I have a strange problem: When I want to try/catch something, and reformat the code, several brackets get added. Example:

try { println("foo") }

Reformat code

produces:

try { {
  println("foo")
}
}

0
2 comments

Hello.

What version of scala plugin are you using?

Could you please check if the issue persist with default settings?
If it does not, please provide your code style settings. To do this either list difference from default settings or attach an .xml containing your custom code style settings. The .xml should be located at <user_dir>\.IdeaData\IDEA-14\scala\config\codestyles.

With best regards,
Roman

0

The issue does not persist with the default settings.

The scala code style settings are the following:

  <codeStyleSettings language="Scala">
    <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
    <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
    <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
    <option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
    <option name="BLANK_LINES_AFTER_ANONYMOUS_CLASS_HEADER" value="1" />
    <option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
    <option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
    <option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
    <option name="ALIGN_GROUP_FIELD_DECLARATIONS" value="true" />
    <option name="CALL_PARAMETERS_WRAP" value="1" />
    <option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
    <option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
    <option name="METHOD_PARAMETERS_WRAP" value="1" />
    <option name="EXTENDS_LIST_WRAP" value="1" />
    <option name="EXTENDS_KEYWORD_WRAP" value="1" />
    <option name="METHOD_CALL_CHAIN_WRAP" value="1" />
    <option name="BINARY_OPERATION_WRAP" value="1" />
    <option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true" />
    <option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
    <option name="FOR_STATEMENT_WRAP" value="1" />
    <option name="DOWHILE_BRACE_FORCE" value="1" />
    <option name="WHILE_BRACE_FORCE" value="1" />
    <option name="FOR_BRACE_FORCE" value="1" />
    <option name="WRAP_LONG_LINES" value="true" />
  </codeStyleSettings>


EDIT: I deleted all Scala settings but the problem persisted. Then I created a new code style settings file using Manage -> Save As, switched to it, switched back and the problem went away.

0

Please sign in to leave a comment.