theurgy/workflows/typescript-custom.el

49 lines
1.5 KiB
EmacsLisp

;;; typescript-custom.el --- Customisations for working with typescript -*- lexical-binding: t -*-
;; This file is not part of GNU Emacs
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; commentary
;;; Code:
;; More consistent than typescript-ts-mode atm
(add-to-list 'auto-mode-alist '("\\.ts\\" . typescript-ts-mode))
(add-to-list 'auto-mode-alist '("\\.spec.*.ts\\" . typescript-ts-mode))
(use-package tide
:init
(defun setup-tide-mode ()
(interactive)
(tide-setup)
(flycheck-mode +1)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(eldoc-mode +1)
(tide-hl-identifier-mode +1))
;; formats the buffer before saving
(add-hook 'before-save-hook 'tide-format-before-save)
;; For typescript-mode
(add-hook 'typescript-ts-mode-hook #'setup-tide-mode))
(add-hook 'typescript-ts-mode #'combobulate-mode)
(provide 'typescript-custom)
;;; typescript-custom.el ends here