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

[Request] Character positions to improve fold text #111064

Closed
Colengms opened this issue Nov 20, 2020 · 2 comments
Closed

[Request] Character positions to improve fold text #111064

Colengms opened this issue Nov 20, 2020 · 2 comments
Assignees

Comments

@Colengms
Copy link
Contributor

Colengms commented Nov 20, 2020

This is similar to #50840 , but does not require supporting multiple folding ranges within the same line. Rather, this request is to accept character positions referring to the first and last lines of existing line-granular folding ranges, used only for the purpose of composing the fold text.

Our provider folds blocks down to a single line. For example:

if (b)
{
}

if (b) {
}

do {
    int i;
} while (b);

{
}

Currently fold down to:

if (b)...

if (b) {...

do {...

{...

Note that some syntax can lead to omitting code that wasn't intended to be folded, or showing unmatched braces.

We also have an issue due to the fact that a range may start or end in the middle of a line. For example:

    if (b) { int i;
    } else {
    }

    {
    int j; } int k;

Folds into:

if (b) { int i;...
}

{...

Suggestion: accept start and end character positions for the folded range, and use them to infer the appropriate text to display before and after the fold. For example:

if (b) { int i;
    int i;
int k; } // comment

For the above, we would provide a range of lines 0-2 (all of it), but would indicate start position 8 and end position 7. VS Code could use this info, and existing colorization information, to build the fold text:

if (b) {...} // comment

Similarly, it would clean up:

do {
    int i;
int kj; } while (b);

Such that it's displayed as:

do {...} while (b);
@vscodebot
Copy link

vscodebot bot commented Nov 20, 2020

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@aeschli
Copy link
Contributor

aeschli commented Nov 23, 2020

We currently have no plans for inline foldings. It would require some major work on the editor widget side.
Duplicate of #50840

@aeschli aeschli closed this as completed Nov 23, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants