fix(indent-guides): disable indent-bars in tree-sitter-mode

A temporary measure, until the tree-sitter module has adopted treesit,
which indent-bars has support for.
This commit is contained in:
Henrik Lissner 2024-09-09 16:36:09 -04:00
parent 005831bfcc
commit bbb2cc1cb3
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -44,6 +44,23 @@ be enabled. If any function returns non-nil, the mode will not be activated."
;; TODO: Uncomment once we support treesit
;; (setq indent-bars-treesit-support (modulep! :tools tree-sitter))
;; HACK: Both indent-bars and tree-sitter-hl-mode use the jit-font-lock
;; mechanism, and so they don't play well together. For those particular
;; cases, we'll use `highlight-indent-guides', at least until the
;; tree-sitter module adopts treesit.
(defvar-local +indent-guides-p nil)
(add-hook! 'tree-sitter-mode-hook :append
(defun +indent-guides--toggle-on-tree-sitter-h ()
(if tree-sitter-mode
(when (bound-and-true-p indent-bars-mode)
(with-memoization (get 'indent-bars-mode 'disabled-in-tree-sitter)
(doom-log "Disabled `indent-bars-mode' because it's not supported in `tree-sitter-mode'")
t)
(indent-bars-mode -1)
(setq +indent-guides-p t))
(when +indent-guides-p
(indent-bars-mode +1)))))
(unless (boundp 'enable-theme-functions)
(add-hook 'doom-load-theme-hook #'indent-bars-reset-styles))