mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
Since we enable global-company-mode, explicitly enabling it in the setup for various major modes does nothing. But it does tie the code to company mode, making it harder to try alternatives like corfu.
64 lines
1.5 KiB
EmacsLisp
64 lines
1.5 KiB
EmacsLisp
;;; siren-typescript.el --- jimeh's Emacs Siren: typescript-mode configuration.
|
|
|
|
;;; Commentary:
|
|
|
|
;; Basic configuration for typescript-mode.
|
|
|
|
;;; Code:
|
|
|
|
(require 'siren-flycheck)
|
|
(require 'siren-folding)
|
|
(require 'siren-lsp)
|
|
(require 'siren-prettier-js)
|
|
(require 'siren-web-mode)
|
|
|
|
(use-package typescript-mode
|
|
:defer t
|
|
:mode "\\.ts\\'"
|
|
:hook
|
|
(typescript-mode . siren-typescript-mode-setup)
|
|
|
|
:bind (:map typescript-mode-map
|
|
("C-j" . newline-and-indent)
|
|
("C-c C-h" . siren-folding-toggle))
|
|
|
|
:init
|
|
(defun siren-typescript-mode-setup ()
|
|
(let ((width 2))
|
|
(setq typescript-indent-level width
|
|
indent-level width
|
|
tab-width width))
|
|
|
|
(lsp-deferred)
|
|
(subword-mode +1)
|
|
(siren-folding)))
|
|
|
|
(use-package tide
|
|
:hook
|
|
(typescript-mode . siren-tide-mode-setup)
|
|
(web-mode . siren-tide-web-mode-setup)
|
|
|
|
:init
|
|
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
|
|
(with-eval-after-load 'flycheck
|
|
(flycheck-add-mode 'typescript-tslint 'web-mode))
|
|
|
|
(defun siren-tide-web-mode-setup ()
|
|
(when (string-equal "tsx" (file-name-extension buffer-file-name))
|
|
(siren-tide-mode-setup)))
|
|
|
|
(defun siren-tide-mode-setup ()
|
|
(interactive)
|
|
(tide-setup)
|
|
|
|
(setq flycheck-check-syntax-automatically '(save mode-enabled)
|
|
company-tooltip-align-annotations t)
|
|
|
|
(prettier-js-mode +1)
|
|
(flycheck-mode +1)
|
|
(eldoc-mode +1)
|
|
(tide-hl-identifier-mode +1)))
|
|
|
|
(provide 'siren-typescript)
|
|
;;; siren-typescript.el ends here
|