The documentation of hs-minor-mode
explains:
In C mode and related modes, blocks are delimited by braces, while in Lisp mode they are delimited by parentheses.
I use the mode to collapse objects while reading JSON files. This works fine, because JSON objects use curly braces. But it does not work for JSON arrays, because arrays are delimited by box brackets ([]
).
Is it possible to customize the delimiter in order to make curly braces and box brackets valid delimiters to collapse blocks?
Example:
{
"list": [
{
"id": 1
},
{
"id": 2
},
{
"id": 3
},
{
"id": 4
},
{
"id": 5
}
]
}
When I call hs-hide-block
from within the array, the object collapses to:
{...}
But I only want to collapse the array:
{
"list": [...]
}
And I still want to be able to collapse objects.
I am using "GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2021-03-28, modified by Debian". JSON files are opened in "JavaScript mode defined in ‘js.el’". I think this is js-mode
.