mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Defer tide-mode init until file exists
This ensures that tide-mode won't activate for file-less JS buffers, which are error prone. But once the file is saved, it will consider activating itself.
This commit is contained in:
@ -126,9 +126,11 @@
|
||||
;; Don't let hard errors stop the user from opening js files.
|
||||
(defun +javascript|init-tide ()
|
||||
"Enable `tide-mode' if node is available."
|
||||
(if (executable-find "node")
|
||||
(tide-setup)
|
||||
(message "Couldn't find `node', aborting tide server")))
|
||||
(cond ((not buffer-file-name)
|
||||
(add-hook 'after-save-hook #'+javascript|init-tide nil t))
|
||||
((executable-find "node")
|
||||
(tide-setup))
|
||||
((message "Couldn't find `node', aborting tide server"))))
|
||||
(add-hook! (js2-mode typescript-mode) #'+javascript|init-tide)
|
||||
|
||||
(defun +javascript|init-tide-in-web-mode ()
|
||||
|
Reference in New Issue
Block a user