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

Can't format Python documents #24653

Open
stravant opened this issue Dec 23, 2024 · 7 comments
Open

Can't format Python documents #24653

stravant opened this issue Dec 23, 2024 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@stravant
Copy link

stravant commented Dec 23, 2024

Type: Bug

  • Open a Python file

  • Try to Format

  • Get popup saying "There is no formatter installed"

  • Click "Install formatter..."

  • Click the top result.

  • That's this extension... which I already have installed... but it doesn't work.

Expected behavior:

  • When I follow the natural flow and click the top result... it works. Like it does with literally every other language.

Extension version: 2024.22.0
VS Code version: Code 1.94.2 (Universal) (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z)
OS version: Darwin arm64 22.3.0
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.11
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
C/C++ ms-vscode.cpptools 1.22.11
C/C++ Extension Pack ms-vscode.cpptools-extension-pack 1.3.0
C/C++ Themes ms-vscode.cpptools-themes 2.0.0
Clang-Format xaver.clang-format 1.9.0
CMake twxs.cmake 0.0.17
CMake Tools ms-vscode.cmake-tools 1.19.52
JavaScript Debugger ms-vscode.js-debug 1.94.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
Pylance ms-python.vscode-pylance 2024.11.3
Python ms-python.python 2024.22.0
Python Debugger ms-python.debugpy 2024.14.0
Rojo - Roblox Studio Sync evaera.vscode-rojo 2.1.2
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.10
System Info
Item Value
CPUs Apple M2 Max (12 x 2400)
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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 4, 5
Memory (System) 64.00GB (19.21GB free)
Process Argv --crash-reporter-id 69a9cd57-b81a-4780-ae45-b10cb323f10d
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupyter:31046869
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Dec 23, 2024
@karthiknadig
Copy link
Member

We don't control the marketplace results, unfortunately we don't even have a way to filter this. The query itself comes from VS Code core. Since python has several formatting options, you need to search for the formatter you want to use like black, autopep8, ruff etc.

@sandy081 Is there a way to contribute to the query, or provide suggestions for these cases?

@karthiknadig karthiknadig self-assigned this Dec 24, 2024
@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Dec 24, 2024
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Dec 24, 2024
@sandy081
Copy link
Member

sandy081 commented Jan 5, 2025

@karthiknadig Can you please explain me the user flow and what results are you expecting to see extensions view?

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Jan 5, 2025
@karthiknadig
Copy link
Member

If you install just Python Extension, then click on format document, you get a dialog that says please install a formatter from the extension store. This opens the extension view and shows Python extension, and not the formatting extensions like Black Formatter, Ruff or autopep8.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jan 6, 2025
@sandy081
Copy link
Member

sandy081 commented Jan 7, 2025

you get a dialog that says please install a formatter from the extension store.

I assume this dialog is shown by the python extension and the buttons in the dialog are also from python extension. If so, then I believe you would be using this command workbench.extensions.search to show the extensions view. While invoking the command you can pass a search string - that can show the extensions you would like to show.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Jan 7, 2025
@karthiknadig
Copy link
Member

@sandy081 It is this dialog, which is shown by Core. You get this dialog by triggering formatting from the command palette.
Image

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jan 7, 2025
@sandy081
Copy link
Member

@karthiknadig Install Formatter... action is opening extensions view with search term ``category:formatters ${langName}. In the above case it could be category:formatters yaml` which seems good to me. Lets ask for the search term user is seeing

cc @jrieken

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Jan 16, 2025
@karthiknadig
Copy link
Member

This is what you get for python, and none of the formatting extensions are shown. All first party formatting extensions have "formatter" category and keyword python. But they don't show up.

Image

Image

They are in the second page, even though they have significantly more downloads:

Image

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug 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

3 participants