summaryrefslogtreecommitdiff
path: root/fnl/config/lsp/handlers.fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-05 02:52:05 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-05 02:52:05 +0100
commite3ef0791e7462c95c77ec9014d92ec97484789c8 (patch)
tree0094f9d2da11f34075187813f5c991e5ce4e037d /fnl/config/lsp/handlers.fnl
parentbe463a40d7ec811a02732ba0a2f2c657b12bd73c (diff)
Refactor lsp
Diffstat (limited to 'fnl/config/lsp/handlers.fnl')
-rw-r--r--fnl/config/lsp/handlers.fnl59
1 files changed, 0 insertions, 59 deletions
diff --git a/fnl/config/lsp/handlers.fnl b/fnl/config/lsp/handlers.fnl
deleted file mode 100644
index 96b50e6..0000000
--- a/fnl/config/lsp/handlers.fnl
+++ /dev/null
@@ -1,59 +0,0 @@
-;; Handlers for the requests and responses from and to the lsp server.
-(module config.lsp.handlers {autoload {util config.util nvim aniseed.nvim}})
-
-(def- signs [{:name :DiagnosticSignError :text ""}
- {:name :DiagnosticSignWarn :text ""}
- {:name :DiagnosticSignHint :text ""}
- {:name :DiagnosticSignInfo :text ""}])
-
-(defn- apply-signs [] (each [_ sign (ipairs signs)]
- (vim.fn.sign_define sign.name
- {:texthl sign.name
- :text sign.text
- :numhl ""})))
-
-(def- config {:virtual_text false
- :signs {:active signs}
- :update_in_insert true
- :underline true
- :severity_sort true
- :float {:focusable false
- :style :minimal
- :border :rounded
- :source :always
- :header ""
- :prefix ""}})
-
-(defn setup [] (apply-signs) (vim.diagnostic.config config)
- (set vim.lsp.handlers.textDocument/hover
- (vim.lsp.with {:border :rounded :width 60}))
- (set vim.lsp.handlers.textDocument/signatureHelp
- (vim.lsp.with vim.lsp.handlers.signature_help
- {:border :rounded :width 60})))
-
-(defn- lsp-keymaps [bufnr]
- (let [opts {:noremap true :silent true}]
- (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 :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 :gs
- "<cmd>lua vim.lsp.buf.signature_help()<CR>" opts)))
-
-(defn on-attach [client bufnr] (if (= client.name :html)
- (set client.server_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.prequire :cmp_nvim_lsp)]
- (cmp-nvim-lsp.default_capabilities capabilities))))