Skip to content

Support formatting specified lines.#4020

Merged
JelleZijlstra merged 13 commits intopsf:mainfrom
yilei:ranges
Nov 7, 2023
Merged

Support formatting specified lines.#4020
JelleZijlstra merged 13 commits intopsf:mainfrom
yilei:ranges

Conversation

@yilei
Copy link
Copy Markdown
Contributor

@yilei yilei commented Nov 3, 2023

Description

This adds a command-line option --line-ranges=, to tell Black to only format these specified lines.

Fixes #830

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 3, 2023

diff-shades reports zero changes comparing this PR (bd6d7ff) to main (ecbd9e8).


What is this? | Workflow run | diff-shades documentation

Copy link
Copy Markdown
Collaborator

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks good, just a few pieces of minor feedback.

This has been a long-standing feature request, so it's great to finally see it in Black.

Comment thread docs/usage_and_configuration/the_basics.md Outdated
Comment thread src/black/ranges.py Outdated
Comment thread src/black/ranges.py Outdated
Comment thread src/black/ranges.py Outdated
Comment thread tests/test_ranges.py Outdated
yilei and others added 6 commits November 6, 2023 17:35
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@yilei
Copy link
Copy Markdown
Contributor Author

yilei commented Nov 7, 2023

Thanks for the review! Updated.

@JelleZijlstra JelleZijlstra merged commit 46be1f8 into psf:main Nov 7, 2023
@yilei yilei deleted the ranges branch November 7, 2023 02:52
@fearedbliss
Copy link
Copy Markdown

Thanks for implementing this @yilei. This will be extremely useful in many situations and circumstances.

@henriholopainen
Copy link
Copy Markdown
Contributor

Funnily enough, I was working on the same feature and only now realised it had been finished when trying to open a draft PR. 😛 Oh well, what it's worth, my approach can be found here.

@henriholopainen
Copy link
Copy Markdown
Contributor

Also this PR might be enough to close this issue

@yilei
Copy link
Copy Markdown
Contributor Author

yilei commented Nov 8, 2023

@henriholopainen Ah I'm sorry I didn't realize you were working on it. I should have sent the PR earlier as I've had it implemented for a while now.

@tartley
Copy link
Copy Markdown

tartley commented Nov 8, 2023

This option doesn't appear to be working right for me. I'll post a minimal issue...

@tartley
Copy link
Copy Markdown

tartley commented Nov 8, 2023

Minimal repro posted here: #4033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Allow command line option to only reformat specific lines

5 participants