<p dir="auto">Version: 0.192.0</p>
<h2 dir="auto">Problem</h2>
<ol dir="auto">
<li><code class="notranslate">autoindent</code> fails to indent parameter lists. Note: If I hit enter after <code class="notranslate">fake_function(</code>, <code class="notranslate">param=</code> would be indented 3x -- class &gt; def &gt; foo.</li>
</ol>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Bar(unittest.TestCase):
    def test_indentation(self):
        foo = fake_function(param='hello',
        second_param='world', # should have indented this line
        ) # and this one, too"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">Bar</span>(<span class="pl-s1">unittest</span>.<span class="pl-v">TestCase</span>):
    <span class="pl-k">def</span> <span class="pl-en">test_indentation</span>(<span class="pl-s1">self</span>):
        <span class="pl-s1">foo</span> <span class="pl-c1">=</span> <span class="pl-en">fake_function</span>(<span class="pl-s1">param</span><span class="pl-c1">=</span><span class="pl-s">'hello'</span>,
        <span class="pl-s1">second_param</span><span class="pl-c1">=</span><span class="pl-s">'world'</span>, <span class="pl-c"># should have indented this line</span>
        ) <span class="pl-c"># and this one, too</span></pre></div>
<p dir="auto">After saving, <code class="notranslate">atom-beautify</code> correctly indents the parameters</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Bar(unittest.TestCase):

    def test_indentation(self):
        foo = fake_function(param='hello',
                            second_param='world', # fixed!
                            ) # me, too!"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">Bar</span>(<span class="pl-s1">unittest</span>.<span class="pl-v">TestCase</span>):

    <span class="pl-k">def</span> <span class="pl-en">test_indentation</span>(<span class="pl-s1">self</span>):
        <span class="pl-s1">foo</span> <span class="pl-c1">=</span> <span class="pl-en">fake_function</span>(<span class="pl-s1">param</span><span class="pl-c1">=</span><span class="pl-s">'hello'</span>,
                            <span class="pl-s1">second_param</span><span class="pl-c1">=</span><span class="pl-s">'world'</span>, <span class="pl-c"># fixed!</span>
                            ) <span class="pl-c"># me, too!</span></pre></div>
<ol start="2" dir="auto">
<li>But now, <code class="notranslate">autoindent</code> fails to reset indentation back to the beginning of the line</li>
</ol>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="        [...]
        foo = fake_function(param='hello',
                            second_param='world',
                            )

                            bar = 'after_continuing typing' # ach!!"><pre class="notranslate">        [...]
        <span class="pl-s1">foo</span> <span class="pl-c1">=</span> <span class="pl-en">fake_function</span>(<span class="pl-s1">param</span><span class="pl-c1">=</span><span class="pl-s">'hello'</span>,
                            <span class="pl-s1">second_param</span><span class="pl-c1">=</span><span class="pl-s">'world'</span>,
                            )

                            <span class="pl-s1">bar</span> <span class="pl-c1">=</span> <span class="pl-s">'after_continuing typing'</span> <span class="pl-c"># ach!!</span></pre></div>
<p dir="auto">Unfortunately <code class="notranslate">atom-beautify</code> doesn't quite fix this ever time.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="        foo = fake_function(param='hello',
                            second_param='world',
                            )
            bar = 'after_continuing typing'"><pre class="notranslate">        <span class="pl-s1">foo</span> <span class="pl-c1">=</span> <span class="pl-en">fake_function</span>(<span class="pl-s1">param</span><span class="pl-c1">=</span><span class="pl-s">'hello'</span>,
                            <span class="pl-s1">second_param</span><span class="pl-c1">=</span><span class="pl-s">'world'</span>,
                            )
            <span class="pl-s1">bar</span> <span class="pl-c1">=</span> <span class="pl-s">'after_continuing typing'</span></pre></div>
<h2 dir="auto">Note</h2>
<p dir="auto">I 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.</p>
<h2 dir="auto">Update</h2>
<p dir="auto">Here's some testing in</p>
<h4 dir="auto">Sublime3:</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
def testing_indentation_in_sublime(some_var):
    first_line = &quot;works&quot;
    second_test = func_indentation(multiple_param,
        auto_indents,
        still_here,
        ) # parenthesis auto matched when typed!

    third_test = alt_indentation(
        looks_just_like above,
        which_was_wrong,
        but_this_works,
        )

        fourth_line = existing_indentation('retry last pasting',
                                       'broken') 
        and_indent_is_kept

    fifth_line = backspace_only_does_one_space('testing existing indent',
                                               'testing')
    indentation = &quot;working!!&quot;

    if check_nested_indent is not None:
        basic_indent = True
    elif check_indent:
        also_works = True
        if nested:
            so_far = so_good
        else:
            also_good = True
        else:
            uh_oh = 'is this really that hard?'

    return end_of_function

    def still_indented():
        '''sigh.'''
        indentation = 'not perfect here, either (but way better)'"><pre class="notranslate"><span class="pl-k">def</span> <span class="pl-en">testing_indentation_in_sublime</span>(<span class="pl-s1">some_var</span>):
    <span class="pl-s1">first_line</span> <span class="pl-c1">=</span> <span class="pl-s">"works"</span>
    <span class="pl-s1">second_test</span> <span class="pl-c1">=</span> <span class="pl-en">func_indentation</span>(<span class="pl-s1">multiple_param</span>,
        <span class="pl-s1">auto_indents</span>,
        <span class="pl-s1">still_here</span>,
        ) <span class="pl-c"># parenthesis auto matched when typed!</span>

    <span class="pl-s1">third_test</span> <span class="pl-c1">=</span> <span class="pl-en">alt_indentation</span>(
        <span class="pl-s1">looks_just_like</span> <span class="pl-s1">above</span>,
        <span class="pl-s1">which_was_wrong</span>,
        <span class="pl-s1">but_this_works</span>,
        )

        <span class="pl-s1">fourth_line</span> <span class="pl-c1">=</span> <span class="pl-en">existing_indentation</span>(<span class="pl-s">'retry last pasting'</span>,
                                       <span class="pl-s">'broken'</span>) 
        <span class="pl-s1">and_indent_is_kept</span>

    <span class="pl-s1">fifth_line</span> <span class="pl-c1">=</span> <span class="pl-en">backspace_only_does_one_space</span>(<span class="pl-s">'testing existing indent'</span>,
                                               <span class="pl-s">'testing'</span>)
    <span class="pl-s1">indentation</span> <span class="pl-c1">=</span> <span class="pl-s">"working!!"</span>

    <span class="pl-k">if</span> <span class="pl-s1">check_nested_indent</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span>:
        <span class="pl-s1">basic_indent</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>
    <span class="pl-k">elif</span> <span class="pl-s1">check_indent</span>:
        <span class="pl-s1">also_works</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>
        <span class="pl-k">if</span> <span class="pl-s1">nested</span>:
            <span class="pl-s1">so_far</span> <span class="pl-c1">=</span> <span class="pl-s1">so_good</span>
        <span class="pl-k">else</span>:
            <span class="pl-s1">also_good</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>
        <span class="pl-s1">else</span>:
            <span class="pl-s1">uh_oh</span> <span class="pl-c1">=</span> <span class="pl-s">'is this really that hard?'</span>

    <span class="pl-k">return</span> <span class="pl-s1">end_of_function</span>

    <span class="pl-k">def</span> <span class="pl-en">still_indented</span>():
        <span class="pl-s">'''sigh.'''</span>
        <span class="pl-s1">indentation</span> <span class="pl-c1">=</span> <span class="pl-s">'not perfect here, either (but way better)'</span></pre></div>
<h4 dir="auto">Eclipse</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="def indent_test_eclipse(some_var):
    first_line = 'smoke test'
    second_test = func_with_param(style_one,
                                  hey_it_works,
                                  )
    back_to_the_beginning = 'holy crap.'
    third_test = func_with_alt_style(
                                     hrmmm,
                                     )

    if nested_indent is not None:
        basic_indent = True
    elif reindents_on_space_not_colon:
        still_okay = True
        if nested:
            so_far = so_good
        else:
            also_good = True
        else:
            must_be_difficult = True

    return end_of_function

def correctly_indents_after_return():
    '''Woo hoo'''

    return True"><pre class="notranslate"><span class="pl-k">def</span> <span class="pl-en">indent_test_eclipse</span>(<span class="pl-s1">some_var</span>):
    <span class="pl-s1">first_line</span> <span class="pl-c1">=</span> <span class="pl-s">'smoke test'</span>
    <span class="pl-s1">second_test</span> <span class="pl-c1">=</span> <span class="pl-en">func_with_param</span>(<span class="pl-s1">style_one</span>,
                                  <span class="pl-s1">hey_it_works</span>,
                                  )
    <span class="pl-s1">back_to_the_beginning</span> <span class="pl-c1">=</span> <span class="pl-s">'holy crap.'</span>
    <span class="pl-s1">third_test</span> <span class="pl-c1">=</span> <span class="pl-en">func_with_alt_style</span>(
                                     <span class="pl-s1">hrmmm</span>,
                                     )

    <span class="pl-k">if</span> <span class="pl-s1">nested_indent</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span>:
        <span class="pl-s1">basic_indent</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>
    <span class="pl-k">elif</span> <span class="pl-s1">reindents_on_space_not_colon</span>:
        <span class="pl-s1">still_okay</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>
        <span class="pl-k">if</span> <span class="pl-s1">nested</span>:
            <span class="pl-s1">so_far</span> <span class="pl-c1">=</span> <span class="pl-s1">so_good</span>
        <span class="pl-k">else</span>:
            <span class="pl-s1">also_good</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>
        <span class="pl-s1">else</span>:
            <span class="pl-s1">must_be_difficult</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>

    <span class="pl-k">return</span> <span class="pl-s1">end_of_function</span>

<span class="pl-k">def</span> <span class="pl-en">correctly_indents_after_return</span>():
    <span class="pl-s">'''Woo hoo'''</span>

    <span class="pl-k">return</span> <span class="pl-c1">True</span></pre></div>
<p dir="auto">Pressing enter after continuing a list or tuple on a second line. It should either auto indent one tab, or to the first char of the previous item, but it just goes to the beginning of the line. Manually pressing auto indent (Lines-&gt;Auto Indent, or cmd+i), doesn't do anything.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/5131063/2825233/36a9156a-cf46-11e3-80fb-52b50022a042.png"><img src="https://cloud.githubusercontent.com/assets/5131063/2825233/36a9156a-cf46-11e3-80fb-52b50022a042.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">should be either</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="somefunc(bar,
    m)"><pre class="notranslate"><code class="notranslate">somefunc(bar,
    m)
</code></pre></div>
<p dir="auto">or</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="somefunc(bar,
         m)"><pre class="notranslate"><code class="notranslate">somefunc(bar,
         m)
</code></pre></div>