Home Gen381 @ 2024-10-27-00:34
This commit is contained in:
parent
c8046cd01f
commit
2d847cbf28
@ -150,6 +150,27 @@
|
||||
(set-formatter! 'alejandra '("alejandra" "--quiet") :modes '(nix-mode))
|
||||
|
||||
;;Use TS-modes
|
||||
(after! treesit
|
||||
(setq treesit-font-lock-level 4))
|
||||
|
||||
(defconst mode-ts-mode-mapping
|
||||
'((python-mode . python-ts-mode)
|
||||
(css-mode . css-ts-mode)
|
||||
(typescript-mode . typescript-ts-mode)
|
||||
(js-mode . typescript-ts-mode)
|
||||
(js2-mode . typescript-ts-mode)
|
||||
(c-mode . c-ts-mode)
|
||||
(c++-mode . c++-ts-mode)
|
||||
(c-or-c++-mode . c-or-c++-ts-mode)
|
||||
(bash-mode . bash-ts-mode)
|
||||
(css-mode . css-ts-mode)
|
||||
(json-mode . json-ts-mode)
|
||||
(js-json-mode . json-ts-mode)
|
||||
(sh-mode . bash-ts-mode)
|
||||
(c-or-c++-mode . c-or-c++-ts-mode)
|
||||
(sh-base-mode . bash-ts-mode))
|
||||
"A map from original mode to the ts-mode")
|
||||
|
||||
(use-package! treesit
|
||||
:defer t
|
||||
:mode (("\\.tsx\\'" . tsx-ts-mode)
|
||||
@ -168,24 +189,19 @@
|
||||
("\\.sh\\'" . bash-ts-mode)
|
||||
)
|
||||
:preface
|
||||
(dolist (mapping
|
||||
'((python-mode . python-ts-mode)
|
||||
(css-mode . css-ts-mode)
|
||||
(typescript-mode . typescript-ts-mode)
|
||||
(js-mode . typescript-ts-mode)
|
||||
(js2-mode . typescript-ts-mode)
|
||||
(c-mode . c-ts-mode)
|
||||
(c++-mode . c++-ts-mode)
|
||||
(c-or-c++-mode . c-or-c++-ts-mode)
|
||||
(bash-mode . bash-ts-mode)
|
||||
(css-mode . css-ts-mode)
|
||||
(json-mode . json-ts-mode)
|
||||
(js-json-mode . json-ts-mode)
|
||||
(sh-mode . bash-ts-mode)
|
||||
(c-or-c++-mode . c-or-c++-ts-mode)
|
||||
(sh-base-mode . bash-ts-mode)))
|
||||
(dolist (mapping 'mode-ts-mode-mapping)
|
||||
(add-to-list 'major-mode-remap-alist mapping)))
|
||||
|
||||
(after! tree-sitter
|
||||
(dolist (mapping 'tree-sitter-major-mode-language-alist)
|
||||
(let* ((pre-mode (car mapping))
|
||||
(post-mode (cdr mapping))
|
||||
(ts-lang (cdr (rassoc pre-mode 'mode-ts-mode-mapping))))
|
||||
(when ts-pre-mode-lang
|
||||
(add-to-list 'tree-sitter-major-mode-language-alist (post-mode . ts-lang))))))
|
||||
|
||||
|
||||
|
||||
(use-package lsp-mode
|
||||
:defer t
|
||||
:hook ((lsp-mode . lsp-diagnostics-mode)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user