Update Typescript extension with lsp

This commit is contained in:
Sameer Rahmani 2020-05-16 11:14:23 +01:00
parent aaa7891a16
commit 2c1b503a8f
2 changed files with 11 additions and 10 deletions

View File

@ -10,7 +10,7 @@
;; Dependencies ----------------------------------
(depends-on 'typescript-mode)
(depends-on 'tide)
(defun typescript-doc ()
"Something fun.")

View File

@ -9,18 +9,18 @@
(setq tmp-directory (concat (getenv "HOME") "/.tmp"))
;; aligns annotation to the right hand side
(setq company-tooltip-align-annotations t)
;; formats the buffer before saving
(add-hook 'before-save-hook 'tide-format-before-save)
(add-hook 'typescript-mode-hook #'setup-tide-mode)
(tide-setup)
(flycheck-mode 1)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(eldoc-mode 1)
(tide-hl-identifier-mode 1)
(company-mode 1))
(defun lsp-typescript-config ()
(interactive)
(require 'lsp)
(require 'lsp-clients))
;;;###autoload
(defun extensions/typescript-initialize ()
"Initialize the typescript extension."
@ -30,8 +30,9 @@
(add-hook 'web-mode-hook
(lambda ()
(when (string-equal "tsx" (file-name-extension buffer-file-name))
(setup-tide-mode)
(tide-hl-identifier-mode))))
(setup-tide-mode))))
(add-hook 'typescript-mode-hook #'lsp-typescript-config)
;; enable typescript-tslint checker
(flycheck-add-mode 'typescript-tslint 'web-mode)))