Closed kovasap closed 2 years ago
What's possible is documented. I'd be interested to see the problematic file to inform future changes to the algorithm.
I can't share directly the file in question, but this minimal file gets its shiftwidth
set to 4:
from typing import List
def test(
arg: str,
) -> List[str]:
return [
'hi',
'yo',
]
def test2(
arg: List[str]
) -> str:
var = []
var2 = set()
for i in sorted(arg,
key=lambda a: str(a)):
print(i)
When python sees it as 2-space-indented with continuation lines given an extra 2 spaces.
I guess Python line continuations are common enough that we could try special casing them. Hopefully I'm not opening Pandora's box.
For posterity, and in case this gets rolled back, I think the right workaround here is probably .editorconfig
. Forcing shiftwidth=2
in all Python files is a great example of why file type based configuration is so limiting.
That looks like it works for me. Thank you!!
I'm having some issues with this plugin properly identifying python files as 2-space indented (perhaps because continuation lines are indented with 4 spaces? I haven't dug into the algorithm). I'd like to disable the plugin for all python files for now. I don't see an option for this, is it possible?