aboutsummaryrefslogtreecommitdiffstats
path: root/queries/markdown
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2022-04-21 10:48:47 +0100
committerLewis Russell <me@lewisr.dev>2022-09-12 11:49:51 +0100
commit2eaf18826988f921ddb39e4a2e7d23d95bb0e52a (patch)
tree4d4d76fd369b82f7a0ab26725f9c24cef13e6250 /queries/markdown
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-2eaf18826988f921ddb39e4a2e7d23d95bb0e52a.tar
nvim-treesitter-2eaf18826988f921ddb39e4a2e7d23d95bb0e52a.tar.gz
nvim-treesitter-2eaf18826988f921ddb39e4a2e7d23d95bb0e52a.tar.bz2
nvim-treesitter-2eaf18826988f921ddb39e4a2e7d23d95bb0e52a.tar.lz
nvim-treesitter-2eaf18826988f921ddb39e4a2e7d23d95bb0e52a.tar.xz
nvim-treesitter-2eaf18826988f921ddb39e4a2e7d23d95bb0e52a.tar.zst
nvim-treesitter-2eaf18826988f921ddb39e4a2e7d23d95bb0e52a.zip
fix(fold): don't include whitespace end regions
Some languages that are difficult to parse via Treesitter may incorrectly include whitespace lines at the end of regions. This can makes the calculated folds sub-optimal. To recitfy, use a custom directive (trim), to calculate the range with the trailing whitespace lines removed. Note this only works if the region end column is 0. Also added folds for Make.
Diffstat (limited to 'queries/markdown')
-rw-r--r--queries/markdown/folds.scm15
1 files changed, 9 insertions, 6 deletions
diff --git a/queries/markdown/folds.scm b/queries/markdown/folds.scm
index efda6675f..5900f7ffb 100644
--- a/queries/markdown/folds.scm
+++ b/queries/markdown/folds.scm
@@ -1,6 +1,9 @@
-[
- (fenced_code_block)
- (indented_code_block)
- (list)
- (section)
-] @fold
+(
+ [
+ (fenced_code_block)
+ (indented_code_block)
+ (list)
+ (section)
+ ] @fold
+ (#trim! @fold)
+)