Checks if tern exists before using it (#10788)
This commit is contained in:
parent
2df4db5c60
commit
4a9d535786
1 changed files with 19 additions and 2 deletions
|
@ -15,13 +15,13 @@
|
|||
(defun spacemacs//javascript-setup-backend ()
|
||||
"Conditionally setup javascript backend."
|
||||
(pcase javascript-backend
|
||||
(`tern (spacemacs/tern-setup-tern))
|
||||
(`tern (spacemacs//javascript-setup-tern))
|
||||
(`lsp (spacemacs//javascript-setup-lsp))))
|
||||
|
||||
(defun spacemacs//javascript-setup-company ()
|
||||
"Conditionally setup company based on backend."
|
||||
(pcase javascript-backend
|
||||
(`tern (spacemacs/tern-setup-tern-company 'js2-mode))
|
||||
(`tern (spacemacs//javascript-setup-tern-company))
|
||||
(`lsp (spacemacs//javascript-setup-lsp-company))))
|
||||
|
||||
|
||||
|
@ -51,6 +51,23 @@
|
|||
(message (concat "`lsp' layer is not installed, "
|
||||
"please add `lsp' layer to your dotfile."))))
|
||||
|
||||
|
||||
;; tern
|
||||
(defun spacemacs//javascript-setup-tern ()
|
||||
(if (configuration-layer/layer-used-p 'tern)
|
||||
(when (locate-file "tern" exec-path)
|
||||
(spacemacs/tern-setup-tern))
|
||||
(message (concat "Tern was configured as the javascript backend but "
|
||||
"the `tern' layer is not present in your `.spacemacs'!"))))
|
||||
|
||||
(defun spacemacs//javascript-setup-tern-company ()
|
||||
(if (configuration-layer/layer-used-p 'tern)
|
||||
(when (locate-file "tern" exec-path)
|
||||
(spacemacs/tern-setup-tern-company 'js2-mode))
|
||||
(message (concat "Tern was configured as the javascript backend but "
|
||||
"the `tern' layer is not present in your `.spacemacs'!"))))
|
||||
|
||||
|
||||
|
||||
;; js-doc
|
||||
|
||||
|
|
Reference in a new issue