summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-10-03 08:55:08 -0400
committermattkae <mattkae@protonmail.com>2022-10-03 08:55:08 -0400
commitbf954fac4501813ef32a859746ba42428199dc6e (patch)
treef633a4d188def503500a9a9edc54fbd07d8b3274 /lisp
parent237e17d2b1cb8d086b84a4b1b5ff097df36abada (diff)
More tide
Diffstat (limited to 'lisp')
-rw-r--r--lisp/web.el35
1 files changed, 15 insertions, 20 deletions
diff --git a/lisp/web.el b/lisp/web.el
index 7ec4af3..b29d58f 100644
--- a/lisp/web.el
+++ b/lisp/web.el
@@ -42,30 +42,27 @@
(add-hook 'js2-mode-hook 'js2-refactor-keybind-setup)
-;; Typescript
-(defun setup-ts-mode()
- (interactive)
- (setq typescript-indent-level 2)
- (company-mode t)
- (company-quickhelp-mode t)
- (smartparens-mode 1)
-)
-
-(define-derived-mode typescriptreact-mode web-mode "TypescriptReact"
- "A major mode for tsx.")
-(use-package typescript-mode
- :mode (("\\.ts\\'" . typescript-mode)
- ("\\.tsx\\'" . typescriptreact-mode)))
-(add-hook 'typescript-mode-hook #'setup-ts-mode)
-(add-hook 'typescriptreact-mode-hook #'setup-ts-mode)
-
;; Tide for refactoring
(defun setup-tide-mode()
(tide-setup)
(local-set-key [f2] 'tide-rename-symbol)
+ (tide-hl-identifier-mode +1)
+ (setq typescript-indent-level 2)
+ (company-mode t)
+ (company-quickhelp-mode t)
+ (smartparens-mode 1)
)
(add-hook 'typescript-mode-hook #'setup-tide-mode)
+(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)
+
;; Package management
(use-package eglot
:custom
@@ -73,9 +70,7 @@
:ensure t
:defer 3
:hook
- ((js2-mode
- typescript-mode
- typescriptreact-mode) . eglot-ensure))
+ ((js2-mode) . eglot-ensure))
:config
(cl-pushnew '((js-mode typescript-mode typescriptreact-mode) . ("typescript-language-server" "--stdio"))
eglot-server-programs