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] custom folding text for folded ranges #70794

Open
maptz opened this issue Mar 20, 2019 · 9 comments · May be fixed by #170447
Open

[folding] custom folding text for folded ranges #70794

maptz opened this issue Mar 20, 2019 · 9 comments · May be fixed by #170447
Assignees
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality
Milestone

Comments

@maptz
Copy link

maptz commented Mar 20, 2019

Currently when you create custom folds using a FoldingRangeProvider, there is no option to edit the text that is displayed when the text is folded. The editor just displays the first line of the fold with a three dots symbol after it.

#region Some region description...

It would be helpful if it was possible for FoldingRangeProvider instances to return ranges with a RangeDisplayName property that would be displayed when the folding range wass collapsed. I'd suggest that the display text would replace the ... symbol and the first line would no longer be displayed as per the behaviour in Visual Studio.

@vscodebot vscodebot bot added the editor-folding Editor code folding issues label Mar 20, 2019
@aeschli aeschli added the feature-request Request for new features or functionality label Mar 21, 2019
@aeschli aeschli added this to the Backlog milestone Mar 21, 2019
@aeschli aeschli changed the title [Folding]Allow you to customize folded text in API [folding] Allow you to customize folded text in API Mar 21, 2019
@aeschli aeschli changed the title [folding] Allow you to customize folded text in API [folding] custom folding text for folded ranges Mar 21, 2019
@Qhesz
Copy link

Qhesz commented Jul 18, 2019

Is there any scope for community contributions to this feature request?

@aeschli
Copy link
Contributor

aeschli commented Jul 19, 2019

PRs are always welcome, but I think this is not an easy fix.
https://github.com/microsoft/vscode/blob/master/src/vs/editor/contrib/folding/folding.ts is the starting point.
... are done with css :after decorations.

@ihdavids
Copy link

Being able to remove the fold indicator would also be really nice.
Modes like markdown could auto fold the link part of a link and unfold them as the cursor moves over a link to help declutter the visualization of the document being edited.

Emacs org mode does this for links and it is pretty slick.

@ris58h
Copy link
Contributor

ris58h commented Mar 21, 2022

I believe that before implementing this we need to answer a question: should we replace the whole first line or just the ... placeholder?

In Visual Studio #region
Screenshot 2022-03-21 at 16 29 36
folds to
Screenshot 2022-03-21 at 16 29 47
but function body
Screenshot 2022-03-21 at 16 40 04
folds to
Screenshot 2022-03-21 at 16 40 19

I know that Visual Studio operates with char-ranges instead of line-ranges, but in VSCode we only have line-ranges, so we have to deal with it and we need to decide what will be the behavior for line-folding.

@mtbaqer
Copy link

mtbaqer commented Nov 11, 2022

Hey, wanted to take a stab at this issue since it would be really helpful for the extension we are working on, but I don't see a help wanted label. So wanted to clarify the #70794 (comment) above, can we provide a community PR for this?

@aeschli
Copy link
Contributor

aeschli commented Nov 11, 2022

@mtbaqer Yes, PR's are welcome

@mtbaqer
Copy link

mtbaqer commented Nov 12, 2022

Great. Thanks for the clarification. One more question, I assume startCharacter can be be any value besides 0 as well? To replace parts of the first line? Or is there something in the current implementation that would stop that and we need to treat 0 as a special input?

@aeschli
Copy link
Contributor

aeschli commented Nov 14, 2022

VS Code only supports full lines to be folded. So startCharacter is ignored.

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

Successfully merging a pull request may close this issue.

6 participants