Reputation: 8365
I have a habit of using code editors for notes in the following fashion:
a topic
. a note
? a question regarding the note
- a to do item
. some more details
. another note
. more details
another topic
...
What I like about VS Code is that it allows to fold (collapse) blocks in txt files based on their indentation (like for Python):
a topic
+ . a note
. another note
. more details
another topic
...
What I don't like, though, is that it also includes empty lines into collapsed blocks: the line after . more details
has no indentation, but when I collapse that block I get
a topic
+ . a note
+ . another note
another topic
...
while I want it to be
a topic
+ . a note
+ . another note
another topic
...
Can you suggest what options should I change to get this difference about collapsing?
Upvotes: 12
Views: 1472
Reputation: 8365
While not an ideal, a quick and dirty solution that one can use today is to set custom ranges: in the example above,
. another note
. more details
another topic
put the cursor after "note" and select the text to the end of "details", then press ctrl+k
, ctrk+,
("Create Folding Range from Selection"). The result will be
+ . another note
another topic
as needed; the obvious downside is that one has to create such ranges manually. But if you have not that much problematic blocks, it can be good enough (at least it's quick and doesn't require any plugins).
Upvotes: 0
Reputation: 315
I don't know of a way to prevent the last line from being folded in VS Code, unless you use a 3rd party extension.
If you search extensions for 'folding' you should see several. Explicit Folding appears to have options to control this. But there are a lot more. Take a look & see if one fits your needs. If not then the only way to get this would be to develop an extension to handle this the way you want.
Upvotes: 1