Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
140 views
in Technique[技术] by (71.8m points)

PyCharm: Run `black -S` on region

We are not ready to automatically format the whole source code with black

But from time to time I would like to execute black -S on a region via PyCharm.

There is a hint in the docs how to run black (or black -S (what I like)) on the whole file. But ...

How to run black only on a selected region?

question from:https://stackoverflow.com/questions/65951208/pycharm-run-black-s-on-region

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I have researched about this because it actually looks interesting, and I've came to the conclusion that you can maybe use:

black -S and_your_file_path

or:

black -c and_a_string

to format the code passed in as a string. I will also follow this thread because it looks interesting.
And I'm also going to do more research on this and if I find something I will let you know.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...