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 --- init.lua | 2 ++ lua/plugins/lsp.lua | 47 +++++++++++++++++++++++++++++------------------ lua/user/opts.lua | 3 ++- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/init.lua b/init.lua index 2ac0b01..8de653a 100644 --- a/init.lua +++ b/init.lua @@ -39,6 +39,7 @@ if impatient_ok then end -- Check if we have the latest stable version of nvim +local opts = { noremap = true, silent = true, buffer = true } local utils = require("user.utils") local expected_ver = "0.8.0" local nvim_ver = utils.get_nvim_version() @@ -130,3 +131,4 @@ vim.g.do_filetype_nvim = 1 vim.g.did_load_filetypes = 0 + 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 diff --git a/lua/user/opts.lua b/lua/user/opts.lua index 3033325..9d9a138 100644 --- a/lua/user/opts.lua +++ b/lua/user/opts.lua @@ -10,7 +10,8 @@ vim.cmd([[ ]]) -- Environment -vim.opt.shell = "zsh" -- +--vim.opt.shell = "zsh" -- +vim.o.shell = "/bin/zsh" vim.scriptencoding = "utf-8" -- vim.opt.encoding = "utf-8" -- vim.opt.fileencoding = "utf-8" -- -- cgit v1.2.3