google / yapf

A formatter for Python files
Apache License 2.0
13.76k stars 890 forks source link

continuation_indent_width is ignored, when use_tabs is True #1066

Open UnitedMarsupials opened 1 year ago

UnitedMarsupials commented 1 year ago

I'm trying to follow the BSD style(9) guide even when using languages other than C. One particular aspect of that standard is that, although hierarchical indentation uses tabs, the line-continuation is done with four spaces.

Unfortunately, with use_tabs=True yapf seems to ignore the continuation_indent_width=4 -- indenting things like long function-calls with tabs too:

        p = subprocess.run(call_args,
            stderr = subprocess.PIPE,
            stdout = subprocess.PIPE,
            timeout = timeout)

instead of:

        p = subprocess.run(call_args,
            stderr = subprocess.PIPE,
            stdout = subprocess.PIPE,
            timeout = timeout)

Can anything be done about this, please?

Spitfire1900 commented 1 year ago

The instead of block combines tabs and spaces. Line continuation should have tabs only. The current behavior is correct.