blob: bc30688ca14a16cdbd27e44dd4c2cb49a2f8e701 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
(local lsp (require :lspconfig))
(local {: merge} (require :nvrc.utils))
(local colors (require :nvrc.colors))
(fn on_attach [client bufnr]
(if client.server_capabilities.document_highlight
(do
(vim.api.nvim_exec "augroup lsp_document_highlight
autocmd! * <buffer>
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END" false))))
(local default_capabilities (vim.lsp.protocol.make_client_capabilities))
(fn init_lsp [lsp-name ?opts]
"initialize a language server with defaults"
(let [merged-opts (merge {: on_attach
:capabilities default_capabilities}
(or ?opts {}))]
((. lsp lsp-name :setup) merged-opts)))
(tset vim.lsp.handlers :textDocument/publishDiagnostics
(vim.lsp.with vim.lsp.diagnostic.on_publish_diagnostics
{:update_in_insert false
:virtual_text {:prefix "-"}
:signs false}))
;; rust-analyzer is managed via rust-tools.nvim
(init_lsp :clangd)
(init_lsp :gopls)
(init_lsp :hls)
(init_lsp :ltex {:settings {:ltex {:language :en-AU}}})
(init_lsp :nil_ls)
(init_lsp :pyright {:settings {:python {:analysis {:typeCheckingMode :off}}}})
(init_lsp :tinymist)
|