[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars 20e34365e9 191/431: ts: improved query setu
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars 20e34365e9 191/431: ts: improved query setup |
Date: |
Mon, 16 Sep 2024 12:59:27 -0400 (EDT) |
branch: externals/indent-bars
commit 20e34365e91515f4337eb10cc58f28f0d746c9a7
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
ts: improved query setup
---
indent-bars-ts.el | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/indent-bars-ts.el b/indent-bars-ts.el
index af713fc661..b8642f2224 100644
--- a/indent-bars-ts.el
+++ b/indent-bars-ts.el
@@ -207,23 +207,28 @@ by nodes of those types (e.g. module)."
"Setup indent-bars for using with treesiter."
(when-let (((fboundp #'treesit-available-p))
((treesit-available-p))
- (lang (treesit-language-at (point-min)))
- (types (alist-get lang indent-bars-treesit-wrap)))
+ (lang (treesit-language-at (point-min))))
(setq indent-bars-ts--parser
- (cl-find lang (treesit-parser-list) :key #'treesit-parser-language)
- indent-bars-ts--query
- (treesit-query-compile lang `([,@(mapcar #'list types)] @ctx)))
+ (cl-find lang (treesit-parser-list) :key #'treesit-parser-language))
+
+ ;; Wrap: prevent additional bars inside wrapped entities
+ (when-let ((types (alist-get lang indent-bars-treesit-wrap)))
+ (setq indent-bars-ts--wrap-query
+ (treesit-query-compile lang `([,@(mapcar #'list types)] @ctx))
+ indent-bars--update-depth-function
+ #'indent-bars-ts--update-indentation-depth))
+
+ ;; Strings (avoid descending deeper inside strings)
(when indent-bars-no-descend-string
(let ((query `([(,indent-bars-no-descend-string)] @s))
(pm (point-min)))
(setq indent-bars-ts--string-query (treesit-query-compile lang query))
- ;; Test it to be sure
+ ;; Test it to be sure it works
(condition-case err
(treesit-query-capture indent-bars-ts--parser
indent-bars-ts--string-query pm pm t)
(treesit-query-error
(setq indent-bars-no-descend-string nil)
- (message "indent-bars: malformed string query; disabling. See
indent-bars-no-descend-string.\n%s" err)))))
- (setq indent-bars--update-depth-function
- #'indent-bars-ts--update-indentation-depth)
- ))
+ (message "%s. See `indent-bars-no-descend-string'.\n%s"
+ "indent-bars: malformed string query; disabling"
+ err)))))
- [elpa] externals/indent-bars 929a5e2445 129/431: Major re-factoring of bar display: tabs, offset, and invent, more, (continued)
- [elpa] externals/indent-bars 929a5e2445 129/431: Major re-factoring of bar display: tabs, offset, and invent, more, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 529854ec34 170/431: Relocate :weight spec to indent-bars-stipple face, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars bce0b729cc 130/431: Comment treesit, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d9459a784e 160/431: treesit improvements: always search from root node, add start-only, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars bbdbbfe4da 159/431: Mention Carbon in versoin for emacs-mac, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 35bade62bd 179/431: do not use derived-mode-class, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 78ddecc3a8 153/431: protect display with save-excursion, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 6f886f89c4 141/431: Support go-mode in addition to go-ts-mode, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 3c83532f98 182/431: Bump version, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 1875deadb7 166/431: Report TS string query error, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 20e34365e9 191/431: ts: improved query setup,
ELPA Syncer <=
- [elpa] externals/indent-bars 2e0e6ee0fd 196/431: add support for ts start-bars to switch from oos to emph w/in line, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a4d43c0054 163/431: README: FAQ starting-column, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 7b6454d6e8 190/431: ts.el: improve docs and customization options, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars f5d9426fe6 199/431: overhaul style-system: pass-by-arg, switch-after, style2, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 9f2b7625b4 212/431: scope-update: reference correct timer, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 28cc7f4a82 216/431: Use "ts" alt style uniformly, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 2889b50077 224/431: Always initialize style on scope init, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 230e3c8377 221/431: setup-and-remove: wrap in with-selected-frame, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 1b6e353634 225/431: Correctly track separate stipple face for each style, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 9740b6ff4a 227/431: Add min-lines support for scope, ELPA Syncer, 2024/09/16