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

FoldingRangeKind that isn't Region or Comment (to support syntactic folds) #55686

Closed
rjmholt opened this issue Aug 2, 2018 · 4 comments
Closed
Assignees
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality
Milestone

Comments

@rjmholt
Copy link

rjmholt commented Aug 2, 2018

From PowerShell/vscode-powershell#1458 (comment).

We've implemented syntax/AST-based folding in the PowerShell extension, but the folding ranges it designates must be labelled with a FoldingRangeKind.

Region was chosen for syntax folds, since (for example) an if-block is not a Comment or an Import. But this means using "(Un)fold All Regions" toggles syntax-based folding as well, when a user might only want to fold explicit #regions.

Our current prospective solution is to assign a FoldingRangeKind of -1 or similar (which seems to work). But naturally that's not an ideal solution.

Is there currently a supported way of distinguishing #region folding ranges from custom syntactic folding ranges?'

(Also, I imagine that adding new enum values into FoldingRangeKind to cater to increasingly granular folding ranges would be infeasible -- just more an illustration of our current workaround.)

@vscodebot
Copy link

vscodebot bot commented Aug 2, 2018

@vscodebot vscodebot bot added editor editor-folding Editor code folding issues labels Aug 2, 2018
@aeschli
Copy link
Contributor

aeschli commented Aug 3, 2018

Region is only to be used for ranges originating from folding range marked by #region and #endregion

For syntax ranges, don't set kind. kind is optional.

@aeschli
Copy link
Contributor

aeschli commented Aug 3, 2018

I will improve vscode.d.ts spec comment.

@aeschli aeschli closed this as completed Aug 3, 2018
@aeschli aeschli added the feature-request Request for new features or functionality label Aug 3, 2018
@aeschli aeschli added this to the July 2018 milestone Aug 3, 2018
@rjmholt
Copy link
Author

rjmholt commented Aug 4, 2018

Thanks @aeschli!

@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants