summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Kosarek <matthew.kosarek@vention.cc>2023-01-04 14:13:08 -0500
committerMatthew Kosarek <matthew.kosarek@vention.cc>2023-01-04 14:13:08 -0500
commit61b9f1a08dd19679c5768c6ba4b71c51b10f29c5 (patch)
tree619419dff494bf673bb5298b543df8ba1e67fc89
parentf746700d649f94ea5f62e7de36a1cc37e55d0066 (diff)
Json no longer starts eglot
-rw-r--r--init.el1
-rw-r--r--lisp/json.el5
-rw-r--r--lisp/web.el32
3 files changed, 19 insertions, 19 deletions
diff --git a/init.el b/init.el
index 910fd45..6d36d2e 100644
--- a/init.el
+++ b/init.el
@@ -50,7 +50,6 @@
(require 'text)
(require 'org-custom)
(require 'web)
-(require 'json)
(require 'markdown)
(require 'lisp)
(require 'json)
diff --git a/lisp/json.el b/lisp/json.el
index d1093cf..786aa4d 100644
--- a/lisp/json.el
+++ b/lisp/json.el
@@ -2,13 +2,10 @@
;;; Code:
(add-to-list 'auto-mode-alist '(".eslintrc'" . json-mode))
-(require 'flycheck)
-(flycheck-add-mode 'json-jslint 'json-mode)
-
(defun my-json-mode-hook ()
"Turn off eglot in JSON mode."
- (require 'eglot)
(flymake-mode 0)
+ (flycheck-mode 0)
)
(add-hook 'json-mode-hook 'my-json-mode-hook)
diff --git a/lisp/web.el b/lisp/web.el
index 77c6ef9..3372792 100644
--- a/lisp/web.el
+++ b/lisp/web.el
@@ -19,8 +19,6 @@
)
(my-web-mode-colors)
)
-(add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))
-(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))
(setq-default js-indent-level 2)
(require 'flycheck)
@@ -35,6 +33,18 @@
(add-hook 'js-mode-hook 'flycheck-mode)
(add-hook 'typescript-mode-hook 'flycheck-mode)
+;; TSX
+(use-package tree-sitter-langs
+ :config
+ (tree-sitter-require 'tsx)
+ (add-to-list 'tree-sitter-major-mode-language-alist '(typescript-tsx-mode . tsx))
+ )
+
+(define-derived-mode typescript-tsx-mode web-mode "TypeScript[tsx]")
+(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-tsx-mode))
+(flycheck-add-mode 'javascript-eslint 'typescript-tsx-mode)
+(add-hook 'typescript-tsx-mode-hook 'flycheck-mode)
+
; use local eslint from node_modules before global
; http://emacs.stackexchange.com/questions/21205/flycheck-with-file-relative-eslint-executable
(defun my-use-eslint-from-node-modules ()
@@ -48,21 +58,15 @@
(when (and eslint (file-executable-p eslint))
(setq-local flycheck-javascript-eslint-executable eslint))))
(add-hook 'flycheck-mode-hook #'my-use-eslint-from-node-modules)
-;; TSX
-(use-package tree-sitter-langs
- :config
- (tree-sitter-require 'tsx)
- (add-to-list 'tree-sitter-major-mode-language-alist '(typescript-tsx-mode . tsx))
- )
-
-(define-derived-mode typescript-tsx-mode web-mode "TypeScript[tsx]")
-(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-tsx-mode))
-(flycheck-add-mode 'typescript-tslint 'typescript-tsx-mode)
-(add-hook 'typescript-tsx-mode 'flycheck-mode)
;; Package management
(require 'eglot)
-(add-hook 'js-mode-hook 'eglot-ensure)
+(defun js-eglot-ensure()
+ "Ensure eglot mode, unless we are in json mode"
+ (when (string= (file-name-extension buffer-file-name) "js")
+ (eglot-ensure))
+ )
+(add-hook 'js-mode-hook 'js-eglot-ensure)
(add-hook 'typescript-mode-hook 'eglot-ensure)
(add-hook 'typescript-tsx-mode-hook 'eglot-ensure)
(add-to-list 'eglot-server-programs '(js-mode . ("typescript-language-server" "--stdio")))