-
Notifications
You must be signed in to change notification settings - Fork 35
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
Implement region markers for code folding #5
Comments
I do not quiet understand what is your need. The syntax of beancount is simple and I do not know where we will need to fold codes. Can you provide an example of codes needed to be folded? Also what do the codes look like after they are folded? Thank you. |
What I had in mind was the following, but specifically for the beancount language: To allow you to structure your beancount file a la "org-mode." One example where code folding might be of use is if you break down transactions, say, by Country. And you want to keep them separate, in their own country list. After folding, it might look something like this: All that said, I actually found a way to use VSCode's built-in folding functionality to make this work. Thanks for hearing me out, and thanks for the extension. |
Sorry to comment on a closed issue, but I'm really curious how you got it to work with VSCode's built-in folding without a change to the beancount plugin? |
@vloris: VS Code uses indentation to define folding regions. VS Code explains it as such: "Folding regions are evaluated based on the indentation of lines. A folding region starts when a line has a smaller indent than one or more following lines, and ends when there is a line with the same or smaller indent." More here: https://code.visualstudio.com/docs/editor/codebasics#_folding So, say you have something like this: If you move your mouse over the gutter on the left and click the square with the dash in the center, that'll fold the conent below (when things are folded a + will appear). If you click the top one (the one next to "Some header), everything below will be folded: Or if you click the second one, only what's below will be folded: Which means, you can use this to your benefit whilst still abiding by beancount's syntax constraints (and so your beancount file passes If you're aiming for more nested regions, you could do something like this which is a bit hacky but effective nonetheless: You can comment out the I'm sure there might be better ways to handle this, but for now, this kind of code folding is sufficient for my purposes. Cheers. |
beancount does fine with indented `pushtag` and `option` directives, but this extensions syntax didn't recognize it why indent? for folding, as outlined in Lencerf#5 I prefer indenting over the `;#region` syntax since it's more editor independant test plan: I used it locally with my own file and syntax highlighting looked fine with the indentation
Would it be possible to implement region markers for code folding (and thus better beancount doc organization) in VS Code?
For instance: https://code.visualstudio.com/updates/v1_17#_editor
The text was updated successfully, but these errors were encountered: