Setup lsp

This commit is contained in:
buffet 2021-05-15 00:20:12 +00:00
parent 73d12881f9
commit 5eff7fed68
4 changed files with 54 additions and 2 deletions

View file

@ -26,6 +26,7 @@ DOTS = ['alacritty', 'bash', 'direnv', 'git', 'nvim', 'profile', 'xinit']
dependencies = [
'acpi',
'alacritty',
'clang',
'curl',
'firefox',
'git',

View file

@ -36,7 +36,11 @@
:g (cmd "Goyo" "goyo")
:l (cmd "Limelight!!" "limelight")}
;; TODO: lsp binds
:l {:name "+lsp"}}
:l {:name "+lsp"
:a (cmd "Lspsaga code_action" "code actions")
:d (cmd "Lspsaga hover_doc" "show docs")
:f (cmd "Lspsaga lsp_finder" "finder")
:r (cmd "Lspsaga rename" "rename")
:g [vim.lsp.buf.definition "go to definition"]}}
{:prefix "<Leader>"})

View file

@ -0,0 +1,37 @@
(module modules.lsp
{require {a aniseed.core
lsp lspconfig
lsp_signature lsp_signature
rust-tools rust-tools
utils utils}})
(fn on_attach [client bufnr]
(lsp_signature.on_attach)
(if client.resolved_capabilities.document_highlight
(do
(utils.highlight "LspReferenceRead" {:gui "underline"})
(utils.highlight "LspReferenceText" {:gui "underline"})
(utils.highlight "LspReferenceWrite" {:gui "underline"}))))
(fn init-lsp [lsp-name ?opts]
"Initialize a language server"
(let [merged-opts (a.merge {:on_attach on_attach} (or ?opts {}))]
((. lsp lsp-name :setup) merged-opts)))
;; Rust extra caps
(let [caps (vim.lsp.protocol.make_client_capabilities)]
;; TODO: fix
(set caps.textDocument.completion.completionItem.snippetSupport true)
(set caps.textDocument.completion.completionItem.resolveSupport
{:properties ["documentation" "detail" "additionalTextEdits"]})
(lsp.rust_analyzer.setup
{:capabilities caps
:on_attach (fn [...]
(on_attach ...))}))
;; TODO: fix
;(rust-tools.setup
; {:tools {:inlay_hints {:show_parameter_hints false}}}))}))
(init-lsp :bashls)
(init-lsp :clangd)
(init-lsp :vimls)

View file

@ -0,0 +1,10 @@
(module modules.plugins.lspsaga
{require {saga lspsaga}})
(saga.init_lsp_saga
{:border_style "round"
:finder_action_keys
{:open "<Cr>"
:vsplit :v
:split :s
:quit :q}})