Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Oct 10, 2017 · 10 comments
Open
Assignees
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality
Milestone

Comments

@ghost
Copy link

ghost commented Oct 10, 2017

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.

@vscodebot vscodebot bot added the emmet Emmet related issues label Oct 10, 2017
@ghost
Copy link
Author

ghost commented Oct 10, 2017

@ramya-rao-a this isn't actually emmet related. Emmet was noted simply to be an implementation option to reference.

@ramya-rao-a ramya-rao-a removed the emmet Emmet related issues label Oct 11, 2017
@ramya-rao-a ramya-rao-a assigned alexdima and unassigned ramya-rao-a Oct 11, 2017
@ramya-rao-a ramya-rao-a added the editor-folding Editor code folding issues label Oct 11, 2017
@ramya-rao-a
Copy link
Contributor

Thanks @jm-mwi. I have updated the labels accordingly

@alexdima alexdima assigned aeschli and unassigned alexdima Oct 21, 2017
@aeschli aeschli changed the title Code folding language abstraction [folding] folding regions in user settings Oct 23, 2017
@aeschli
Copy link
Contributor

aeschli commented Oct 23, 2017

@jm-mwi The configuration of the folding markers is already language specific, in the language's 'language-configuration' file. But its not part of the user settings yet.

@aeschli aeschli added the feature-request Request for new features or functionality label Oct 23, 2017
@aeschli aeschli added this to the Backlog milestone Oct 23, 2017
@Ptiloup
Copy link

Ptiloup commented 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>))"
	}
}

@aeschli
Copy link
Contributor

aeschli commented Jan 11, 2018

@Ptiloup Sure, please create a PR or a new issue!

@costincaraivan
Copy link
Contributor

costincaraivan commented 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.

@aeschli
Copy link
Contributor

aeschli commented Apr 3, 2018

@costincaraivan To vote for a feature please add a 👍 to the description

@daiyam
Copy link
Contributor

daiyam commented Jul 9, 2018

Hi,

I've done a quick experimental extension to add custom folding: Zokugun Folding.
The main problem is that I can't remove the existing folding so you get 2 folding providers...

@Braunson
Copy link

Braunson commented Apr 17, 2023

Any update to this? It would be nice to have the ability to define the open/end tags for regions.

Edit: Ended up using maptz.regionfolder

@daiyam
Copy link
Contributor

daiyam commented Apr 17, 2023

You could use https://marketplace.visualstudio.com/items?itemName=zokugun.explicit-folding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

7 participants