summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2022-10-11 08:52:35 -0400
committerMatthew Kosarek <mattkae@protonmail.com>2022-10-11 08:52:35 -0400
commit8f0771b6dc80f2af8c70eee29ee1f203539216dc (patch)
tree798bf413a7c80d5d682cdc7bc1f2a027e73e585a
parent90c77ada1a16875f4ea0cb3ce5388e806b49fe8e (diff)
parentbf954fac4501813ef32a859746ba42428199dc6e (diff)
Merge branch 'master' of matthewkosarek.xyz:/srv/git/emacs_config
-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