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

Formatting extensions not working #420

Closed
benjaminphalane opened this issue Jan 26, 2024 · 6 comments
Closed

Formatting extensions not working #420

benjaminphalane opened this issue Jan 26, 2024 · 6 comments
Assignees
Labels
triage-needed Issue is not triaged.

Comments

@benjaminphalane
Copy link

Type: Bug

Download Black Formatter extension, set it as the default formatter and select a .py file and dilberately mess with the formatting and attempt to use Black Formatter to fix formatting in the file. (It didn't work when I tried)

VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:10.514Z)
OS version: Windows_NT x64 10.0.22621
Modes://

System Info
Item Value
CPUs Intel(R) Celeron(R) N4020 CPU @ 1.10GHz (2 x 1094)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: disabled_off
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) undefined
Memory (System) 3.82GB (0.20GB free)
Process Argv --crash-reporter-id e42f6d51-5a61-4ca9-bf98-69f920fa12cc
Screen Reader no
VM 0%
Extensions (5)
Extension Author (truncated) Version
prettier-vscode esb 10.1.0
black-formatter ms- 2023.6.0
debugpy ms- 2023.3.13341008
python ms- 2023.22.1
vscode-pylance ms- 2023.12.1
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30933248
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
3ef8e399:30949928

@vscodenpa vscodenpa added the triage-needed Issue is not triaged. label Jan 26, 2024
@andreamah andreamah transferred this issue from microsoft/vscode Jan 26, 2024
@andreamah andreamah removed their assignment Jan 26, 2024
@karthiknadig
Copy link
Member

@benjaminphalane How are you triggering formatting? You can also see Output > Black Formatter logs to see why it was not formatted.

@karthiknadig karthiknadig self-assigned this Jan 26, 2024
@benjaminphalane
Copy link
Author

I triggered formating by using both the "shift+alt+f "shortcut as well as the "format document with" option and nothing happened. I also checked the log according to it everything seems to be in order :
Screenshot (257)

@karthiknadig
Copy link
Member

The screen shot shows the error. According to Python parser there is syntax error because there is an indent on line 4 that is not valid in Python.

@benjaminphalane
Copy link
Author

I created that error on purpose to test the formatting extension.

@karthiknadig
Copy link
Member

karthiknadig commented Jan 29, 2024

You can try the following to see if formatting works:
Before:

x=[1,1]

After:

x = [1, 1]

We block code from formatting if there are syntax errors. This is to preserve the current experience with notebooks. It will get better when we implement support to handle notebook cells with cell magic (like %%time).

@benjaminphalane
Copy link
Author

It works, thanks. I was surprised because the tutorial I'm following on YouTube had this working like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Issue is not triaged.
Projects
None yet
Development

No branches or pull requests

4 participants