vscode-better-folding
vscode-better-folding copied to clipboard
Region folding stop to work with both the vscode-better-folding and vscode-explicit-folding extensions enabled
Describe the bug
- Region folding stop to work I have both the vscode-better-folding and vscode-explicit-folding extensions enabled.
- If I turn off the
vscode-better-folding
extension and reload the VSCode editor, the region folding works as it should. - The
vscode-explicit-folding
extension is used for languages that don't have region folding support only. - Notice that
vscode-better-folding
also does not respect theeditor.defaultFoldingRangeProvider
setting configured for any language.
To Reproduce
Steps to reproduce the behavior:
- Install both
vscode-better-folding
andvscode-explicit-folding
extensions in VSCode. - Configure some rules in the
vscode-explicit-folding
extension settings for any editor language you want. - Make sure that both extensions are enabled. Reload VS Code if needed.
- Open a file that has the region folding matching the former rules and notice that:
- Sometimes just the first region folds
- Sometimes no region fold.
- Files that doesn't have
vscode-explicit-folding
rules configured aren't affected and work as expected.
Expected behavior
- This extension should respect the folding when the
editor.defaultFoldingRangeProvider
setting. - One should fold/unfold regions with both extensions enabled even when the
editor.defaultFoldingRangeProvider
is not set.
Examples
Examples of settings and files to help explain the problem:
setttings.json
{
"[shell]": {
"editor.defaultFormatter": "mkhl.shfmt",
"editor.defaultFoldingRangeProvider": "zokugun.explicit-folding",
},
"explicitFolding.rules": [
{
"shellscript": {
"kind": "region",
"beginRegex": "#[\\s]*region[\\s]+([\\w]+)",
"endRegex": "#[\\s]*endregion",
},
}
]
}
example.sh
#!/bin/bash
#region Shell #1
ls -l
pwd
#endregion
#region Shell #2
whoami
man git
#endregion
## end of the file ##
my-workspace.code-workspace (workaround)
{
"settings": {
"betterFolding.excludedLanguages": [
"shellscript",
],
}
}
Workarounds
- Adding the languages with rules into the setting
betterFolding.excludedLanguages
works. This setting can be placed:- In then workspace settings JSON file (${workspaceFolder}/my.code-workspace)
- User settings settings JSON file (~/.config/Code/User/settings.json)
- But not in the folder settings JSON file (${workspaceFolder}/.vscode/settings.json)
- Disable vscode-better-folding
System Information
- OS: Ubuntu
- Versions:
- VS Code: 1.84
- vscode-better-folding: v0.5.1
- vscode-explicit-folding: v0.23.1
Additional context
Thanks for this wonderful extension.