2021-04-03 18:34:15 +00:00
|
|
|
(module plugins.lsp
|
|
|
|
{require {a aniseed.core
|
|
|
|
fennel aniseed.fennel
|
|
|
|
nvim aniseed.nvim
|
|
|
|
lsp lspconfig
|
2021-04-22 14:00:33 +00:00
|
|
|
lsp-configs lspconfig.configs
|
2021-04-03 18:34:15 +00:00
|
|
|
saga lspsaga
|
2021-04-04 13:04:29 +00:00
|
|
|
utils utils
|
2021-04-23 15:41:29 +00:00
|
|
|
compe compe
|
2021-04-24 09:48:47 +00:00
|
|
|
lsp_signature lsp_signature
|
2021-04-29 19:08:05 +00:00
|
|
|
symbols-outline symbols-outline
|
2021-04-30 10:53:30 +00:00
|
|
|
trouble trouble
|
|
|
|
nvim-treesitter-configs nvim-treesitter.configs}
|
2021-04-03 18:34:15 +00:00
|
|
|
require-macros [macros]})
|
|
|
|
|
2021-04-29 19:08:05 +00:00
|
|
|
|
|
|
|
(local colors (utils.colors))
|
|
|
|
|
2021-04-30 08:23:30 +00:00
|
|
|
(symbols-outline.setup { :highlight_hovered_item true :show_guides true})
|
|
|
|
(set vim.o.signcolumn "yes")
|
|
|
|
|
2021-04-30 10:53:30 +00:00
|
|
|
(nvim-treesitter-configs.setup
|
|
|
|
{ :ensure_installed "maintained"
|
|
|
|
:highlight { :enable true}
|
|
|
|
:indent { :enable true}
|
|
|
|
:incremental_selection
|
|
|
|
{ :enable true
|
|
|
|
:keymaps { :init_selection "gss"
|
|
|
|
:node_incremental "gsl"
|
|
|
|
:node_decremental "gsh"
|
|
|
|
:scope_incremental "gsj"
|
|
|
|
:scope_decremental "gsk"}}})
|
|
|
|
|
|
|
|
|
2021-04-30 08:23:30 +00:00
|
|
|
; LSP config -------------------------------------------------------------------------------- {{{{{
|
|
|
|
|
2021-04-03 18:34:15 +00:00
|
|
|
(fn on_attach [client bufnr]
|
2021-04-23 15:41:29 +00:00
|
|
|
(lsp_signature.on_attach)
|
2021-04-03 18:34:15 +00:00
|
|
|
(if client.resolved_capabilities.document_highlight
|
2021-04-04 13:04:29 +00:00
|
|
|
(do
|
|
|
|
(utils.highlight "LspReferenceRead" {:gui "underline"})
|
|
|
|
(utils.highlight "LspReferenceText" {:gui "underline"})
|
|
|
|
(utils.highlight "LspReferenceWrite" {:gui "underline"})
|
|
|
|
(vim.api.nvim_exec
|
|
|
|
"augroup lsp_document_highlight
|
|
|
|
autocmd! * <buffer>
|
|
|
|
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
|
|
|
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
|
|
|
augroup END"
|
|
|
|
false))))
|
2021-04-03 18:34:15 +00:00
|
|
|
|
|
|
|
|
2021-04-22 14:00:33 +00:00
|
|
|
(fn better_root_pattern [patterns except-patterns]
|
|
|
|
"match path if one of the given patterns is matched, EXCEPT if one of the except-patterns is matched"
|
|
|
|
(fn [path]
|
|
|
|
(when (not ((lsp.util.root_pattern except-patterns) path))
|
|
|
|
((lsp.util.root_pattern patterns) path))))
|
|
|
|
|
|
|
|
|
|
|
|
(local capabilities (vim.lsp.protocol.make_client_capabilities))
|
|
|
|
(set capabilities.textDocument.completion.completionItem.snippetSupport true)
|
|
|
|
(set capabilities.textDocument.completion.completionItem.resolveSupport
|
2021-04-22 17:54:37 +00:00
|
|
|
{ :properties ["documentation" "detail" "additionalTextEdits"]})
|
|
|
|
|
|
|
|
(fn init-lsp [lsp-name ?opts]
|
|
|
|
"initialize a language server with defaults"
|
2021-04-23 14:46:45 +00:00
|
|
|
(let [merged-opts (a.merge {:on_attach on_attach} (or ?opts {}))]
|
2021-04-22 17:54:37 +00:00
|
|
|
((. lsp lsp-name :setup) merged-opts)))
|
2021-04-23 14:46:45 +00:00
|
|
|
|
2021-04-22 17:54:37 +00:00
|
|
|
|
|
|
|
(init-lsp :rust_analyzer { :capabilities capabilities})
|
|
|
|
(init-lsp :tsserver { :root_dir (lsp.util.root_pattern "package.json")})
|
|
|
|
(init-lsp :jsonls { :commands { :Format [ #(vim.lsp.buf.range_formatting [] [0 0] [(vim.fn.line "$") 0])]}})
|
|
|
|
(init-lsp :denols { :root_dir (better_root_pattern [".git"] ["package.json"])})
|
|
|
|
(init-lsp :hls { :settings { :languageServerHaskell { :formattingProvider "stylish-haskell"}}})
|
|
|
|
(init-lsp :vimls)
|
|
|
|
(init-lsp :bashls)
|
|
|
|
(init-lsp :erlangls)
|
|
|
|
(init-lsp :yamlls)
|
|
|
|
(init-lsp :html)
|
|
|
|
(init-lsp :cssls)
|
|
|
|
|
|
|
|
|
|
|
|
;(lsp.vimls.setup { :on_attach on_attach})
|
2021-04-30 08:23:30 +00:00
|
|
|
; }}}}}
|
2021-04-22 14:00:33 +00:00
|
|
|
|
2021-04-30 08:23:30 +00:00
|
|
|
; compe -------------------------------------------------------------------------------- {{{{{
|
2021-04-03 18:34:15 +00:00
|
|
|
(compe.setup
|
|
|
|
{ :enabled true
|
|
|
|
:autocomplete false
|
|
|
|
:debug false
|
|
|
|
:min_length 1
|
|
|
|
:preselect "enable"
|
|
|
|
:throttle_time 80
|
|
|
|
:source_timeout 200
|
|
|
|
:incomplete_delay 400
|
|
|
|
:max_abbr_width 100
|
|
|
|
:max_kind_width 100
|
|
|
|
:max_menu_width 100
|
|
|
|
:documentation true
|
|
|
|
:source { :path true
|
|
|
|
:buffer true
|
|
|
|
:calc true
|
|
|
|
:nvim_lsp true
|
|
|
|
:nvim_lua true
|
2021-04-03 19:21:12 +00:00
|
|
|
:vsnip false}})
|
2021-04-03 18:34:15 +00:00
|
|
|
|
2021-04-30 08:23:30 +00:00
|
|
|
; }}}}}
|
|
|
|
|
|
|
|
; LSP saga -------------------------------------------------------------------------------- {{{{{
|
2021-04-03 18:34:15 +00:00
|
|
|
|
|
|
|
(saga.init_lsp_saga
|
|
|
|
{ :border_style 1
|
|
|
|
:code_action_keys { :quit "<esc>" :exec "<CR>"}
|
|
|
|
:rename_action_keys { :quit "<esc>" :exec "<CR>"}
|
|
|
|
:finder_action_keys { :quit "<esc>"
|
|
|
|
:open "<CR>"
|
|
|
|
:vsplit "v"
|
|
|
|
:split "b"
|
|
|
|
:scroll_up "<C-u>"
|
|
|
|
:scroll_down "<C-d>"}})
|
|
|
|
|
2021-04-04 13:04:29 +00:00
|
|
|
|
2021-04-29 19:08:05 +00:00
|
|
|
(utils.highlight "LspSagaCodeActionTitle" {:fg colors.bright_aqua})
|
|
|
|
(utils.highlight "LspSagaBorderTitle" {:fg colors.bright_aqua})
|
|
|
|
(utils.highlight "LspSagaCodeActionContent" {:fg colors.bright_aqua})
|
|
|
|
(utils.highlight "LspSagaFinderSelection" {:fg colors.bright_aqua})
|
|
|
|
(utils.highlight "LspSagaDiagnosticHeader" {:fg colors.bright_aqua})
|
|
|
|
(utils.highlight "TargetWord" {:fg colors.bright_aqua})
|
|
|
|
|
|
|
|
|
2021-04-30 08:23:30 +00:00
|
|
|
; }}}}}
|
|
|
|
|
|
|
|
; LSP trouble -------------------------------------------------------------------------------- {{{{{
|
|
|
|
(trouble.setup
|
|
|
|
{:icons false
|
|
|
|
:auto_preview true
|
|
|
|
:auto_close true
|
|
|
|
:auto_open false})
|
|
|
|
|
|
|
|
|
2021-04-29 19:08:05 +00:00
|
|
|
(utils.highlight "LspTroubleFoldIcon" {:bg "NONE" :fg colors.bright_orange})
|
|
|
|
(utils.highlight "LspTroubleCount" {:bg "NONE" :fg colors.bright_green})
|
|
|
|
(utils.highlight "LspTroubleText" {:bg "NONE" :fg colors.light0})
|
|
|
|
|
|
|
|
(utils.highlight "LspTroubleSignError" {:bg "NONE" :fg colors.bright_red})
|
|
|
|
(utils.highlight "LspTroubleSignWarning" {:bg "NONE" :fg colors.bright_yellow})
|
|
|
|
(utils.highlight "LspTroubleSignInformation" {:bg "NONE" :fg colors.bright_aqua})
|
|
|
|
(utils.highlight "LspTroubleSignHint" {:bg "NONE" :fg colors.bright_blue})
|
|
|
|
|
2021-04-30 08:23:30 +00:00
|
|
|
; }}}}}
|
2021-04-04 13:04:29 +00:00
|
|
|
|
2021-04-30 10:53:30 +00:00
|
|
|
|
|
|
|
|
2021-04-30 08:23:30 +00:00
|
|
|
; vim:foldmarker={{{{{,}}}}}
|