Skip to content

Curly brace matching with #if blocks is broken #251664

Closed as duplicate
Closed as duplicate
@pcd1193182

Description

@pcd1193182

Type: Bug

Curly braces inside of an #if or #else block that the compiler thinks is disabled still trigger brace matching for syntax highlighting purposes. Easy to see with a simple test:

static void foo() {
#if _FOO
  {
#else
  {
#endif
  }
}

Will show the initial opening brace as unmatched. If #if 0 is used instead, the matching works.

VS Code version: Code 1.96.3 (Universal) (91fbddd, 2025-01-09T18:14:09.060Z)
OS version: Darwin arm64 24.5.0
Modes:

System Info
Item Value
CPUs Apple M4 Pro (14 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) 2, 3, 3
Memory (System) 48.00GB (0.64GB free)
Process Argv --crash-reporter-id 81153304-b393-4964-8802-423b810eea98
Screen Reader no
VM 0%
Extensions (5)
Extension Author (truncated) Version
geminicodeassist goo 2.33.0
cmake-tools ms- 1.20.53
cpptools ms- 1.25.3
cpptools-extension-pack ms- 1.3.1
cmake twx 0.0.17

(2 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt551cf:31249601
vscod805cf:30301675
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
pythonrstrctxt:31112756
nativeloc2:31192216
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
c7cif404:31313793
996jf627:31283433
pythonrdcb7cf:31303019
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
pylancecolor:31309108
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions