Repository navigation
Add code folding support - #99
Conversation
Meallia
left a comment
There was a problem hiding this comment.
Added suggestions to use single quotes for indented string.
JojOatXGME
left a comment
There was a problem hiding this comment.
Great contribution. 🚀 Sorry for not responding earlier. I left some comments, but I would be happy to merge the PR as it is. Just mention your preference whether you would favor to act on some comments first.
|
|
||
| override fun visitBindInherit(o: NixBindInherit) { | ||
| if (o.attributes.isNotEmpty()) { | ||
| val placeholderText = if (o.source == null) {" ... "} else {" (${o.source!!.node.text}) ... "} |
There was a problem hiding this comment.
issue o.source can contain an arbitrary expression.
let
inherit
(
rec {
a = b;
b = c;
c = 42;
}
)
a;
in
aHowever, I don't think this is a big issue. Nobody forces a user to fold this region, as isCollapsedByDefault returns false. Besides, having a long expression here seems rather uncommon.
|
Also feel free to add a line to the CHANGELOG.md. However, if you do that, you might want to rebase this PR (or merge |
|
Thanks for the review, I'll try to implement your suggestions. |
8aaccd9 to
d839f7c
Compare
| @@ -0,0 +1,5 @@ | |||
| <fold text='{ ... }'>{ | |||
| <fold text='custom'># region custom | |||
There was a problem hiding this comment.
praise 🎉: I did not think about region comments. I guess using CustomFoldingBuilder is useful even without having another plugin depending on this one.
|
Nice work. I merged your PR. I will probably create a release with your changes over the weekend. |

Followup to PR #92 by 0xcaff
letandinheritexpressionsNotes on strings
The folding test framework cannot match single quotes in folding placeholders.
I tried to replace them with
\',',', but there is no logic to un-escape the text before the comparison is made.I also tried defining a subclass with a different placeholder specifically for the tests, but I could not figure out how to use it during testing.
As a result, I choose to use double quotes (
" ... ") as placeholder for all string types, but we could also remove the test for indented strings and use'' ... ''as placeholder.