{"action":"created","issue":{"url":"https://api.github.com/repos/atom/atom/issues/6655","labels_url":"https://api.github.com/repos/atom/atom/issues/6655/labels{/name}","comments_url":"https://api.github.com/repos/atom/atom/issues/6655/comments","events_url":"https://api.github.com/repos/atom/atom/issues/6655/events","html_url":"https://github.com/atom/atom/issues/6655","id":73397354,"number":6655,"title":"Autoindent not working properly","user":{"login":"muppetjones","id":2041619,"avatar_url":"https://avatars.githubusercontent.com/u/2041619?v=3","gravatar_id":"","url":"https://api.github.com/users/muppetjones","html_url":"https://github.com/muppetjones","followers_url":"https://api.github.com/users/muppetjones/followers","following_url":"https://api.github.com/users/muppetjones/following{/other_user}","gists_url":"https://api.github.com/users/muppetjones/gists{/gist_id}","starred_url":"https://api.github.com/users/muppetjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muppetjones/subscriptions","organizations_url":"https://api.github.com/users/muppetjones/orgs","repos_url":"https://api.github.com/users/muppetjones/repos","events_url":"https://api.github.com/users/muppetjones/events{/privacy}","received_events_url":"https://api.github.com/users/muppetjones/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/atom/atom/labels/auto-indent","name":"auto-indent","color":"f7c6c7"},{"url":"https://api.github.com/repos/atom/atom/labels/bug","name":"bug","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-05-05T18:48:09Z","updated_at":"2015-07-01T10:16:01Z","closed_at":null,"body":"Version: 0.192.0\r\n \r\n## Problem\r\n1) `autoindent` fails to indent parameter lists. Note: If I hit enter after `fake_function(`, `param=` would be indented 3x -- class > def > foo.\r\n```python\r\nclass Bar(unittest.TestCase):\r\n    def test_indentation(self):\r\n        foo = fake_function(param='hello',\r\n        second_param='world', # should have indented this line\r\n        ) # and this one, too\r\n```\r\n\r\nAfter saving, `atom-beautify` correctly indents the parameters\r\n```python\r\nclass Bar(unittest.TestCase):\r\n\r\n    def test_indentation(self):\r\n        foo = fake_function(param='hello',\r\n                            second_param='world', # fixed!\r\n                            ) # me, too!\r\n```\r\n\r\n2) But now, `autoindent` fails to reset indentation back to the beginning of the line\r\n```python\r\n        [...]\r\n        foo = fake_function(param='hello',\r\n                            second_param='world',\r\n                            )\r\n                            \r\n                            bar = 'after_continuing typing' # ach!!\r\n```\r\n\r\nUnfortunately `atom-beautify` doesn't quite fix this ever time.\r\n```python\r\n        foo = fake_function(param='hello',\r\n                            second_param='world',\r\n                            )\r\n            bar = 'after_continuing typing'\r\n```\r\n\r\n## Note\r\nI recently updated atom-beautify as an attempt to help resolve the issue, but I am now getting errors there. The problems mentioned above still exist, but I will update if anything changes.\r\n\r\n## Update\r\nHere's some testing in \r\n\r\n#### Sublime3:\r\n```python\r\n\r\ndef testing_indentation_in_sublime(some_var):\r\n\tfirst_line = \"works\"\r\n\tsecond_test = func_indentation(multiple_param,\r\n\t\tauto_indents,\r\n\t\tstill_here,\r\n\t\t) # parenthesis auto matched when typed!\r\n\r\n\tthird_test = alt_indentation(\r\n\t\tlooks_just_like above,\r\n\t\twhich_was_wrong,\r\n\t\tbut_this_works,\r\n\t\t)\r\n\r\n\t    fourth_line = existing_indentation('retry last pasting',\r\n                                       'broken') \r\n\t    and_indent_is_kept\r\n\r\n\tfifth_line = backspace_only_does_one_space('testing existing indent',\r\n\t\t\t\t\t\t\t\t\t\t\t   'testing')\r\n\tindentation = \"working!!\"\r\n\r\n\tif check_nested_indent is not None:\r\n\t\tbasic_indent = True\r\n\telif check_indent:\r\n\t\talso_works = True\r\n\t\tif nested:\r\n\t\t\tso_far = so_good\r\n\t\telse:\r\n\t\t\talso_good = True\r\n\t\telse:\r\n\t\t\tuh_oh = 'is this really that hard?'\r\n\r\n\treturn end_of_function\r\n\r\n\tdef still_indented():\r\n\t\t'''sigh.'''\r\n\t\tindentation = 'not perfect here, either (but way better)'\r\n```\r\n\r\n#### Eclipse\r\n```python\r\ndef indent_test_eclipse(some_var):\r\n    first_line = 'smoke test'\r\n    second_test = func_with_param(style_one,\r\n                                  hey_it_works,\r\n                                  )\r\n    back_to_the_beginning = 'holy crap.'\r\n    third_test = func_with_alt_style(\r\n                                     hrmmm,\r\n                                     )\r\n    \r\n    if nested_indent is not None:\r\n        basic_indent = True\r\n    elif reindents_on_space_not_colon:\r\n        still_okay = True\r\n        if nested:\r\n            so_far = so_good\r\n        else:\r\n            also_good = True\r\n        else:\r\n            must_be_difficult = True\r\n    \r\n    return end_of_function\r\n\r\ndef correctly_indents_after_return():\r\n    '''Woo hoo'''\r\n    \r\n    return True\r\n```"},"comment":{"url":"https://api.github.com/repos/atom/atom/issues/comments/117581847","html_url":"https://github.com/atom/atom/issues/6655#issuecomment-117581847","issue_url":"https://api.github.com/repos/atom/atom/issues/6655","id":117581847,"user":{"login":"eexit","id":57098,"avatar_url":"https://avatars.githubusercontent.com/u/57098?v=3","gravatar_id":"","url":"https://api.github.com/users/eexit","html_url":"https://github.com/eexit","followers_url":"https://api.github.com/users/eexit/followers","following_url":"https://api.github.com/users/eexit/following{/other_user}","gists_url":"https://api.github.com/users/eexit/gists{/gist_id}","starred_url":"https://api.github.com/users/eexit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eexit/subscriptions","organizations_url":"https://api.github.com/users/eexit/orgs","repos_url":"https://api.github.com/users/eexit/repos","events_url":"https://api.github.com/users/eexit/events{/privacy}","received_events_url":"https://api.github.com/users/eexit/received_events","type":"User","site_admin":false},"created_at":"2015-07-01T10:16:01Z","updated_at":"2015-07-01T10:16:01Z","body":"Also having this issue while typing some well indented JavaScript. This is really annoying :("}}