summaryrefslogtreecommitdiff
path: root/fnl/config/lsp/mason-lspconfig.fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-07-27 00:32:49 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-07-27 00:32:49 +0200
commit5cc2e3d846c693e615af88ed7678422edadd3a04 (patch)
tree65044c6c6670137cb119c34713258c1f0325285f /fnl/config/lsp/mason-lspconfig.fnl
parent9af69c1df30ccb99e2f34632c3809987b22c98b4 (diff)
Replace lsp-installer with mason
Diffstat (limited to 'fnl/config/lsp/mason-lspconfig.fnl')
-rw-r--r--fnl/config/lsp/mason-lspconfig.fnl56
1 files changed, 56 insertions, 0 deletions
diff --git a/fnl/config/lsp/mason-lspconfig.fnl b/fnl/config/lsp/mason-lspconfig.fnl
new file mode 100644
index 0000000..704761d
--- /dev/null
+++ b/fnl/config/lsp/mason-lspconfig.fnl
@@ -0,0 +1,56 @@
+;; TBD
+(module config.lsp.mason-lspconfig {autoload {: util}})
+
+(def- servers [:bashls
+ :clangd
+ :cssls
+ :dockerls
+ :html
+ :hls
+ :jsonls
+ :pyright
+ :rust_analyzer
+ :taplo
+ :terraformls
+ :texlab
+ :sumneko_lua
+ :tflint
+ :yamlls
+ :zk])
+
+(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- rust-opts []
+ (let [rust (require :config.lsp.settings.rust)]
+ (vim.tbl_deep_extend :force rust.opts (handler-opts))))
+
+(defn- get-server-opts [server]
+ (match server
+ :jsonls (jsonls-opts)
+ :pyright (pyright-opts)
+ :sumneko_lua (sumneko-lua-opts)
+ :rust_analyzer (rust-opts)
+ _ (handler-opts)))
+
+(def- opts {:ensure_installed servers :automatic_installation true})
+
+(util.use-config :mason-lspconfig opts)
+
+(let [lspconfig (util.load-plugin :lspconfig)]
+ (each [_ server (ipairs servers)]
+ (let [server-config (. lspconfig server)]
+ (server-config.setup (get-server-opts server)))))