summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2024-01-07 11:50:34 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2024-01-07 11:50:34 +0100
commit076805ccf4983657a8a9a485341a1b85e01cc1a6 (patch)
tree15e675632e11d8afc1086453c646869df72f6d46
parentcd876f8e53385c63b3b3048a0917dd58786e1467 (diff)
Move mason-lspconfig logic to a separate file
-rw-r--r--fnl/plugins/lsp/lspconfig.fnl24
-rw-r--r--fnl/plugins/lsp/mason-lspconfig.fnl22
2 files changed, 25 insertions, 21 deletions
diff --git a/fnl/plugins/lsp/lspconfig.fnl b/fnl/plugins/lsp/lspconfig.fnl
index 6e2ace4..e498056 100644
--- a/fnl/plugins/lsp/lspconfig.fnl
+++ b/fnl/plugins/lsp/lspconfig.fnl
@@ -7,32 +7,14 @@
buffer (. args :buf)]
(keymaps.on-attach buffer)))}))
-(fn capabilities []
- (let [cmp-lsp (require :cmp_nvim_lsp)]
- (cmp-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities))))
-
-(fn handlers [server]
- (let [servers (require :plugins.lsp.servers)
- lspconfig (require :lspconfig)]
- (let [config (. lspconfig server)
- opts (or (. servers server) {})]
- (tset opts :capabilities (capabilities))
- (config.setup opts))))
-
-(fn setup-mason-lspconfig []
- (let [mason-lspconfig (require :mason-lspconfig)
- servers (require :plugins.lsp.servers)]
- (mason-lspconfig.setup {:ensure_installed (vim.tbl_keys servers)
- :automatic_installation true
- :handlers [handlers]})))
-
(fn config []
(on-attach)
(let [diagnostics (require :plugins.lsp.diagnostics)
+ mason-lspconfig (require :plugins.lsp.mason-lspconfig)
ui (require :lspconfig.ui.windows)]
- (diagnostics.setup)
(set ui.default_options.border :single)
- (setup-mason-lspconfig)))
+ (diagnostics.setup)
+ (mason-lspconfig.setup)))
{1 :neovim/nvim-lspconfig
:event :BufReadPost
diff --git a/fnl/plugins/lsp/mason-lspconfig.fnl b/fnl/plugins/lsp/mason-lspconfig.fnl
new file mode 100644
index 0000000..3e34c32
--- /dev/null
+++ b/fnl/plugins/lsp/mason-lspconfig.fnl
@@ -0,0 +1,22 @@
+;; Mason lspconfig setup
+
+(fn capabilities []
+ (let [cmp-lsp (require :cmp_nvim_lsp)]
+ (cmp-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities))))
+
+(fn handlers [server]
+ (let [servers (require :plugins.lsp.servers)
+ lspconfig (require :lspconfig)]
+ (let [config (. lspconfig server)
+ opts (or (. servers server) {})]
+ (tset opts :capabilities (capabilities))
+ (config.setup opts))))
+
+(fn setup []
+ (let [mason-lspconfig (require :mason-lspconfig)
+ servers (require :plugins.lsp.servers)]
+ (mason-lspconfig.setup {:ensure_installed (vim.tbl_keys servers)
+ :automatic_installation true
+ :handlers [handlers]})))
+
+{: setup}