forked from FG42/FG42
Update Typescript extension with lsp
This commit is contained in:
parent
aaa7891a16
commit
2c1b503a8f
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
;; Dependencies ----------------------------------
|
;; Dependencies ----------------------------------
|
||||||
(depends-on 'typescript-mode)
|
(depends-on 'typescript-mode)
|
||||||
(depends-on 'tide)
|
|
||||||
|
|
||||||
(defun typescript-doc ()
|
(defun typescript-doc ()
|
||||||
"Something fun.")
|
"Something fun.")
|
||||||
|
|
|
@ -9,18 +9,18 @@
|
||||||
(setq tmp-directory (concat (getenv "HOME") "/.tmp"))
|
(setq tmp-directory (concat (getenv "HOME") "/.tmp"))
|
||||||
;; aligns annotation to the right hand side
|
;; aligns annotation to the right hand side
|
||||||
(setq company-tooltip-align-annotations t)
|
(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)
|
(flycheck-mode 1)
|
||||||
(setq flycheck-check-syntax-automatically '(save mode-enabled))
|
(setq flycheck-check-syntax-automatically '(save mode-enabled))
|
||||||
|
|
||||||
(eldoc-mode 1)
|
(eldoc-mode 1)
|
||||||
(tide-hl-identifier-mode 1)
|
|
||||||
(company-mode 1))
|
(company-mode 1))
|
||||||
|
|
||||||
|
|
||||||
|
(defun lsp-typescript-config ()
|
||||||
|
(interactive)
|
||||||
|
(require 'lsp)
|
||||||
|
(require 'lsp-clients))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun extensions/typescript-initialize ()
|
(defun extensions/typescript-initialize ()
|
||||||
"Initialize the typescript extension."
|
"Initialize the typescript extension."
|
||||||
|
@ -30,8 +30,9 @@
|
||||||
(add-hook 'web-mode-hook
|
(add-hook 'web-mode-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(when (string-equal "tsx" (file-name-extension buffer-file-name))
|
(when (string-equal "tsx" (file-name-extension buffer-file-name))
|
||||||
(setup-tide-mode)
|
(setup-tide-mode))))
|
||||||
(tide-hl-identifier-mode))))
|
|
||||||
|
(add-hook 'typescript-mode-hook #'lsp-typescript-config)
|
||||||
;; enable typescript-tslint checker
|
;; enable typescript-tslint checker
|
||||||
(flycheck-add-mode 'typescript-tslint 'web-mode)))
|
(flycheck-add-mode 'typescript-tslint 'web-mode)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue