google / yapf

A formatter for Python files
Apache License 2.0
13.75k stars 888 forks source link

[Bug] Some space out of range strip when using `-l` argument. #1190

Open EeyoreLee opened 9 months ago

EeyoreLee commented 9 months ago
def do_something():
    xs = []
    for x in xs:
        y = 'y'

        if y:
            pass

def do_something_else():
    return '-path 1'

the line 5 (one-based) has 8 spaces or 2 tabs. they are strip when I run yapf -l 10-10 xx.py -i or cat xx.py | yapf -l 10-10. line 10 is the last line.

EeyoreLee commented 9 months ago

Related issue vscode-extension-yapf #101 and #613

EeyoreLee commented 9 months ago

Seems there's already a PR to fix it, could we merge it if it can address this issue after code review. #1102