[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/treesit-fold eeb9c03bcc 127/417: Fix conitouse line
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/treesit-fold eeb9c03bcc 127/417: Fix conitouse line |
Date: |
Mon, 1 Jul 2024 10:02:18 -0400 (EDT) |
branch: elpa/treesit-fold
commit eeb9c03bcc8583457d8a7cc5370c18b638c28df1
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: Jen-Chieh Shen <jcs090218@gmail.com>
Fix conitouse line
---
tree-sitter-fold-util.el | 8 ++++++++
tree-sitter-fold.el | 31 ++++++++++++++++++++-----------
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/tree-sitter-fold-util.el b/tree-sitter-fold-util.el
index 5caad71688..8873c13b06 100644
--- a/tree-sitter-fold-util.el
+++ b/tree-sitter-fold-util.el
@@ -78,5 +78,13 @@ Optional argument TRIM, see function
`tree-sitter-fold-util--get-face'."
Optional argument TRIM, see function `tree-sitter-fold-util--get-face'."
(tree-sitter-fold-util--is-face obj tree-sitter-fold-util--doc-faces trim))
+;;
+;; (@* "Math" )
+;;
+
+(defun tree-sitter-fold-util--in-range-p (in-val in-min in-max)
+ "Check to see if IN-VAL is between IN-MIN and IN-MAX."
+ (and (<= in-min in-val) (<= in-val in-max)))
+
(provide 'tree-sitter-fold-util)
;;; tree-sitter-fold-util.el ends here
diff --git a/tree-sitter-fold.el b/tree-sitter-fold.el
index 264c1a6703..3012c1f47d 100644
--- a/tree-sitter-fold.el
+++ b/tree-sitter-fold.el
@@ -350,12 +350,14 @@ then return the last iterated node.
Argument NEXT is a boolean type. If non-nil iterate forward; otherwise iterate
in backward direction."
- (let ((iter-node (tree-sitter-fold--next-prev-node node next)) text break
- (last-node node))
+ (let ((iter-node (tree-sitter-fold--next-prev-node node next)) (last-node
node)
+ (last-line (car (tsc-node-start-point node))) line text break)
(while (and iter-node (not break))
- (setq text (tsc-node-text iter-node))
- (if (string-prefix-p prefix text)
- (setq last-node iter-node)
+ (setq text (tsc-node-text iter-node)
+ line (car (tsc-node-start-point iter-node)))
+ (if (and (tree-sitter-fold-util--in-range-p line (1- last-line) (1+
last-line))
+ (string-prefix-p prefix text))
+ (setq last-node iter-node last-line line)
(setq break t))
(setq iter-node (tree-sitter-fold--next-prev-node iter-node next)))
last-node))
@@ -427,9 +429,11 @@ more information."
(defun tree-sitter-fold-range-c-preproc-else (node offset)
"Define fold range for `else' preprocessor."
- (when-let* ((beg (+ (tsc-node-start-position node) 5))
+ (when-let* ((target "#else")
+ (len (length target))
+ (beg (+ (tsc-node-start-position node) len))
(text (tsc-node-text node))
- (end (+ beg (length text) -5)))
+ (end (+ beg (length text) (- 0 len))))
(tree-sitter-fold-util--cons-add (cons beg end) offset)))
(defun tree-sitter-fold-range-python (node offset)
@@ -446,13 +450,18 @@ more information."
(end (tsc-node-end-position node)))
(tree-sitter-fold-util--cons-add (cons beg end) offset)))
-(defun tree-sitter-fold-range-ruby (_node _offset)
- "Define fold range for Ruby.
+(defun tree-sitter-fold-range-ruby-method (node offset)
+ "Define fold range for `method' in Ruby.
For arguments NODE and OFFSET, see function `tree-sitter-fold-range-seq' for
more information."
- ;; TODO: ..
- (progn ))
+ (let* ((named-node (tsc-get-child-by-field node :name))
+ (parameters-node (tsc-get-child-by-field node :parameters))
+ (end-node (tsc-get-child-by-field node :end))
+ (beg (tsc-node-end-position parameters-node))
+ (end 0))
+ (jcs-print ">" end-node)
+ (tree-sitter-fold-util--cons-add (cons beg end) offset)))
(defun tree-sitter-fold-range-rust-macro (node offset)
"Return the fold range for `macro_definition' NODE in Rust.
- [nongnu] elpa/treesit-fold 76e0dd263e 088/417: Hide indicators when single line, (continued)
- [nongnu] elpa/treesit-fold 76e0dd263e 088/417: Hide indicators when single line, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 8fc88e29f5 089/417: Login update for Csharp comment, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 809bc9a0db 090/417: Remove go decalaration, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 422cff043e 100/417: Fix comment line, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2d2179292f 105/417: Fix doc string, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 5062bf22a8 112/417: Mark temp, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 959191660b 115/417: Simplify, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 7065c6b28f 122/417: Apply macro, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold f49df1ea3d 124/417: Update doc, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6f15c1735a 125/417: Support javascript comment, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold eeb9c03bcc 127/417: Fix conitouse line,
ELPA Syncer <=
- [nongnu] elpa/treesit-fold c33e5e7e0c 128/417: Temporily disable csharp, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6b6f30eb4a 142/417: Add emoji, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 6aabbc6256 147/417: Update doc, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold e6ac78f0e2 154/417: SCALE AND CENTER, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold a806886568 161/417: Update support language list, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 2409596f33 004/417: readme: fix typo, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold 362fc74774 011/417: R: fold brace_list instead, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold f0858f1dbc 009/417: add support for R, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold b3faaaa40d 015/417: support folding nix functions, ELPA Syncer, 2024/07/01
- [nongnu] elpa/treesit-fold de5ad4b2f2 063/417: Split uitl, ELPA Syncer, 2024/07/01