Skip to content

VS Code removes spaces between empty object literals even if insertSpaceAfterOpeningAndBeforeClosingEmptyBraces is true #45501

Closed
@UmarGhouse

Description

@UmarGhouse

Issue Type: Bug

I have enabled the insertSpaceAfterOpeningAndBeforeClosingEmptyBraces option in settings.json and I still see that empty object literals with a space between them ({ }) are collapsed to remove the space ({}).

As an extended example, doing the following works as expected:

class Foo {
  doFoo() { }
}

But this does not:

const foo = { }

Upon saving, the second item gets collapsed to const foo = {}

VS Code version: Code 1.59.0 (379476f0e13988d90fab105c5c19e7abc8b1dea8, 2021-08-04T23:13:12.822Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (8 x 2419)
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.69GB (0.42GB free)
Process Argv --crash-reporter-id 98bbd91f-17e6-483f-a746-35cacbab776f
Screen Reader no
VM 0%
Extensions (4)
Extension Author (truncated) Version
better-comments aar 2.1.0
bracket-pair-colorizer-2 Coe 0.2.1
vscode-eslint dba 2.1.23
indent-rainbow ode 7.5.0

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
vscextlangct:30333562
binariesv615:30325510
pythonvssor306:30344512
bridge0708:30335490
vstre464:30350172
bridge0723:30351747

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions