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

Report an error when formatting fails instead of failing silently #8944

Closed
OlafvdSpek opened this issue Feb 28, 2022 · 4 comments
Closed

Report an error when formatting fails instead of failing silently #8944

OlafvdSpek opened this issue Feb 28, 2022 · 4 comments
Assignees
Labels
enhancement Improvement to an existing feature Feature: Code Formatting fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Milestone

Comments

@OlafvdSpek
Copy link

Issue Type: Bug

After generating a .clang-format file with clang-format -style=llvm -dump-config > .clang-format, Format Document stopped working, without reporting any errors.
I assume there was some issue with the format file, but without any info it's hard to tell. Could Format Document report errors?

VS Code version: Code 1.64.2 (f80445acd5a3dadef24aa209168452a3d97cc326, 2022-02-09T22:02:28.252Z)
OS version: Windows_NT x64 10.0.19044
Restricted Mode: No
Remote OS version: Linux x64 5.16.0-1-amd64

System Info
Item Value
CPUs Intel(R) Core(TM) i3 CPU 530 @ 2.93GHz (4 x 2946)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.99GB (1.50GB free)
Process Argv --crash-reporter-id 4bd850b3-a2f9-42c9-8c89-3a102309506b
Screen Reader no
VM 0%
Item Value
Remote SSH: debian
OS Linux x64 5.16.0-1-amd64
CPUs Intel(R) Core(TM) i3 CPU 530 @ 2.93GHz (2 x 2945)
Memory (System) 1.89GB (0.11GB free)
VM 100%
Extensions (16)
Extension Author (truncated) Version
better-cpp-syntax jef 1.15.13
jupyter-keymap ms- 1.0.0
remote-containers ms- 0.217.4
remote-ssh ms- 0.70.0
remote-ssh-edit ms- 0.70.0
remote-wsl ms- 0.64.2
doxdocgen csc 1.3.2
EditorConfig Edi 0.16.4
better-cpp-syntax jef 1.15.13
python ms- 2022.0.1814523869
vscode-pylance ms- 2022.2.1
jupyter ms- 2022.1.1201831736
cmake-tools ms- 1.9.2
cpptools ms- 1.8.4
cpptools-extension-pack ms- 1.1.0
cmake twx 0.0.17

(2 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30425749
pythontb:30283811
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30436985
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30433059
pythonvs932:30410667
wslgetstarted:30433507
vsclayoutctrc:30437038
vsrem710cf:30416617
vsbas813:30436447
vscscmwlcmc:30436992
cppdebug:30437093

microsoft/vscode#142964

@OlafvdSpek
Copy link
Author

The first time I try to format, it says: "Formatting failed. See the output window for details." The error is easy to miss.
If I try to format again, it doesn't say anything.. why not?

The output window is empty, until you select "C/C++" in the dropdown. Then it says:

Formatting failed:
/home/olaf/.vscode-server/extensions/ms-vscode.cpptools-1.8.4/bin/../LLVM/bin/clang-format -style=file -fallback-style= -assume-filename=/home/olaf/cpp/packed.cpp
Invalid fallback style "

Apparently I cleared the fallback style in settings, but this doesn't work and it's not using the default.

Maybe Clang_format_fallback Style should be a dropdown?

@Colengms
Copy link
Collaborator

Hi @OlafvdSpek . C_Cpp.clang_format_fallbackStyle is a free form field, as it supports defining a style inline. I assume your reference to a dropdown would be referring to VS Code's settings UI? Unfortunately, extensions have relatively little control over how VS Code represents settings in that UI.

Would you like us to use this issue to track adding a more clear error message when formatting fails?

@Colengms Colengms self-assigned this Feb 28, 2022
@Colengms Colengms added Feature: Code Formatting Language Service more info needed The issue report is not actionable in its current state labels Feb 28, 2022
@OlafvdSpek
Copy link
Author

Would you like us to use this issue to track adding a more clear error message when formatting fails?

Yes please.
And perhaps an empty C_Cpp.clang_format_fallbackStyle should be equivalent to an unset / default field.

@Colengms Colengms changed the title Format Document doesn't seem to report errors Report an error when formatting fails instead of failing silently Mar 2, 2022
@Colengms Colengms removed their assignment Mar 2, 2022
@Colengms Colengms added enhancement Improvement to an existing feature and removed more info needed The issue report is not actionable in its current state labels Mar 2, 2022
@Colengms Colengms added this to the Backlog milestone Mar 2, 2022
@sean-mcmanus sean-mcmanus self-assigned this Nov 15, 2023
@sean-mcmanus sean-mcmanus modified the milestones: Backlog, 1.19.0 Nov 15, 2023
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Nov 17, 2023
@sean-mcmanus
Copy link
Collaborator

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement to an existing feature Feature: Code Formatting fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
None yet
Development

No branches or pull requests

3 participants