Repository navigation
Description
Type: Bug
#95287 is a closed feature request to enable //#region folding in jsonc, but it actually is already implemented by vscode-json-languageservice: https://github.com/microsoft/vscode-json-languageservice/blob/fe686d59243664c413654dd6778878c7e0e0ce69/src/services/jsonFolding.ts#L60-L62
However, these are provided only as folding ranges by the language server, and not actually marked as regions in the language-configuration.json. As a result, minimap section headers (#74843) do not work in jsonc like they do in other languages, and region folding does not work without json-language-features enabled.
Example configuration to reproduce:
{
"editor.showFoldingControls": "always",
// MARK: Foo
//#region Bar
"editor.minimap.showRegionSectionHeaders": true
//#endregion
}Expected: to see Foo and Bar section headers in the minimap
Actual: only Foo appears in the minimap
Proposed fix(es):
-
add folding matchers for
#region/#endregionto https://github.com/microsoft/vscode/blob/main/extensions/json/language-configuration.json, to matchvscode-json-languageservice. This is how the feature works for e.g. TS/JS, from what I can tell. -
Support
showRegionSectionHeadersfor language-server folding regions, not justlanguage-configuration.jsonregions. This would more generally solve the issue for all languages with LSP region folding, and is probably preferable in the long run if feasible. -
Allow the new minimap section headers to use configurable tags #209904 may provide a workaround, but I don't think users should be required to configure this just for
jsoncsupport, since the same thing already works in other languages without extra configuration.
Edit: #213489 and #213275 are related as well, relating to specific other languages. I guess a more general solution would probably benefit those as well...
VS Code version: Code - Insiders 1.91.0-insider (aea213b, 2024-06-28T05:58:10.770Z)
OS version: Darwin x64 23.5.0
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (16 x 2300) |
| 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_graphite: disabled_off video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled webgpu: enabled |
| Load (avg) | 2, 3, 3 |
| Memory (System) | 32.00GB (0.04GB free) |
| Process Argv | --crash-reporter-id 58c9d45f-6b80-48d3-8c0b-d09f8a479b86 |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
vsaa593cf:30376535
py29gd2263:31024238
c4g48928:30535728
vscrpc:30624061
2i9eh265:30646982
962ge761:30841072
pythongtdpath:30726887
welcomedialog:30812478
pythonnoceb:30776497
asynctok:30898717
dsvsc013:30777762
dsvsc014:30777825
dsvsc015:30821418
pythonregdiag2:30926734
pythonmypyd1:30859725
2e7ec940:31000449
pythontbext0:30879054
accentitlementst:30870582
dsvsc016:30879898
dsvsc017:30880771
dsvsc018:30880772
cppperfnew:30980852
pythonait:30973460
jchc7451:31067543
chatpanelt:31014475
01bff139:31013167
a69g1124:31018687
dvdeprecation:31040973
dwnewjupytercf:31046870
impr_priority:31057980
nativerepl1:31071684
refactort:31084545
pythonrstrctxt:31083681
Activity
[json] add #region folding markers to language configuration (#318515)