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

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

[nongnu] elpa/treesit-fold 8972eb674e 391/417: feat: Fully support isear


From: ELPA Syncer
Subject: [nongnu] elpa/treesit-fold 8972eb674e 391/417: feat: Fully support isearch and modification conditions (#1)
Date: Mon, 1 Jul 2024 10:03:09 -0400 (EDT)

branch: elpa/treesit-fold
commit 8972eb674e4f40e8bcb356565c14f75a38773fd2
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: GitHub <noreply@github.com>

    feat: Fully support isearch and modification conditions (#1)
    
    * feat: Fully support isearch and modification conditions
    
    * chore: changelog
---
 CHANGELOG.md    | 76 ++-------------------------------------------------------
 Eask            |  2 +-
 treesit-fold.el | 30 ++++++++++++++++++++---
 3 files changed, 29 insertions(+), 79 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b0a34a3ff..5903da3f51 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,79 +5,7 @@ All notable changes to this project will be documented in this 
file.
 Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on 
how to structure this file.
 
 
-## 0.4.0 (Unreleased)
+## 0.1.0 (Unreleased)
 > Released N/A
 
-* Add `LLVM` support (#103)
-* Add `ActionScript` support (#106)
-* Add `Tablegen` support (#107)
-* Add `LLVM MIR` support (#108)
-* Add `MATLAB` support (#110)
-* Add `Ninja` support (#112)
-* Add `Svelte` support (#116)
-* Add `Haxe` support (#117)
-* feat: Add more `Zig` folding rules (#118)
-
-## 0.3.0
-> Released Nov 29, 2023
-
-* Add `Noir` support (#77)
-* Improve `Elixir` UX (#78)
-* Add `VHDL` support (#79)
-* Add `XML` support (#80)
-* Add `Jsonnet` support (#81)
-* Add `Zig` support (#82)
-* Add `Erlang` support (#83)
-* Add basic `Pascal` support (#84)
-* Add `CMake` support (#85)
-* Add `Assembly` support (#87)
-* perf: Speed up count matches (#88)
-* Add `reStructuredText` support (#89)
-* Add `Make` support (#90)
-* Add `SQL` support (#91)
-* Add `Common Lisp` support (#92)
-* Add `HLSL` support (#93)
-* Add `GLSL` support (#94)
-* Add `Arduino` support (#95)
-* Add `Fish` support (#96)
-* perf: Render indicators in display range (#97)
-* fix: Don't render indicators on non-foldable node 
(342eb5ee1f242ac03bc7e7bbe8d67be8711423ae)
-* Add `Groovy` and `Jenkinsfile` support (#98)
-* Add `Org` support (#100)
-* Add `Mermaid` support (#101)
-
-## 0.2.0
-> Released Sep 01, 2023
-
-* Support `Elixir` (#10)
-* Render indicators once it's mode is enabled (#19)
-* `OCaml` parser and first functions added (#21)
-* Enhance `Ruby` parser (#26)
-* `Julia` language support (#33)
-* Remove redundant fold node alist (#36)
-* Change global mode to turn on with tree-sitter (#41)
-* Add minor-mode `treesit-fold-line-comment-mode` for line comment folding 
(#45)
-* Improve folding for C preprocessor operators (#46)
-* Add more folding definitions (#51)
-* Add support for `Lua` (#52)
-* Add support for `Python` docstring (#58)
-* Add `Dart` support (#62)
-* Add `Elisp` support (#63)
-* Add `Clojure` support (#64)
-* Add `Haskell` support (#65)
-* Add `Perl` support (#66)
-* Add `Markdown` support (#67)
-* Add `TOML` support (#68)
-* fix: Don't fold lint comment when only 1 line (#69) 
-* Add `Kotlin` support (#70)
-* Add `Jai` support (#71)
-* Add `GDScript` support (#72)
-* Add `Scheme` support (#73)
-* Add `Beancount` support (#74)
-* Add `Verilog` support (#75)
-* Add `LaTex` support (#76)
-
-## 0.1.0
-> Released Oct 18, 2021
-
-* Initial release
+* feat: Fully support `isearch` and modification conditions (#1)
diff --git a/Eask b/Eask
index 9d077c35a7..7040a9a659 100644
--- a/Eask
+++ b/Eask
@@ -1,5 +1,5 @@
 (package "treesit-fold"
-         "0.3.1"
+         "0.1.0"
          "Code folding using treesit")
 
 (website-url "https://github.com/emacs-tree-sitter/treesit-fold";)
diff --git a/treesit-fold.el b/treesit-fold.el
index aa74129fdc..bca11c169e 100644
--- a/treesit-fold.el
+++ b/treesit-fold.el
@@ -8,7 +8,7 @@
 ;; Author: Junyi Hou <junyi.yi.hou@gmail.com>
 ;;         Shen, Jen-Chieh <jcs090218@gmail.com>
 ;; URL: https://github.com/emacs-tree-sitter/treesit-fold
-;; Version: 0.3.1
+;; Version: 0.1.0
 ;; Package-Requires: ((emacs "29.1") (tree-sitter "0.15.1") (s "1.9.0") 
(fringe-helper "1.0.1"))
 ;; Keywords: convenience folding tree-sitter
 
@@ -342,13 +342,35 @@ This function is borrowed from 
`tree-sitter-node-at-point'."
                                         (treesit-fold-summary--get 
(buffer-substring beg end)))
                                    treesit-fold-replacement))
       (overlay-put ov 'face 'treesit-fold-replacement-face)
-      (overlay-put ov 'isearch-open-invisible #'treesit-fold--isearch-open)
+      (overlay-put ov 'modification-hooks '(treesit-fold--on-change))
+      (overlay-put ov 'insert-in-front-hooks '(treesit-fold--on-change))
+      (overlay-put ov 'isearch-open-invisible #'treesit-fold--on-change)
+      (overlay-put ov 'isearch-open-invisible-temporary
+                   (lambda (ov hide-p)
+                     (if hide-p (treesit-fold--hide-ov ov)
+                       (treesit-fold--show-ov ov))))
       ov)))
 
-(defun treesit-fold--isearch-open (ov)
-  "Open overlay OV during `isearch' session."
+(defun treesit-fold--on-change (ov &rest _)
+  "Open overlay OV during content is changed."
   (delete-overlay ov))
 
+(defun treesit-fold--show-ov (ov &rest _)
+  "Show the OV."
+  (overlay-put ov 'invisible nil)
+  (overlay-put ov 'display nil)
+  (overlay-put ov 'face nil))
+
+(defun treesit-fold--hide-ov (ov &rest _)
+  "Hide the OV."
+  (let ((beg (overlay-start ov))
+        (end (overlay-end ov)))
+    (overlay-put ov 'invisible 'treesit-fold)
+    (overlay-put ov 'display (or (and treesit-fold-summary-show
+                                      (treesit-fold-summary--get 
(buffer-substring beg end)))
+                                 treesit-fold-replacement))
+    (overlay-put ov 'face 'treesit-fold-replacement-face)))
+
 (defun treesit-fold-overlay-at (node)
   "Return the treesit-fold overlay at NODE if NODE is foldable and folded.
 Return nil otherwise."



reply via email to

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