Files
.emacs.d/modules/languages/siren-typescript.el
Jim Myhrberg 90fd64ffab chore(language/typescript): remove needless hook setup
tsx-ts-mode inherits from typescript-ts-mode, so it has the same hooks.
2023-04-25 02:04:19 +01:00

44 lines
1.0 KiB
EmacsLisp

;;; siren-typescript.el --- jimeh's Emacs Siren: typescript-mode configuration.
;;; Commentary:
;; Basic configuration for typescript-mode.
;;; Code:
(require 'siren-flycheck)
(require 'siren-lsp)
(require 'siren-treesit)
(let ((repo "https://github.com/tree-sitter/tree-sitter-typescript")
(ref "v0.20.2"))
(siren-treesit-prepare
'typescript-ts-mode
`(typescript . (,repo ,ref "typescript/src")))
(siren-treesit-prepare
'tsx-ts-mode
`(tsx . (,repo ,ref "tsx/src"))))
(use-package typescript-ts-mode
:straight (:type built-in)
:mode "\\.ts\\'"
:hook
(typescript-ts-mode . siren-typescript-mode-setup))
(use-package tsx-ts-mode
:straight (:type built-in)
:mode "\\.tsx\\'")
(defun siren-typescript-mode-setup ()
"Default setup function for `typescript-mode' and `typescript-ts-mode'."
(let ((width 2))
(setq-local typescript-indent-level width
indent-level width
tab-width width))
(lsp-deferred)
(flycheck-mode t))
(provide 'siren-typescript)
;;; siren-typescript.el ends here