summaryrefslogtreecommitdiff
path: root/fnl/config/lsp/lsp-installer.fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-06 22:37:29 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-06 22:37:29 +0200
commit9ae371fc6c94765862719a2c57554ab98794cecd (patch)
tree113b444ed6f0c565827e16ea554919bcf5e1ee72 /fnl/config/lsp/lsp-installer.fnl
parentcf72d636f766ba969b6ed2a560b7e9c2b75c7661 (diff)
feat(lsp installer): add fnl config
Diffstat (limited to 'fnl/config/lsp/lsp-installer.fnl')
-rw-r--r--fnl/config/lsp/lsp-installer.fnl26
1 files changed, 26 insertions, 0 deletions
diff --git a/fnl/config/lsp/lsp-installer.fnl b/fnl/config/lsp/lsp-installer.fnl
new file mode 100644
index 0000000..a32ee9b
--- /dev/null
+++ b/fnl/config/lsp/lsp-installer.fnl
@@ -0,0 +1,26 @@
+;; LSP installer.
+
+(module config.lsp.lsp-installer
+ {autoload {util util}})
+
+(def- opts
+ {:on_attach: ((require :config.lsp.handlers).on_attach)
+ :capabilities ((require :config.lsp.handlers).capabilities)})
+
+(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-opts (require :config.lsp.settings.sumneko-lua)]
+ (vim.tbl_deep_extend :force sumneko-lua-opts opts)))
+ (when (= server.name :pyright)
+ (let [pyright-opts (require :config.lsp.settings.pyright)]
+ (vim.tbl_deep_extend :force pyright-opts opts))))
+
+
+(let [(ok? lsp-installer) util.load-plugin :lsp-installer]
+ (when ok?
+ (lsp-installer.on_server_ready (fn [server]
+ (let [opts (get-server-opts server)]
+ server:setup opts)))))