-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Range Formatting #51
Comments
@karthiknadig - Thanks for your implement. I'll add this feature next. BTW, I wonder if a user has the code below
but only select the last two lines. what's the result should be expected
or
cause the last result is same as formatting the whole file but seems different from formatting only the snippet. |
That feels like a bug in the tool itself. I would say the first result with |
@karthiknadig - sorry for the ambiguity. For |
I see.
That is a good solution. |
@karthiknadig - I just found out the |
The way we did format document was we provided a single Edit for the whole document. For selections, this may result in changing areas users don't expect to change. So, I added a narrow edit calculator to cover those scenarios. |
From my experience working with the
ma-python.black-formatter
andms-python.autopep8
, users often seem to trigger selection formatting. I have implemented this support in black and autopep8. You could replicate that here to provide a better experience in those scenarios.If range formatting is not supported,
black
does not have range formatting. so in that case we leave a warning in logs and return edits for the whole file.microsoft/vscode-black-formatter#342
if range formating is supported.
autopep8
supports range formatting. For this case we use the range formatting option in autopep8. Edits are returned only for the lines with changes.microsoft/vscode-autopep8#175
The text was updated successfully, but these errors were encountered: