sql: refactor
- Moved backend determination to `config.el` - Replaced `pcase` form with only one-arm with `when` or `unless` form
This commit is contained in:
parent
2c22a8a697
commit
9b36cf2d85
2 changed files with 4 additions and 12 deletions
|
@ -35,7 +35,7 @@
|
|||
(defvar sql-auto-indent t
|
||||
"If non nil use sql-indent.")
|
||||
|
||||
(defvar sql-backend nil
|
||||
(defvar sql-backend (if (configuration-layer/layer-used-p 'lsp) 'lsp 'company-sql)
|
||||
"The backend to use for IDE features.
|
||||
Possible values are `lsp' and `company-sql'.
|
||||
If `nil' then 'company-sql` is the default backend unless `lsp' layer is used")
|
||||
|
|
|
@ -29,17 +29,9 @@
|
|||
(lambda (product) (sql-get-product-feature (car product) :sqli-program))
|
||||
sql-product-alist)))
|
||||
|
||||
(defun spacemacs//sql-backend ()
|
||||
"Returns selected backend."
|
||||
(if sql-backend
|
||||
sql-backend
|
||||
(cond
|
||||
((configuration-layer/layer-used-p 'lsp) 'lsp)
|
||||
(t 'company-sql))))
|
||||
|
||||
(defun spacemacs//sql-setup-company ()
|
||||
"Conditionally setup company based on backend."
|
||||
(pcase (spacemacs//sql-backend)
|
||||
(pcase sql-backend
|
||||
('company-sql (spacemacs|add-company-backends
|
||||
:backends company-capf
|
||||
:modes sql-mode))
|
||||
|
@ -51,5 +43,5 @@
|
|||
|
||||
(defun spacemacs//sql-setup-backend ()
|
||||
"Conditionally setup sql backend."
|
||||
(pcase (spacemacs//sql-backend)
|
||||
(`lsp (lsp))))
|
||||
(when (eq sql-backend 'lsp)
|
||||
(lsp)))
|
||||
|
|
Reference in a new issue