First commit.
This commit is contained in:
40
lisp/modes/typescript.el
Normal file
40
lisp/modes/typescript.el
Normal file
@@ -0,0 +1,40 @@
|
||||
;;; typescript.el --- Initializes TypeScript mode -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun typescript-use-eslint-from-node-modules ()
|
||||
"Use local eslint from node_modules before global."
|
||||
(let* ((root (locate-dominating-file
|
||||
(or (buffer-file-name) default-directory)
|
||||
"node_modules"))
|
||||
(eslint (and root
|
||||
(expand-file-name "node_modules/eslint/bin/eslint.js"
|
||||
root))))
|
||||
(when (and eslint (file-executable-p eslint))
|
||||
(setq-local flycheck-javascript-eslint-executable eslint))))
|
||||
|
||||
(defun user--tide-mode-hook ()
|
||||
"."
|
||||
(interactive)
|
||||
(message "user--tide-mode-hook BEG")
|
||||
(comment-tags-mode t)
|
||||
(tide-setup)
|
||||
(flycheck-mode +1)
|
||||
(setq flycheck-check-syntax-automatically '(save mode-enabled))
|
||||
(eldoc-mode +1)
|
||||
(company-mode +1)
|
||||
(typescript-use-eslint-from-node-modules)
|
||||
(message "user--tide-mode-hook END")
|
||||
)
|
||||
|
||||
(use-package tide
|
||||
:ensure t
|
||||
:after (typescript-mode company flycheck)
|
||||
:hook (
|
||||
(typescript-mode . user--tide-mode-hook)
|
||||
(typescript-mode . tide-hl-identifier-mode)
|
||||
(before-save . tide-format-before-save))
|
||||
:config (setq tide-completion-enable-autoimport-suggestions t))
|
||||
|
||||
(provide 'modes/typescript)
|
||||
;; typescript.el ends here
|
Reference in New Issue
Block a user