enable eglot in js-mode but not json-mode

This commit is contained in:
zedhugh committed 2022-11-01 22:16:31 +08:00
1 parent 85ab175774
commit b2bff66d82
1 file changed
+8 -1
+8 -1
View File
@@ -14,7 +14,14 @@
("C-c o" . eglot-code-actions))
eglot-mode-map))
(dolist (hook '(css-mode-hook js-mode-hook typescript-mode-hook))
;; json mode is derived from `js-mode', but json file don't need `eglot'
(add-hook 'js-mode-hook
(lambda ()
(unless (derived-mode-p 'js-json-mode 'json-mode)
(eglot-ensure))))
(dolist (hook '(css-mode-hook typescript-mode-hook))
(add-hook hook #'eglot-ensure))