How to only apply rules to files with custom extension?
Describe the issue
I have a file whose ext is .jscasm. How do I only apply rules to it?
I tried the following settings, but it doesn't work.
"explicitFolding.rules": {
".jscasm": [
{
"beginRegex": "Bytecode age: ",
"endRegex": "Constant pool \\(size = ",
"foldLastLine": false
},
{
"beginRegex": "; #region",
"endRegex": "; #endregion",
"foldLastLine": true
}
]
}
Settings
"explicitFolding.rules": {
".jscasm": [
{
"beginRegex": "Bytecode age: ",
"endRegex": "Constant pool \\(size = ",
"foldLastLine": false
},
{
"beginRegex": "; #region",
"endRegex": "; #endregion",
"foldLastLine": true
}
]
}
".jscasm" won't work. It should be the language identifier.
".jscasm"won't work. It should be the language identifier.
Thanks for your reply! But there is no corresponding language identifier. This is a very niche file extension.
If it's still a Javascript file, you could use explicitFolding.perFiles
If it's still a Javascript file
It is a plaintext file. So I tried the following settings, but it not work.
"[plaintext]": {
"editor.foldingStrategy": "auto",
"editor.defaultFoldingRangeProvider": "zokugun.explicit-folding",
"explicitFolding.perFiles": {
"*.jscasm": [
{
"beginRegex": "Bytecode age: ",
"endRegex": "Constant pool \\(size = ",
"foldLastLine": false
},
{
"beginRegex": "; #region",
"endRegex": "; #endregion",
"foldLastLine": true
}
]
}
}
By the way, explicitFolding.rules works but is for all plaintext.
.jscasm file example:
Parameter count 1
Register count 1
Frame size 8
Bytecode age: 0
0 S> 000000CD0011448A @ 0 : 80 00 00 00 CreateClosure [0], [0], #0
000000CD0011448E @ 4 : c4 Star0
219746 S> 000000CD0011448F @ 5 : a9 Return
Constant pool (size = 1)
000000CD00114491: [FixedArray] in OldSpace
".jscasm"won't work. It should be the language identifier.
the extension i am concerned with is language independent, think of it as similar to a templating language.
so, sometimes i am writing in python, or md or rst in it... so, how would the explicitFolding.perFiles help in that case?
I tried the following settings, but [the ability to select only the particular file extensions] not work. - @cesaryuan at https://github.com/zokugun/vscode-explicit-folding/issues/109#issuecomment-1832993628
@ daiyam any input on that?
I can confirm the issue with the explicitFolding.perFiles. Looking into it.
I've found and fixed the bug... It will available in the next version
It has been fixed in the newest version.