mirror of
https://github.com/doomemacs/doomemacs.git
synced 2025-12-06 02:30:33 -08:00
refactor(tree-sitter): centralize grammar config & hacks
Easier to track and maintain.
This commit is contained in:
parent
6009c2b838
commit
3b58741522
18 changed files with 85 additions and 142 deletions
|
|
@ -20,8 +20,7 @@
|
|||
python-indent-guess-indent-offset-verbose nil)
|
||||
|
||||
(when (modulep! +tree-sitter)
|
||||
(set-tree-sitter! 'python-mode 'python-ts-mode
|
||||
'((python :url "https://github.com/tree-sitter/tree-sitter-python"))))
|
||||
(set-tree-sitter! 'python-mode 'python-ts-mode 'python))
|
||||
|
||||
:config
|
||||
;; HACK: `python-base-mode' (and `python-ts-mode') don't exist on pre-29
|
||||
|
|
@ -98,16 +97,7 @@
|
|||
|
||||
;; HACK: `python-mode' doesn't update `tab-width' to reflect
|
||||
;; `python-indent-offset', causing issues anywhere `tab-width' is respected.
|
||||
(setq-hook! '(python-mode-hook python-ts-mode-hook) tab-width python-indent-offset)
|
||||
|
||||
;; HACK: `python-ts-mode' changes `auto-mode-alist' and
|
||||
;; `interpreter-mode-alist' every time the mode is activated, which runs the
|
||||
;; risk of overwriting user (or Doom) entries.
|
||||
;; REVIEW: Should be addressed upstream.
|
||||
(defadvice! +python--undo-ts-side-effects-a (fn &rest args)
|
||||
:around #'python-ts-mode
|
||||
(let (auto-mode-alist interpreter-mode-alist)
|
||||
(apply fn args))))
|
||||
(setq-hook! '(python-mode-hook python-ts-mode-hook) tab-width python-indent-offset))
|
||||
|
||||
|
||||
(use-package! pyimport
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue