Skip to content

Default formatter cant format JS Optional catch binding properly #39047

Closed
@AnnAngela

Description

@AnnAngela

TS Template added by @mjbvz

TypeScript Version: 4.0.0-dev.20200611

Search Terms

  • format / formatting
  • try/catch

Issue Type: Bug

Reproduction code:

"use strict";
try {
    throw new Error();
} catch        {
    console.info("Hello world");
}

Expected behaviour:
When vscode tried formatting the code, the extra spaces should be removed.

What happend:
The extra spaces can not be removed via formatting. (But when I put () in spaces, formatter can format the code properly.)
Does this issue occur when all extensions are disabled?: Yes
Does this issue occur on Insider build?: Yes

My vscode setting:
"editor.defaultFormatter": null

VS Code version: Code 1.46.0 (a5d1cc28bb5da32ec67e86cc50f84c67cc690321, 2020-06-10T09:03:20.462Z)
OS version: Windows_NT x64 10.0.19041

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz (4 x 2592)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.90GB (1.68GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (7)
Extension Author (truncated) Version
html-snippets abu 0.2.1
vscode-eslint dba 2.1.5
vscode-npm-script eg2 0.3.12
output-colorizer IBM 0.1.2
luacoderassist liw 2.3.9
vscode-language-pack-zh-hans MS- 1.46.3
vetur oct 0.24.0

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions