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

How are the startCharacter and endCharacter properties on folding ranges defined? #1198

Closed
msujew opened this issue Feb 11, 2021 · 6 comments
Assignees

Comments

@msujew
Copy link

msujew commented Feb 11, 2021

We are currently in the process of implementing folding support for Xtext. (eclipse/xtext-core#1672)

There has been some discussion regarding the use of the startCharacter and endCharacter properties of the FoldingRange. It's not quite clear how exactly these are defined. Especially since I couldn't find any reference implementation and vscode only uses line based folding, so I couldn't test it either.

Could someone please give some clarification on how these are defined? An actual example would be highly appreciated.

@dbaeumer
Copy link
Member

dbaeumer commented Mar 1, 2021

@aeschli can you please clarify. Thanks!

@aeschli
Copy link
Contributor

aeschli commented Mar 1, 2021

startLine/startCharacter - endLine/endCharacter define a Range. That's the range that is hidden when that folding range is collapsed.

@msujew
Copy link
Author

msujew commented Mar 1, 2021

@aeschli Right, I think my question wasn't clear enough: Are the startCharacter and endCharacter properties indices of the full document string or are they defined as the column of the startLine/endLine?

@KamasamaK
Copy link
Contributor

KamasamaK commented Mar 1, 2021

Based on them defaulting to the length of the relevant line, it should be the column of the line.

@aeschli
Copy link
Contributor

aeschli commented Mar 3, 2021

Yes, character is the offset in the line. In LSP all positions are line/character (like line/column except that columns typically start with 1, while characters start with 0)
In editors that only support folding full lines (such as VSCode), the line at startLine gets the folding marker, but when folded, is still fully visible.

image

You can say it folds after the last character of the first line. That's why the comment says: defaults to the length of the line

@msujew
Copy link
Author

msujew commented Mar 3, 2021

I see, thank you for your explanation. I will close this issue.

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

No branches or pull requests

4 participants