nvim: LSP configuration updates
This commit is contained in:
parent
6b3a0c92ee
commit
41fa76eb00
4 changed files with 10 additions and 8 deletions
|
@ -5,7 +5,7 @@
|
|||
augroup (vim.api.nvim_create_augroup :NifocDiagnostic {:clear true})
|
||||
aucmd vim.api.nvim_create_autocmd]
|
||||
(fn maybe-refresh-codelens [client]
|
||||
(when client.server_capabilities.codeLensProvider
|
||||
(when (client.supports_method :textDocument/codeLens)
|
||||
(vim.lsp.codelens.refresh)))
|
||||
|
||||
(fn mod.setup []
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
(set-bufvar 0 :nifoc_formatter_disabled 1))
|
||||
|
||||
(fn mod.maybe-enable-lsp [client bufnr]
|
||||
(when client.server_capabilities.documentRangeFormattingProvider
|
||||
(when (client.supports_method :textDocument/rangeFormatting)
|
||||
(api.nvim_buf_set_option bufnr :formatexpr "v:lua.vim.lsp.formatexpr()"))
|
||||
(when client.server_capabilities.documentFormattingProvider
|
||||
(when (client.supports_method :textDocument/formatting)
|
||||
(set-bufvar bufnr :nifoc_lsp_formatter_enabled 1)))
|
||||
|
||||
(fn mod.maybe-format-buffer []
|
||||
|
|
|
@ -77,9 +77,11 @@
|
|||
(let [current-context (.. (. current-function-symbols sym.kind)
|
||||
sym.text)]
|
||||
(table.insert context-levels current-context))))))
|
||||
(set-bufvar ctx.bufnr :nifoc_lsp_current_context
|
||||
(table.concat context-levels " "))
|
||||
(vim.api.nvim_command :redrawstatus))
|
||||
(let [current-context vim.b.nifoc_lsp_current_context
|
||||
new-context (table.concat context-levels " ")]
|
||||
(when (not= current-context new-context)
|
||||
(set-bufvar ctx.bufnr :nifoc_lsp_current_context new-context)
|
||||
(vim.api.nvim_cmd {:cmd :redrawstatus} []))))
|
||||
|
||||
(fn update-current-context [bufnr]
|
||||
(let [params {:textDocument (vim.lsp.util.make_text_document_params bufnr)}]
|
||||
|
@ -161,7 +163,7 @@
|
|||
handle-symbols-under-cursor)))
|
||||
|
||||
(fn mod.on-attach [client bufnr]
|
||||
(when client.server_capabilities.documentSymbolProvider
|
||||
(when (client.supports_method :textDocument/documentSymbol)
|
||||
(aucmd [:CursorHold]
|
||||
{:callback #(update-current-context bufnr)
|
||||
:buffer bufnr
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
diagnostic (require :nifoc.diagnostic)
|
||||
formatting (require :nifoc.formatting)]
|
||||
(fn custom-attach [client bufnr]
|
||||
(when client.server_capabilities.documentHighlightProvider
|
||||
(when (client.supports_method :textDocument/documentHighlight)
|
||||
(illuminate.on_attach client bufnr))
|
||||
(nifoc-lsp.on-attach client bufnr)
|
||||
(diagnostic.maybe-enable-lsp client bufnr)
|
||||
|
|
Loading…
Reference in a new issue