vscode-explicit-folding: Doesn't work in conjunction with indentation foldingStrategy.

Settings

"folding": {
  "*": [
    {
      "begin": "{",
      "end":   "}",
    }
  ]
}

 

Code Example

class Foo{
  
  bar(){
    return 1
  }
  
  baz()
    {return 2}
  
}

 

"editor.foldingStrategy": "auto"

  • bar is collapsed by the explicit strategy
    (expected)
  • baz is not collapsed
    (expected, not matched by current strategies)

Code_2020-11-02_12-58-13

 

"editor.foldingStrategy": "indentation"

  • bar is not collapsed by the explicit strategy
    (unexpected, this is the titular issue)
  • baz is collapsed by the indentation strategy
    (expected)

Code_2020-11-02_12-58-25

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (12 by maintainers)

Most upvoted comments

@daiyam, I see!
Yes, I think it works well. I will continue to test and follow up soon.

image

Very exciting!

@FicoPrieto I’ve made some small changes. Here the updated file explicit-folding-0.10.0.vsix.zip

I’ve published the new version of the extension.

@OSHI7 You can try with the config:

"folding": {
	"python": [
		{
			"separatorRegex": "#\\s*%%"
		},
		{
			"indentation": true,
			"offSide": true
		}
	]
}

@FicoPrieto Basically, I’m duplicating the builtin indentation provider into this extension. Since I don’t like the ideas to duplicate code and to add another provider into the extension. So I thought doing "editor.foldingStrategy": "explicit & indentation" was better (still is better). But at the end of the day, there were no “immediate” solutions for user who wanted to stick to VSCode. Then, yesterday, I had the issue #36 (about jupyter python) and I thought that the extension was kinda useless for python devs. So I decided to give you the choice.

@forivall @FicoPrieto I’ve changed my mind! The extension will support the config { "indentation": true }. It should be done in next days. So many users are already using it way beyond its initial purpose. Why not push it a little bit further 😉

@forivall, to do what you propose would be outside the scope of this extension.

But that could be done if editor.foldingStrategy supports a list of providers :

  • auto can become language | indentation
  • explicit & indentation would provide what you looking for

I can implement it in my version of VSCode.