emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/treesit-fold 1d690b8d06 267/417: feat(python): Support ass


From: ELPA Syncer
Subject: [nongnu] elpa/treesit-fold 1d690b8d06 267/417: feat(python): Support assignment string
Date: Mon, 1 Jul 2024 10:02:33 -0400 (EDT)

branch: elpa/treesit-fold
commit 1d690b8d06b0b4d6c22ef1e6c71011900492028d
Author: JenChieh <jcs090218@gmail.com>
Commit: JenChieh <jcs090218@gmail.com>

    feat(python): Support assignment string
---
 ts-fold-parsers.el | 7 ++++---
 ts-fold.el         | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index d54fb55f50..43a24f96ab 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -54,7 +54,8 @@
 (declare-function ts-fold-range-lua-do-loop "ts-fold.el")
 (declare-function ts-fold-range-lua-repeat "ts-fold.el")
 (declare-function ts-fold-range-ocaml "ts-fold.el")
-(declare-function ts-fold-range-python "ts-fold.el")
+(declare-function ts-fold-range-python-def "ts-fold.el")
+(declare-function ts-fold-range-python-expression-statement "ts-fold.el")
 (declare-function ts-fold-range-ruby-class-def "ts-fold.el")
 (declare-function ts-fold-range-ruby-if "ts-fold.el")
 (declare-function ts-fold-range-rust-macro "ts-fold.el")
@@ -225,8 +226,8 @@
 
 (defun ts-fold-parsers-python ()
   "Rule set for Python."
-  '((function_definition  . ts-fold-range-python)
-    (class_definition     . ts-fold-range-python)
+  '((function_definition  . ts-fold-range-python-def)
+    (class_definition     . ts-fold-range-python-def)
     (list                 . ts-fold-range-seq)
     (dictionary           . ts-fold-range-seq)
     (expression_statement . ts-fold-range-python-expression-statement)
diff --git a/ts-fold.el b/ts-fold.el
index 92027a0de1..c826523cfe 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -97,7 +97,7 @@
 FUNCTION is used to determine where the beginning and end for 
FOLDABLE-NODE-TYPE
 in MAJOR-MODE.  It should take a single argument (the syntax node with type
 FOLDABLE-NODE-TYPE) and return the buffer positions of the beginning and end of
-the fold in a cons cell.  See `ts-fold-range-python' for an example."
+the fold in a cons cell.  See `ts-fold-range-python-def' for an example."
   :type '(alist :key-type symbol
                 :value-type (alist :key-type symbol :value-type function))
   :group 'ts-fold)
@@ -602,7 +602,7 @@ more information."
 
 ;;- OCaml
 
-(defun ts-fold-range-python (node offset)
+(defun ts-fold-range-python-def (node offset)
   "Define fold range for `function_definition' and `class_definition'.
 
 For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
@@ -621,7 +621,7 @@ more information."
 
 For arguments NODE and OFFSET, see function `ts-fold-range-seq' for
 more information."
-  (when-let* ((string-node (car (ts-fold-find-children node "string")))
+  (when-let* ((string-node (car (ts-fold-find-children-traverse node 
"string")))
               ;; the colon is an anonymous node after return_type or 
parameters node
               (beg (tsc-node-start-position string-node))
               (end (tsc-node-end-position node)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]