SpacingBuilder (CodeStyleSettings settings) { final JsonCodeStyleSettings jsonSettings = settings.getCustomSettings(JsonCodeStyleSettings.class); final CommonCodeStyleSettings commonSettings = settings.getCommonSettings(JsonLanguage.INSTANCE); final int spacesBeforeComma = commonSettings.SPACE_BEFORE_COMMA ? 1 : 0; final int spacesBeforeColon = jsonSettings.SPACE_BEFORE_COLON ? 1 : 0; final int spacesAfterColon = jsonSettings.SPACE_AFTER_COLON ? 1 : 0; return new SpacingBuilder(settings, JsonLanguage.INSTANCE) .before(COLON).spacing(spacesBeforeColon, spacesBeforeColon, 0, false, 0) .after(COLON).spacing(spacesAfterColon, spacesAfterColon, 0, false, 0) .withinPair(L_BRACKET, R_BRACKET).spaceIf(commonSettings.SPACE_WITHIN_BRACKETS, true) .withinPair(L_CURLY, R_CURLY).spaceIf(commonSettings.SPACE_WITHIN_BRACES, true) .before(COMMA).spacing(spacesBeforeComma, spacesBeforeComma, 0, false, 0) .after(COMMA).spaceIf(commonSettings.SPACE_AFTER_COMMA); }