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 #1426

Closed
ris58h opened this issue Mar 21, 2022 · 11 comments
Closed

[folding] custom folding text for folded ranges #1426

ris58h opened this issue Mar 21, 2022 · 11 comments
Assignees
Labels
feature-request Request for new features or functionality folding ranges
Milestone

Comments

@ris58h
Copy link

ris58h commented Mar 21, 2022

Other IDE's like Visual Studio or Intellij IDEA allow to define custom text for folded regions.

There are a lot of issues that could be solved with this feature: microsoft/vscode#70794 , microsoft/vscode#3352 , #827 and other.

The proposed change is to add collapsedText property to FoldingRange interface:

interface FoldingRange {
	startLine: uinteger
	startCharacter?: uinteger
	endLine: uinteger;
	endCharacter?: uinteger;
	kind?: string;

        collapsedText?: string;
}

The problem is: what should clients that don't support char-ranges folding (lineFoldingOnly === true) do? I've described the problem in microsoft/vscode#70794
Possible options are:

  1. Clients must replace the whole first line too.
  2. Clients must show the collapsedText at the end of the first line.
  3. Clients are free to decide how they show it.
  4. Add a property to the FoldingRange to specify the behavior.
@dbaeumer dbaeumer added feature-request Request for new features or functionality folding ranges labels Mar 22, 2022
@dbaeumer dbaeumer added this to the Backlog milestone Mar 22, 2022
@aeschli
Copy link
Contributor

aeschli commented Mar 22, 2022

Having a collapsedText makes sense.
Following the current logic, for lineFoldingOnly === true, by default it will be shown at the end of the line.

To replace the full line, we could allow that the startCharacter can be set to 0, even when lineFoldingOnly === true.

@dbaeumer dbaeumer modified the milestones: Backlog, On Deck Mar 22, 2022
@ris58h
Copy link
Author

ris58h commented Mar 23, 2022

@aeschli it's a great idea to use startCharacter 👏
Do we need an additional property in FoldingRangeClientCapabilities to specify that client doesn't support collapsedText?

@aeschli
Copy link
Contributor

aeschli commented Mar 23, 2022

Yes, a new capability is needed. It will be false by default.

@ris58h
Copy link
Author

ris58h commented Mar 23, 2022

Ok. What's next? Should I make PR in https://github.com/microsoft/vscode-languageserver-node repository?

@dbaeumer
Copy link
Member

Yes, first we need to have an implementation for this.

@ris58h
Copy link
Author

ris58h commented Mar 29, 2022

The PR is ready microsoft/vscode-languageserver-node#910

@dbaeumer
Copy link
Member

@ris58h we would need a PR against the specification as well. Can you provide one so that this gets properly documented?

@ryzngard
Copy link
Member

@ris58h are you able to do a PR against the specification here? Definitely interested in this moving forward.

@ris58h
Copy link
Author

ris58h commented Apr 20, 2022

@ryzngard I'm interested too but I'm on vacation right now, so not in the very near future.

@ryzngard
Copy link
Member

I went ahead and created a PR in the meantime, which I hope is correct. Please let me know if anything needs to change.

@ris58h if you get back from vacation and want to take over by all means feel free.

@dbaeumer dbaeumer modified the milestones: On Deck, 3.17 Apr 25, 2022
@dbaeumer
Copy link
Member

Added to 3.17.

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

No branches or pull requests

4 participants