From 9ffdeceda3c36dc6a894190fdaf57b66d3018cd7 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 30 Oct 2022 21:59:47 +0200 Subject: TODO: fix formatting and diagnostic server settings --- lua/plugins/lsp.lua | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'lua/plugins') diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index f39cc58..097699e 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -7,7 +7,7 @@ local utils = require("user.utils") local custom_attach = function(client, bufnr) -- Enable completion triggered by vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - +--vim.lsp.protocol.CompletionItemKind = {} -- Mappings. local map = function(mode, l, r, opts) opts = opts or {} @@ -149,25 +149,36 @@ map('n', 'm', ':call v:lua.toggle_diagnostics()') -- }) -- The below command will highlight the current variable and its usages in the buffer. - if client.server_capabilities.documentHighlightProvider then - vim.cmd([[ - hi! link LspReferenceRead Visual - hi! link LspReferenceText Visual - hi! link LspReferenceWrite Visual - augroup lsp_document_highlight - autocmd! * - autocmd CursorHold lua vim.lsp.buf.document_highlight() - autocmd CursorMoved lua vim.lsp.buf.clear_references() - augroup END - ]]) - end +-- if client.server_capabilities.documentHighlightProvider then +-- vim.cmd([[ +-- hi! link LspReferenceRead Visual +-- hi! link LspReferenceText Visual +-- hi! link LspReferenceWrite Visual +-- augroup lsp_document_highlight +-- autocmd! * +-- autocmd CursorHold lua vim.lsp.buf.document_highlight() +-- autocmd CursorHoldI lua vim.lsp.buf.document_highlight() +-- autocmd CursorMoved lua vim.lsp.buf.clear_references() +-- augroup END +-- ]]) +-- end + + -- Only highlight if compatible with the language +-- if client.resolved_capabilities.document_highlight then +-- vim.cmd('augroup LspHighlight') +-- vim.cmd('autocmd!') +-- vim.cmd('autocmd CursorHold lua vim.lsp.buf.document_highlight()') +-- vim.cmd('autocmd CursorMoved lua vim.lsp.buf.clear_references()') +-- vim.cmd('augroup END') +-- end - if vim.g.logging_level == "debug" then - local msg = string.format("Language server %s started!", client.name) - vim.notify(msg, vim.log.levels.DEBUG, { title = "Server?" }) - end +-- if vim.g.logging_level == "debug" then +-- local msg = string.format("Language server %s started!", client.name) +-- vim.notify(msg, vim.log.levels.DEBUG, { title = "Server?" }) +-- end +-- suppress error messages from lang servers end - +vim.lsp.set_log_level("debug") local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) capabilities.textDocument.completion.completionItem.snippetSupport = true -- cgit v1.2.3