-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Differences in formatting between ktlint and Android Studio #685
Comments
Hm.. I kind of surprised that AS formats it without that extra indent. What version of AS are you using? |
The newest one: Android Studio 3.5.3 But In older versions, it was exactly the same. Just didn't have time to take care of that. |
@shashachu I am posting my Code style settings imported from AS I removed all languages but Kotlin, and left other settings that may be important. Can you please check the diff with yours? Or at least post your configuration so I can manually spot the differences? Thanks kotlin-official-code-style.codestyle.json
{
"schemeName": "kotlin-official-code-style",
"version": "1.0",
"codeStyle": {
"all": {
"formatter_off_tag": "@formatter:off",
"formatter_on_tag": "@formatter:on",
"formatter_tags_accept_regexp": false,
"formatter_tags_enabled": false,
"max_line_length": 100,
"wrap_on_typing": false
},
"editorconfig": {
"align_group_field_declarations": false,
"space_after_colon": false,
"space_after_comma": true,
"space_before_colon": false,
"space_before_comma": false,
"spaces_around_assignment_operators": true
},
"kotlin": {
"align_in_columns_case_branch": false,
"align_multiline_binary_operation": false,
"align_multiline_extends_list": false,
"align_multiline_method_brackets": false,
"align_multiline_parameters": false,
"align_multiline_parameters_in_calls": false,
"assignment_wrap": "normal",
"blank_lines_after_class_header": 0,
"blank_lines_around_block_when_branches": 0,
"block_comment_at_first_column": true,
"call_parameters_new_line_after_left_paren": true,
"call_parameters_right_paren_on_new_line": true,
"call_parameters_wrap": "on_every_item",
"catch_on_new_line": false,
"class_annotation_wrap": "split_into_lines",
"code_style_defaults": "KOTLIN_OFFICIAL",
"continuation_indent_for_chained_calls": false,
"continuation_indent_for_expression_bodies": false,
"continuation_indent_in_argument_lists": false,
"continuation_indent_in_elvis": false,
"continuation_indent_in_if_conditions": false,
"continuation_indent_in_parameter_lists": false,
"continuation_indent_in_supertype_lists": false,
"continuation_indent_size": 4,
"else_on_new_line": false,
"enum_constants_wrap": "off",
"extends_list_wrap": "normal",
"field_annotation_wrap": "split_into_lines",
"finally_on_new_line": false,
"if_rparen_on_new_line": true,
"import_nested_classes": false,
"indent_size": 4,
"indent_style": "space",
"insert_whitespaces_in_simple_one_line_method": true,
"keep_blank_lines_before_right_brace": 0,
"keep_blank_lines_in_code": 1,
"keep_blank_lines_in_declarations": 1,
"keep_first_column_comment": true,
"keep_indents_on_empty_lines": false,
"keep_line_breaks": true,
"lbrace_on_next_line": false,
"line_comment_add_space": true,
"line_comment_at_first_column": false,
"method_annotation_wrap": "split_into_lines",
"method_call_chain_wrap": "normal",
"method_parameters_new_line_after_left_paren": true,
"method_parameters_right_paren_on_new_line": true,
"method_parameters_wrap": "on_every_item",
"name_count_to_use_star_import": 2147483647,
"name_count_to_use_star_import_for_members": 2147483647,
"parameter_annotation_wrap": "off",
"smart_tabs": false,
"space_after_comma": true,
"space_after_extend_colon": true,
"space_after_type_colon": true,
"space_before_catch_parentheses": true,
"space_before_comma": false,
"space_before_extend_colon": true,
"space_before_for_parentheses": true,
"space_before_if_parentheses": true,
"space_before_lambda_arrow": true,
"space_before_type_colon": false,
"space_before_when_parentheses": true,
"space_before_while_parentheses": true,
"spaces_around_additive_operators": true,
"spaces_around_assignment_operators": true,
"spaces_around_equality_operators": true,
"spaces_around_function_type_arrow": true,
"spaces_around_logical_operators": true,
"spaces_around_multiplicative_operators": true,
"spaces_around_range": false,
"spaces_around_relational_operators": true,
"spaces_around_unary_operator": false,
"spaces_around_when_arrow": true,
"tab_width": 4,
"variable_annotation_wrap": "off",
"while_on_new_line": false,
"wrap_elvis_expressions": 1,
"wrap_expression_body_functions": 1,
"wrap_first_method_in_call_chain": false
},
"properties": {
"align_group_field_declarations": false
}
}
}
|
I'm facing similar problem. :( |
I have a feeling that it was fixed in the recent versions, could you try it out with 0.36.0 @PPetka ? |
Closing this for now. If the issue is still existing in the latest version, please provide a reproducible code snippet. |
@romtsn I've done some testing and It feels like the problem was solved indeed!! Thank you! |
Hi, I am having trouble with setting Android Studio so it exactly follows formatting applied by ktlint.
The style is set to official kotlin one.
I've done everything as described in your readme file (try to apply settings via --apply-to-idea-project Option1 , and also Option 2 and 3https://github.com/pinterest/ktlint#option-3
I guess the problem could be probably solved by applying some settings into .editorconfig file,
but I am not sure what property can cause it.
I had the same inconsistency with max line lenght property. Adding
max_line_length=100
did solved the issue.Screenshots before formatting
after formatting via Android Studio:
Any suggestions?
ktlint version: 0.32.0
The text was updated successfully, but these errors were encountered: