-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Description
Type: Bug
Go to any language configuration file for an extension with a grammar and set a language keyword as one of the bracket pairs. For example in the C# language extension set:
"brackets": [
["class", "something else"],
]
Open a source file and observe that class is highlighted as a dangling open bracket instead of as a language keyword.
In our case we are developing the AL language extension which defines a textmate grammar to identify the language keywords for highlighting: https://github.com/microsoft/AL
The AL language has single quotes for identifying strings and double quotes for identifiers with spaces, like SQL. So 'this is a string' while "This Is A Quoted Identifier".
AL uses "begin" and "end" to denote a block of code like Pascal, so they are added as brackets. The words "begin" and "end" can appear in quoted identifiers, but they are highlighted like brackets, even though they shouldn't, since the grammar identifies them as a quoted identifier.
Observe below that even though "action" is a keyword, it is not highlighted in the identifier. In contrast, "begin" is a bracket in addition to being a language keyword and it is highlighted incorrectly.

Why is this a bug and not a feature request?
Other keywords inside a quoted identifier are not highlighted. The bracket coloring algorithm should not override the coloring from the language grammar.
VS Code version: Code 1.73.1 (6261075, 2022-11-09T04:27:29.066Z)
OS version: Windows_NT x64 10.0.22621
Modes:
Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz (12 x 2592) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off 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_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 127.71GB (98.92GB free) |
| Process Argv | --crash-reporter-id 40adac50-eb0f-4716-90ae-dce9021bf772 |
| Screen Reader | no |
| VM | 0% |
Extensions (19)
| Extension | Author (truncated) | Version |
|---|---|---|
| vscode-sql-formatter | adp | 1.4.4 |
| vscode-sql-beautify | cla | 0.3.15 |
| gitlens | eam | 13.1.1 |
| lex-flex-yacc-bison | fau | 0.0.3 |
| vs-color-picker | lih | 1.0.0 |
| csharp | ms- | 1.25.2 |
| al | ms- | 11.0.0 |
| isort | ms- | 2022.8.0 |
| python | ms- | 2022.18.2 |
| vscode-pylance | ms- | 2022.11.30 |
| sarif-viewer | MS- | 3.3.3 |
| jupyter | ms- | 2022.9.1303220346 |
| jupyter-keymap | ms- | 1.0.0 |
| jupyter-renderers | ms- | 1.0.12 |
| vscode-jupyter-cell-tags | ms- | 0.1.6 |
| vscode-jupyter-slideshow | ms- | 0.1.5 |
| remote-wsl | ms- | 0.72.0 |
| cpptools | ms- | 1.12.4 |
| vscode-xml | red | 0.22.0 |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1cf:30587006
282f8724:30602487
gswce1:30612156
3d0df643:30613357
dbltrim-noruby:30604474
f6dab269:30613381