diff options
Diffstat (limited to 'lisp/ts-custom.el~')
-rw-r--r-- | lisp/ts-custom.el~ | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lisp/ts-custom.el~ b/lisp/ts-custom.el~ new file mode 100644 index 0000000..df9510f --- /dev/null +++ b/lisp/ts-custom.el~ @@ -0,0 +1,36 @@ +(defun setup-ts() + + (use-package tide :ensure t) + (use-package company :ensure t) + (use-package flycheck :ensure t) + (defun setup-tide-mode() + (interactive) + (tide-setup) + (flycheck-mode +1) + (setq web-mode-enable-auto-quoting nil) + (setq web-mode-markup-indent-offset 2) + (setq web-mode-code-indent-offset 2) + (setq web-mode-attr-indent-offset 2) + (setq web-mode-attr-value-indent-offset 2) + (setq flycheck-check-syntax-automatically '(save-mode-enabled)) + (eldoc-mode +1) + (tide-hl-identifier-mode +1) + (company-mode +1) + (setq flycheck-check-syntax-automatically '(mode-enabled save))) + + (add-hook 'typescript-mode-hook #'setup-tide-mode) + (add-hook 'before-save-hook 'tide-format-before-save) + (require 'web-mode) + + (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)) + (add-hook 'web-mode-hook + (lambda () + (when (string-equal "tsx" (file-name-extension buffer-file-name)) + (setup-tide-mode)))) + + ;; enable typescript - tslint checker + (flycheck-add-mode 'typescript-tslint 'web-mode) + (global-flycheck-mode) + (add-hook 'after-init-hook #'global-flycheck-mode)) + +(provide 'ts-custom) |