Skip to content
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

"Format document" does not work #22563

Closed
vzakharov opened this issue Nov 29, 2023 · 3 comments
Closed

"Format document" does not work #22563

vzakharov opened this issue Nov 29, 2023 · 3 comments
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@vzakharov
Copy link

Type: Bug

Behaviour

Expected vs. Actual

Expected: Cmd+Shift+P > "Format document" formats the document

Actual: "There is no formatter for 'python' files installed."

Steps to reproduce:

  1. Cmf+Shift+P
  2. Format document

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.0
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2023-11-29 13:36:46.232 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-11-29 13:36:46.232 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-11-29 13:36:46.232 [info] Experiment 'pythonRecommendTensorboardExt' is active
2023-11-29 13:36:46.232 [info] Experiment 'pythonREPLSmartSend' is active
2023-11-29 13:36:46.232 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2023-11-29 13:36:46.232 [info] Experiment 'pythonTestAdapter' is active
2023-11-29 13:36:46.470 [info] Default formatter is set to null for workspace /Users/vova/Documents/GitHub/rand_1
2023-11-29 13:36:46.470 [info] Default formatter is set to null for workspace /Users/vova/Documents/GitHub/tmp
2023-11-29 13:36:46.618 [info] Test server listening.
2023-11-29 13:36:46.784 [info] Python interpreter path: /opt/homebrew/Caskroom/miniconda/base/envs/rand/bin/python
2023-11-29 13:36:47.081 [info] > conda info --json
2023-11-29 13:36:47.111 [info] > conda info --json
2023-11-29 13:36:47.111 [info] shell: zsh
2023-11-29 13:36:48.272 [info] > conda run -n rand --no-capture-output python ~/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/printEnvVariables.py
2023-11-29 13:36:48.273 [info] shell: bash
2023-11-29 13:36:48.516 [info] > conda run -n rand --no-capture-output python ~/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/printEnvVariables.py
2023-11-29 13:36:48.516 [info] shell: zsh
2023-11-29 13:36:48.571 [info] Starting Jedi language server for rand_1.
2023-11-29 13:36:49.904 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/printEnvVariables.py
2023-11-29 13:36:49.904 [info] shell: zsh
2023-11-29 13:36:49.973 [info] Send text to terminal: /usr/bin/python3 "/Users/vova/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/printEnvVariablesToFile.py" "/Users/vova/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/deactivate/zsh/envVars.txt"
2023-11-29 13:37:16.468 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-11-29 13:37:16.468 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-11-29 13:37:16.468 [info] Experiment 'pythonRecommendTensorboardExt' is active
2023-11-29 13:37:16.468 [info] Experiment 'pythonREPLSmartSend' is active
2023-11-29 13:37:16.468 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2023-11-29 13:37:16.468 [info] Experiment 'pythonTestAdapter' is active
2023-11-29 13:37:16.468 [info] Default formatter is set to null for workspace /Users/vova/Documents/GitHub/rand_1
2023-11-29 13:37:16.468 [info] Default formatter is set to null for workspace /Users/vova/Documents/GitHub/tmp
2023-11-29 13:37:16.468 [info] Test server listening.
2023-11-29 13:37:16.470 [info] Python interpreter path: /opt/homebrew/Caskroom/miniconda/base/envs/rand/bin/python
2023-11-29 13:37:16.945 [info] > conda info --json
2023-11-29 13:37:16.945 [info] shell: zsh
2023-11-29 13:37:16.949 [info] > conda info --json
2023-11-29 13:37:17.645 [info] > conda run -n rand --no-capture-output python ~/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/printEnvVariables.py
2023-11-29 13:37:17.645 [info] shell: zsh
2023-11-29 13:37:17.650 [info] > conda run -n rand --no-capture-output python ~/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/printEnvVariables.py
2023-11-29 13:37:17.650 [info] shell: bash
2023-11-29 13:37:17.759 [info] Starting Pylance language server.
2023-11-29 13:37:18.507 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/printEnvVariables.py
2023-11-29 13:37:18.508 [info] shell: zsh
2023-11-29 13:37:37.336 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-11-29 13:37:37.336 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-11-29 13:37:37.336 [info] Experiment 'pythonRecommendTensorboardExtcf' is active
2023-11-29 13:37:37.336 [info] Experiment 'pythonREPLSmartSend' is active
2023-11-29 13:37:37.336 [info] Experiment 'pythonTestAdapter' is active
2023-11-29 13:37:37.336 [info] Default formatter is set to null for workspace /Users/vova/Documents/GitHub/rand_1
2023-11-29 13:37:37.336 [info] Default formatter is set to null for workspace /Users/vova/Documents/GitHub/tmp
2023-11-29 13:37:37.339 [info] Test server listening.
2023-11-29 13:37:37.439 [info] Python interpreter path: /opt/homebrew/Caskroom/miniconda/base/envs/rand/bin/python
2023-11-29 13:37:37.950 [info] > conda info --json
2023-11-29 13:37:38.824 [info] > conda run -n rand --no-capture-output python ~/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/printEnvVariables.py
2023-11-29 13:37:38.824 [info] shell: bash
2023-11-29 13:37:38.852 [info] Starting Pylance language server.

User Settings

Multiroot scenario, following user settings may not apply:

languageServer: "Pylance"

Extension version: 2023.21.13331008
VS Code version: Code 1.84.2 (Universal) (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:52:33.687Z)
OS version: Darwin arm64 22.3.0
Modes:

System Info
Item Value
CPUs Apple M2 Pro (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 11, 5, 4
Memory (System) 16.00GB (0.15GB free)
Process Argv --crash-reporter-id 9f4b2e90-bda4-4506-bbe4-78e9f16f05f2
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30899288
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
282f8724:30602487
f6dab269:30613381
a9j8j154:30646983
showlangstatbar:30737416
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixt:30871694
pythonregdiag2:30871582
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:30885897
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
aa_t_chat:30882232

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Nov 29, 2023
@vzakharov
Copy link
Author

Screen.Recording.2023-11-29.at.13.39.24.mov

Screencast

I'm wondering if it's because of Experiment 'pythonPromptNewFormatterExt' is active. I'd very much rather be out of any experiments before they’re 100% stable.

@vzakharov
Copy link
Author

Screen.Recording.2023-11-29.at.13.52.35.mov

No longer gives an error after installing "Black" (why didn't it say anywhere that I should do this?), but still no formatting is happening, or so it seems (see screencast).

@karthiknadig
Copy link
Member

karthiknadig commented Nov 29, 2023

Formatting features are removed from python extension and moved to independent extensions. as you have identified you need to install Black Formatter or Autopep8 extension. There are 3rd party extensions such as Yapf and Ruff that also support formatting.

Open the logs for Python > Black Formatter and see what it says when you trigger formatting. Please file a bug on the black formatter repo if it is not formatting. Note that stable release of black formatter extension does not support formatting selection. That feature was added recently to black and is being worked on in the extension.

These changes were announced for months and we have been talking about these changes in our blogs. This is now in stable. The prompt experiment is to guide people to use these formatter and is not an experiment for the formatting feature itself.

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2023
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Nov 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants