-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Use Treesitter for folding #523
Conversation
How are you testing this? When I disable Also, I might be missing something here, but wouldn't adding |
Do you mind sharing your config regarding In any case, I first need to figure out why we haven't been using treesitter for this up until now. If we can catch all the features we had so far also with treesitter, we can merge this. One more thing: I'm not able to fold tables in emacs orgmode. The |
btw, the tests are failing due to incorrect styling. Please run |
Apparently I had ufo, without it, folding the table doesn't work. 🤔 I'm sorry for the confusion. But that's why it's a draft, and that's why I'm not in rush with styling changes/removing orgmode's folding. |
No worries 😁 well, I'm not absolutely sure but I had the impression that folding tables was working for me yesterday. Might confuse it with property drawers though |
I'm not trying to be a dick, but currently the folding provided by the plugin works terribly. For me, it would make perfect sense remove all such functionality and move this job to things which do it well and consistently: treesitter, ufo (we probably can do it without ufo, I just don't know how). But the plugin is great otherwise 😄 (for now, I'm on my own fork of it).
Yes, but not with tab, but with default vim keys. |
I am all for moving this to treesitter, but like I said, I first need to check what we are doing differently in our custom foldexpr and why. Regarding the edit: but I guess you can merge my branch into yours then 🤷♂️ |
I didn't give this a test, but folding in here is a bit more complicated than folding in a more standard syntax like a programming language. I would suggest to also add |
Gave it a quick test. This might actually work better than the current solution since it handles a few edge cases.
|
Very nice, now it works without ufo and it doesn't annoyingly autofold. |
LGTM. @jgollenz can you also confirm if everything works as expected for you? Just want to make sure I didn't miss something. We will merge this and I'll write it on announcement issue that we switch to TS folding, just in case someone runs into some issue. |
hold up it doesn't work |
After a revisit:
|
Can you elaborate what's wrong without UFO? |
There must be something that UFO overrides that I didn't |
I think it works with UFO because it refreshes the folds fairly often, while without UFO that doesn't happen until you force edit the buffer or do |
Slightly different, but close 🤔 . |
Good point about zx btw, it fixes folding in both regular orgmode and now with TS |
I'll be merging this in since I don't see any difference in behavior between the current implementation and TS one. We can always revert it in case people find some issues with it. Thanks for the PR! |
We should not forget about removing our custom foldexpr after some time, since it's dead code now. |
Yeah, I plan to do this once we make sure the current solution works. |
Tangent: do you think we can move things from I actually think it's weird how this is handled in vim, given that a space just makes sense as a fillchar imo 🤷 In any case, I just think it would be handled cleaner in lua and pushes down our vimscript usage even further, which is a good thing in my book 😁 |
Since we are on v0.8+, I think we could move all the |
Ok so
This is a truly amazing plugin
However, folding really works like shit for some reason. It always breaks. Here's a simple example:
I know it can collapse properties and other neat stuff. However, I personally don't need it. For me, it now collapses sections just perfectly, and I keep my sanity.