-
Notifications
You must be signed in to change notification settings - Fork 97
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 mix of Attributes and single-line comments #733
base: master
Are you sure you want to change the base?
Folding mix of Attributes and single-line comments #733
Conversation
a12d3cf
to
f95b2fe
Compare
It removes the possibility to have Folding range for the first group of attributes or first group of single-line comments. This is due to a limitation of VS Code which doesn't handle several folding ranges starting on the same line. resolves asciidoctor#719 Signed-off-by: Aurélien Pupier <[email protected]>
f95b2fe
to
d122d27
Compare
Arguably, we could collapse the document header when we click on the document title. The downside is that you cannot collapse the entire file but is that really useful? Would it simplify the logic? |
I do not understand why it would interfere with collapsing the whole file. I feel like what would be interesting would be to implement the folding for each section delimited by |
I believe that, currently, if you fold on the document title, it will fold the whole document, correct? What I'm proposing is that if you fold on the document title, it will only fold the document header (i.e. document attributes, author line, etc...). By doing that, my guess is that you can simplify the logic for attributes folding? You can fold a group of attributes until a comment or an empty line is found. |
noFoldOnDocumentTitle.mp4no, there is no fold on the document title |
So implementing it this way will effectively simplify code but I think having the fold of a whole "titled section" is more interesting. Another side thoughts, if a folding section is missing, end users are nto block and can create their own custom folding section https://code.visualstudio.com/docs/editor/codebasics#_fold-selection |
What do you mean? My idea was to have a special fold on the document title (single
Oh I didn't know that! We should probably mention that in the documentation! |
I think I understand what's bothering you with my proposal.
Having said that, I don't think this is a common use case. The document header is where we usually have a mix of comments and attributes. Attributes defined in the body of the document are "rare". It's also extremely uncommon to have a block of comments/attributes in the body. So I think we should fold attributes until we found a comment or something that's not an attribute. Does it make sense? |
I think it's difficult to decide because it depends 😄 In the example below, we most likely want to fold all the attribute entries + comment:
However in the following example I would argue that we want to fold per "group":
In other words, comments are used as headers/delimiters so it makes sense to fold the localization group, the reveal.js options group and the style group independently. For reference, the Intellij IDEA extension does not seem to provide this feature. @mojavelinux @ahus1 I would love your input on this issue 🥺 |
My intuition says that groups of attribute entries would be folded behind a leading line comment (the line comment being the fold line). (I'm not sure if that's feasible to implement, but it would make sense to me as a user). |
I agree 👍🏻 |
It removes the possibility to have Folding range for the first group of attributes or first group of single-line comments. This is due to a limitation of VS Code which doesn't handle several folding ranges starting on the same line. This limitation lead me to add some non negligeable code complexity.
resolves #719
FolginGroupOfAttributesAndSingleLineComments.mp4