summaryrefslogtreecommitdiff
path: root/fnl/config/lsp
diff options
context:
space:
mode:
Diffstat (limited to 'fnl/config/lsp')
-rw-r--r--fnl/config/lsp/handlers.fnl26
1 files changed, 25 insertions, 1 deletions
diff --git a/fnl/config/lsp/handlers.fnl b/fnl/config/lsp/handlers.fnl
index fc0b006..c691d1a 100644
--- a/fnl/config/lsp/handlers.fnl
+++ b/fnl/config/lsp/handlers.fnl
@@ -1,4 +1,6 @@
-(module config.lsp.handlers)
+(module config.lsp.handlers
+ {autoload {util util
+ nvim aniseed.nvim}})
(def- signs
[{ :name "DiagnosticSignError" :text "" }
@@ -33,3 +35,25 @@
(set vim.lsp.handlers.textDocument/hover (vim.lsp.with { :border "rounded"} ))
(set vim.lsp.handlers.textDocument/signatureHelp (vim.lsp.with vim.lsp.handlers.signature_help { :border "rounded"} ))))
+(defn- lsp-keymaps [bufnr]
+ (let [opts { :noremap true :silent true }]
+ (do
+ (nvim.buf_set_keymap bufnr :n :gD "<cmd>lua vim.lsp.buf.declaration()<CR>" opts)
+ (nvim.buf_set_keymap bufnr :n :gd "<cmd>lua vim.lsp.buf.definition()<CR>" opts)
+ (nvim.buf_set_keymap bufnr :n :K "<cmd>lua vim.lsp.buf.hover()<CR>" opts)
+ (nvim.buf_set_keymap bufnr :n :gI "<cmd>lua vim.lsp.buf.implementation()<CR>" opts)
+ (nvim.buf_set_keymap bufnr :n :gr "<cmd>lua vim.lsp.buf.references()<CR>" opts)
+ (nvim.buf_set_keymap bufnr :n :gl "<cmd>lua vim.diagnostic.open_float()<CR>" opts)
+ (nvim.buf_set_keymap bufnr :n :<leader>q "<cmd>lua vim.diagnostic.setloclist()<CR>" opts))))
+
+(defn on-attach [client bufnr]
+ (if (= client.name :html)
+ (set client.resolved_capabilities.document_formatting false))
+ (lsp-keymaps bufnr))
+
+(defn capabilities []
+ (let [capabilities (vim.lsp.protocol.make_client_capabilities)]
+ (set capabilities.textDocument.completion.completionItem.snippetSupport true)
+ (let [cmp-nvim-lsp (util.load-plugin :cmp_nvim_lsp)]
+ (cmp-nvim-lsp.update_capabilities capabilities))
+ (capabilities)))