question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[folding] allow defining folding regions in user settings and/or extensions

See original GitHub issue

Would it be able to abstract out the language specifics and treat code folding similar to how emmet handles it… i.e.

    "emmet.includeLanguages": {
        "php": "html",
        "blade": "html",
        "javascript": "javascriptreact"
    },

So for code folding it could be…

    "codeFolding.IncludeLanguages": {
        "php": {
            "openTag": "//#region",
            "closeTage": "//#endregion"
        },
        ...etc...
    }

This is just an off the cuff idea for implementing this and I’m not sure that it’s possible, but the goal would be to not be dependent on the language plugin developers to implement the feature.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:38
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

10reactions
costincaraivancommented, Apr 3, 2018

This is a sort of +1 comment. Please expose these settings directly in the user settings so that we don’t have to go mucking about with PRs for each and every language.

See also my comment from the Vim issue. Ideally there would also be a catch-all folding marker for all the files that don’t necessarily have a plugin, so that you can still get folding even if VS Code does not have explicit support for the specific file type.

Something like:

"codeFolding.IncludeLanguages": {
        "*": {  // Maybe use "any" or "all" instead of just "*" as the wildcard?
            "openTag": "//#region",
            "closeTag": "//#endregion"
        },
        ...etc...
 }

This helps with the use case of using VS Code as a generic editor, a replacement for Notepad++, Sublime Text, Vim, etc.

3reactions
Ptiloupcommented, Dec 28, 2017

Is it possible to add to javascript-language-configuration.json the “editor-fold” tag ?

"folding": {
	"markers": {
		"start": "^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))",
		"end": "^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))"
	}
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

region folding for VS Code - Visual Studio Marketplace
Visual Studio Code Custom Folding Extension. This extension enhances the default code folding abilities of Visual Studio Code editor.
Read more >
vscode extensions - When folding a line in VS Code is it ...
This new feature gives users complete control over line folds, by total I mean, when & where. Fold Selection allows you to fold...
Read more >
Collapse and expand regions of code - Visual Studio (Windows)
Learn how you can use the expand and collapse commands to work in outline ... Options > Environment > Fonts and Colors >...
Read more >
The Problem With Code Folding - Coding Horror
Don't let them simmer. For me, the use of #region is one of those things. ... Folding is used to sweep code under...
Read more >
VS Code tips — Folding all regions in a file - YouTube
Today's VS Code command: Fold all regionsQuickly collapse all regions in a file.Expand the individual regions you are intersected in or use ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found