diff options
Diffstat (limited to 'fnl/plugins/lsp')
-rw-r--r-- | fnl/plugins/lsp/lspconfig.fnl | 24 | ||||
-rw-r--r-- | fnl/plugins/lsp/mason-lspconfig.fnl | 22 |
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} |