react: make react layer depends on new tern layer
This commit is contained in:
parent
8616f07b86
commit
c15b65435e
|
@ -24,31 +24,15 @@
|
|||
(defun spacemacs//react-setup-backend ()
|
||||
"Conditionally setup react backend."
|
||||
(pcase javascript-backend
|
||||
(`tern(spacemacs//react-setup-tern))
|
||||
(`tern (spacemacs/tern-setup-tern))
|
||||
(`lsp (spacemacs//react-setup-lsp))))
|
||||
|
||||
(defun spacemacs//react-setup-company ()
|
||||
"Conditionally setup company based on backend."
|
||||
(pcase javascript-backend
|
||||
(`tern (spacemacs//react-setup-tern-company))
|
||||
(`tern (spacemacs/tern-setup-tern-company 'rjsx-mode))
|
||||
(`lsp (spacemacs//react-setup-lsp-company))))
|
||||
|
||||
|
||||
;; Tern
|
||||
(defun spacemacs//react-setup-tern ()
|
||||
"Setup tern backend."
|
||||
(tern-mode)
|
||||
(spacemacs//set-tern-key-bindings 'rjsx-mode))
|
||||
|
||||
(defun spacemacs//react-setup-tern-company ()
|
||||
"Setup tern auto-completion."
|
||||
(spacemacs|add-company-backends
|
||||
:backends company-tern
|
||||
:modes rjsx-mode
|
||||
:append-hooks nil
|
||||
:call-hooks t)
|
||||
(company-mode))
|
||||
|
||||
|
||||
;; LSP
|
||||
(defun spacemacs//react-setup-lsp ()
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
(configuration-layer/declare-layers '(javascript))
|
||||
(configuration-layer/declare-layers '(javascript tern))
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
js-doc
|
||||
rjsx-mode
|
||||
smartparens
|
||||
tern
|
||||
web-beautify
|
||||
))
|
||||
|
||||
|
@ -83,5 +84,8 @@
|
|||
(add-hook 'react-mode-hook #'smartparens-strict-mode)
|
||||
(add-hook 'react-mode-hook #'smartparens-mode)))
|
||||
|
||||
(defun react/post-init-tern ()
|
||||
(add-to-list 'tern--key-bindings-modes 'rjsx-mode))
|
||||
|
||||
(defun react/post-init-web-beautify ()
|
||||
(spacemacs/set-leader-keys-for-major-mode 'react-mode "=" 'web-beautify-js))
|
||||
|
|
Loading…
Reference in a new issue