Skip to content

black formatter doesn't take effect #14054

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

Closed
eromoe opened this issue Sep 23, 2020 · 7 comments
Closed

black formatter doesn't take effect #14054

eromoe opened this issue Sep 23, 2020 · 7 comments
Assignees
Labels
area-formatting bug Issue identified by VS Code Team member as probable bug

Comments

@eromoe
Copy link

eromoe commented Sep 23, 2020

Environment data

  • VS Code version: 1.49.1
  • Extension version (available under the Extensions sidebar): latest
  • OS and version: ubuntu 18.04 (remote-ssh)
  • Python version (& distribution if applicable, e.g. Anaconda): miniconda 3.7.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: 3.7.6

Expected behaviour

  • ctrl + p -> Format Document
  • format current file

Actual behaviour

  • ctrl + p -> Format Document
  • nothing happened

settings:
image

test on black 19.xx and 20.8b1 , both not working .

PS: Directly use black is fine

@eromoe eromoe added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Sep 23, 2020
@karthiknadig karthiknadig self-assigned this Sep 23, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 23, 2020
@eromoe
Copy link
Author

eromoe commented Sep 24, 2020

How do I saw the detail of how python extension working ?
Just show a loading aniation ,
image

@karthiknadig
Copy link
Member

@eromoe You can see the command it uses in Output > Python
image

Looks for black in that panel. Try and run that command from the terminal and see if it works.

@eromoe
Copy link
Author

eromoe commented Sep 24, 2020

Oh , I understand what you mention, there is a python output .

@eromoe
Copy link
Author

eromoe commented Sep 24, 2020

Command is :

> ~/.conda/envs/py3/bin/black "--line-length 200" --diff --quiet ~/sales_forecast/sales_forecast/src/timeseries/pd_func.py
cwd: ~/sales_forecast

It used --quiet by default ..

Remove --quiet and run in terminal got Error: no such option: --line-length 200 . Need remove double quote


Let me summarize:

  1. Black Args should not be wrapped by double quote
  2. --diff only print the difference , doesn't do reformation . It would print 1 file would be reformatted. and do nothing.
  3. remove --quiet to print message

@karthiknadig
Copy link
Member

@eromoe You have to set the arguments like this:
image

@eromoe
Copy link
Author

eromoe commented Sep 24, 2020

OK .
I think this is not clear . I thought --line-length 200 is an argument .
You'd better put some example nearby .

@karthiknadig
Copy link
Member

Since the settings issue is related to configuration UX, we are collecting all of these here #14092

@ghost ghost removed the triage label Sep 25, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-formatting bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants