summaryrefslogtreecommitdiff
path: root/fnl/config
diff options
context:
space:
mode:
authoraktersnurra <grydholm@kth.se>2022-04-21 23:52:07 +0200
committeraktersnurra <grydholm@kth.se>2022-04-21 23:52:07 +0200
commitd3f68e913454fb9cfa555ab112a23c3d86e6bec4 (patch)
tree47230397f0515199168d1233f25f2b8272afd583 /fnl/config
parent2df9eda7d9989007cca69cf9fe590c5348f4a8e6 (diff)
refactor: lsp installer
Diffstat (limited to 'fnl/config')
-rw-r--r--fnl/config/lsp/lsp-installer.fnl30
1 files changed, 19 insertions, 11 deletions
diff --git a/fnl/config/lsp/lsp-installer.fnl b/fnl/config/lsp/lsp-installer.fnl
index 72bef8e..358ba1c 100644
--- a/fnl/config/lsp/lsp-installer.fnl
+++ b/fnl/config/lsp/lsp-installer.fnl
@@ -1,20 +1,28 @@
;; LSP installer.
(module config.lsp.lsp-installer {autoload {util util}})
-(def- opts (let [handlers (require :config.lsp.handlers)]
- {"on_attach:" handlers.on_attach
+(defn- handler-opts [] (let [handlers (require :config.lsp.handlers)]
+ {:on_attach handlers.on-attach
:capabilities handlers.capabilities}))
+(defn- jsonls-opts []
+ (let [jsonls-opts (require :config.lsp.settings.jsonls)]
+ (vim.tbl_deep_extend :force jsonls-opts (handler-opts))))
+
+(defn- sumneko-lua-opts []
+ (let [sumneko-lua (require :config.lsp.settings.sumneko-lua)]
+ (vim.tbl_deep_extend :force sumneko-lua.opts (handler-opts))))
+
+(defn- pyright-opts []
+ (let [pyright (require :config.lsp.settings.pyright)]
+ (vim.tbl_deep_extend :force pyright.opts (handler-opts))))
+
(defn- get-server-opts [server]
- (when (= server.name :jsonls)
- (let [jsonls-opts (require :config.lsp.settings.jsonls)]
- (vim.tbl_deep_extend :force jsonls-opts opts)))
- (when (= server.name :sumneko_lua)
- (let [sumneko-lua (require :config.lsp.settings.sumneko-lua)]
- (vim.tbl_deep_extend :force sumneko-lua.opts opts)))
- (when (= server.name :pyright)
- (let [pyright (require :config.lsp.settings.pyright)]
- (vim.tbl_deep_extend :force pyright.opts opts))) opts)
+ (match server.name
+ "jsonls" (jsonls-opts)
+ "pyright" (pyright-opts)
+ "sumneko_lua" (sumneko-lua-opts)
+ _ (handler-opts)))
(let [lsp-installer (util.load-plugin :nvim-lsp-installer)]
(lsp-installer.on_server_ready (fn [server]