mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
chore(language/typescript): minor tweaks and simplification
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
;; Requires Emacs 29.x or later for built-in treesit support.
|
||||
(when (fboundp 'typescript-ts-mode)
|
||||
(require 'siren-flycheck)
|
||||
(require 'siren-js)
|
||||
(require 'siren-lsp)
|
||||
(require 'siren-treesit)
|
||||
|
||||
@@ -17,6 +18,10 @@
|
||||
:mode "\\.ts\\'"
|
||||
:hook
|
||||
(typescript-ts-mode . siren-typescript-mode-setup)
|
||||
(typescript-ts-mode . siren-lsp-js-mode-setup)
|
||||
|
||||
:custom
|
||||
(typescript-ts-mode-indent-offset 2)
|
||||
|
||||
:config
|
||||
(siren-treesit-auto-ensure-grammar 'typescript))
|
||||
@@ -24,24 +29,10 @@
|
||||
(use-package tsx-ts-mode
|
||||
:straight (:type built-in)
|
||||
:mode "\\.tsx\\'"
|
||||
:hook
|
||||
(tsx-ts-mode . siren-lsp-js-mode-setup)
|
||||
:config
|
||||
(siren-treesit-auto-ensure-grammar 'tsx))
|
||||
|
||||
(defun siren-typescript-mode-setup ()
|
||||
"Default setup function for `typescript-ts-mode' and `tsx-ts-mode'."
|
||||
(let ((width 2))
|
||||
(setq-local typescript-indent-level width
|
||||
indent-level width
|
||||
tab-width width))
|
||||
|
||||
;; Disable semantic tokens as it typically causes an annoying delay with the
|
||||
;; syntax highlighting as you type. Essentially all new text is a very faded
|
||||
;; out grey color for the first 1-2 seconds as you type.
|
||||
(setq-local lsp-semantic-tokens-enable nil)
|
||||
|
||||
(lsp-format-buffer-on-save-mode t)
|
||||
(lsp-deferred)
|
||||
(flycheck-mode t)))
|
||||
(siren-treesit-auto-ensure-grammar 'tsx)))
|
||||
|
||||
(provide 'siren-typescript)
|
||||
;;; siren-typescript.el ends here
|
||||
|
||||
Reference in New Issue
Block a user