Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

feature(yapf): allow range_format #386

Merged
merged 1 commit into from
Nov 30, 2021
Merged

feature(yapf): allow range_format #386

merged 1 commit into from
Nov 30, 2021

Conversation

meijieru
Copy link
Contributor

Enable range formatting for yapf & black

@jose-elias-alvarez
Copy link
Owner

Are you sure this works? I think this will make range formatting format the entire document, since the arguments aren't getting modified. I recommend taking a look at the implementation for Prettier and see if we can do something similar for these formatters.

@meijieru
Copy link
Contributor Author

I hacked it and use it for several days.
Just find that they always format the entire file.
Sorry for that, and I will look at it later this week.

@meijieru meijieru changed the title fix(black,yapf): allow range_format feature(yapf): allow range_format Nov 30, 2021
@meijieru
Copy link
Contributor Author

I fix the implementation for yapf and update the documentation.

There are some limitations though:

  1. It is line-based.
  2. Even range is given, it may change the out-of-range content like whitespace, which comes from the plugin itself.

@meijieru
Copy link
Contributor Author

For black we should wait for psf/black#830

@jose-elias-alvarez
Copy link
Owner

LGTM, thanks!

@jose-elias-alvarez jose-elias-alvarez merged commit d54053d into jose-elias-alvarez:main Nov 30, 2021
@meijieru meijieru deleted the fix_python_formatter branch November 30, 2021 00:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants