From b07628dddf418d4f47b858e6c35fd3520fbaeed2 Mon Sep 17 00:00:00 2001 From: mattkae Date: Tue, 7 Jun 2022 08:21:30 -0400 Subject: Flycheck mode and typescript --- lisp/ts-custom.el | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lisp/ts-custom.el (limited to 'lisp/ts-custom.el') diff --git a/lisp/ts-custom.el b/lisp/ts-custom.el new file mode 100644 index 0000000..3054102 --- /dev/null +++ b/lisp/ts-custom.el @@ -0,0 +1,34 @@ +(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)) + +(provide 'ts-custom) -- cgit v1.2.1