diff --git a/modules/home/doom/static/config.el b/modules/home/doom/static/config.el index 7eb5b08..bd54d1f 100644 --- a/modules/home/doom/static/config.el +++ b/modules/home/doom/static/config.el @@ -148,3 +148,54 @@ :desc "Show Doc-UI" :n "C-h" #'my-ui-doc-glance-then-focus) (set-formatter! 'alejandra '("alejandra" "--quiet") :modes '(nix-mode)) + +;;Use TS-modes +(use-package! treesit + :defer t + :mode (("\\.tsx\\'" . tsx-ts-mode) + ("\\.js\\'" . typescript-ts-mode) + ("\\.mjs\\'" . typescript-ts-mode) + ("\\.mts\\'" . typescript-ts-mode) + ("\\.cjs\\'" . typescript-ts-mode) + ("\\.ts\\'" . typescript-ts-mode) + ("\\.jsx\\'" . tsx-ts-mode) + ("\\.json\\'" . json-ts-mode) + ("\\.Dockerfile\\'" . dockerfile-ts-mode) + ("\\.c\\'" . c-ts-mode) + ("\\.h\\'" . c-or-c++-ts-mode) + ("\\.cpp\\'" . c++-ts-mode) + ("\\.py\\'" . python-ts-mode) + ("\\.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))) + (add-to-list 'major-mode-remap-alist mapping))) + +(use-package lsp-mode + :defer t + :hook ((lsp-mode . lsp-diagnostics-mode) + (lsp-mode . lsp-enable-which-key-integration) + (python-ts-mode . lsp-deferred) + (css-ts-mode . lsp-deferred) + (typescript-ts-mode . lsp-deferred) + (js-ts-mode . lsp-deferred) + (c-ts-mode . lsp-deferred) + (c++-ts-mode . lsp-deferred) + (c-or-c++-ts-mode . lsp-deferred) + (bash-ts-mode . lsp-deferred) + (json-ts-mode . lsp-deferred))