The Wayback Machine - https://web.archive.org/web/20230107075952/https://github.com/microsoft/vscode/pull/170447
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

Support Collapsed Text #170447

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft

Support Collapsed Text #170447

wants to merge 23 commits into from

Conversation

mtbaqer
Copy link

@mtbaqer mtbaqer commented Jan 3, 2023

Description

Adds VSCode client implementation of LSP's collapsed text.
Allows for custom collapsed text instead of the default ..., and the ability to start folding anywhere in the start line not only at the very end. See the demo below.

Demo

Screenshot 2023-01-02 at 15 45 35

Screenshot 2023-01-02 at 15 45 53

Issues

Should make following issues trivial to solve:

Does a lot of heavy lifting for (but still requires some work):

Changes

  • Adds two fields to almost all inner folding interfaces/classes (FoldingRange, FoldingRegion, etc.):

    • collapsedText: text to display
    • startColumn: where the folding should start at the start line. More details here.
  • Changes FoldingDecorations to dynamically construct collapsed decorations to include collapsed text (currently little messy, will make a future refactor PR to reduce the size of this one).

  • Introduces new InlineFoldingRange class to support the custom startColumn.

  • Adds new hideContent field to ModelDecorationOptions to support InlineFoldingRange.

  • Modifies ModelLineProjection, ModelLineProjectionData and related classes to support inlineFoldingRange.

  • Adds new test cases and modifies current ones for most classes touched.

Note: The current implementation assumes InlineFoldingRange decorations are located in the same InjectedText decoration tree. This can be changed in future updates.

PR Draft

Draft because I could some help with vscode.d.ts proposal and best place for enforcing isProposedApiEnabled

@mtbaqer
Copy link
Author

mtbaqer commented Jan 3, 2023

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[folding] custom folding text for folded ranges
2 participants