[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/clojure-ts-mode 9a96a78a93 19/71: Add fixed indent rules
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/clojure-ts-mode 9a96a78a93 19/71: Add fixed indent rules |
Date: |
Fri, 25 Aug 2023 03:59:28 -0400 (EDT) |
branch: elpa/clojure-ts-mode
commit 9a96a78a934edcb0bb4ac0483947e9693e4861ea
Author: dannyfreeman <danny@dfreeman.email>
Commit: dannyfreeman <danny@dfreeman.email>
Add fixed indent rules
1 problem occurs when indenting in the middle of a populated list like
(a b | c)
where | is the cursor.
It should indent to
(a b
|
c)
but instead we get
(a b
|
c)
Because the "(list_lit . (sym_lit) _* @indent)" query is not matching,
apparently. I am unsure why it doesn't match, testing manually indicates
that it should, but I'm not sure what node is being used exactly.
---
clojure-ts-mode.el | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/clojure-ts-mode.el b/clojure-ts-mode.el
index 6bdc7fccd6..e0ee31ba21 100644
--- a/clojure-ts-mode.el
+++ b/clojure-ts-mode.el
@@ -327,18 +327,17 @@
'((derefing_lit
marker: "@" @font-lock-warning-face))))
-;; (defvar clojure-ts-mode--indent-rules
-;; '((clojure
-;; ((parent-is "source") parent-bol 0)
-;; ((parent-is "set_lit") parent-bol 2)
-;; ((parent-is "vec_lit") parent-bol 1)
-;; ((parent-is "map_lit") parent-bol 1)
-;; ;; Lists beginning with a symbol indent 2 spaces (usally a function
call)
-;; ((query "(list_lit . (sym_lit) _* @indent)") parent-bol 2)
-;; ;; All other lists indent 1 space
-;; ((parent-is "list_lit") parent-bol 1))))
- ;; Need to deal with deref, tagged literals.
-
+(defvar clojure-ts-mode--fixed-indent-rules
+ ;; This is in contrast to semantic rules
+ ;; fixed-indent-rules come from https://tonsky.me/blog/clojurefmt/
+ '((clojure
+ ((parent-is "source") parent-bol 0)
+ ;; Lists beginning with a symbol indent 2 spaces (usually a
function/macro call)
+ ((query "(list_lit . (sym_lit) _* @indent)") parent 2)
+ ((or (parent-is "vec_lit")
+ (parent-is "map_lit")
+ (parent-is "list_lit")) parent 1)
+ ((parent-is "set_lit") parent 2))))
(defvar clojure-ts-mode-map
(let ((map (make-sparse-keymap)))
@@ -374,7 +373,8 @@ Requires Emacs 29 and libtree-sitter-clojure.so available
somewhere in
'((comment string char number)
(keyword constant symbol bracket builtin)
(deref quote metadata definition variable type doc regex
tagged-literals)))
- ;(setq-local treesit-simple-indent-rules clojure-ts-mode--indent-rules)
+ (setq-local treesit-simple-indent-rules
clojure-ts-mode--fixed-indent-rules)
+ (setq treesit--indent-verbose t)
(treesit-major-mode-setup)
(treesit-inspect-mode)
;(clojure-mode-variables)
- [nongnu] elpa/clojure-ts-mode c3631f6c17 15/71: Add breaking change warning, (continued)
- [nongnu] elpa/clojure-ts-mode c3631f6c17 15/71: Add breaking change warning, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 859b0b13a7 46/71: Fix what I think is a typo, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 5a4696116f 49/71: Add LICENSE file (GPL3), ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 7dcf82b81d 17/71: Support `comment-region` command, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 329a39ba3b 68/71: Release 0.1.4, update changelog, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 9bb2eba3a1 32/71: Add a "Rationale" section to the README, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 27c5cf08d6 69/71: Fix bad sha in change log, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 92a50b7635 66/71: Update changelog for 0.1.3, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode ad5af674ec 37/71: Start documenting the design, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 4dc853df16 57/71: Create derived major modes for clojure(c|script|dart), ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 9a96a78a93 19/71: Add fixed indent rules,
ELPA Syncer <=
- [nongnu] elpa/clojure-ts-mode e101674bac 06/71: Typos!!, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode f187b72aa9 62/71: Move test files to new directory, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 0e2eb1f775 14/71: Auto-install tree-sitter-clojure grammar when it's not available, ELPA Syncer, 2023/08/25