Compare commits

..

4 Commits

Author SHA1 Message Date
Marcin Woźniak
f0c20713d1 Added the popout window to see diagnostic 2022-04-29 13:18:21 +02:00
Marcin Woźniak
09b415812d Added the comments 2022-04-29 13:17:37 +02:00
Marcin Woźniak
04234e57b1 When you are in the insert mode you see the errors nvim 2022-04-29 13:17:29 +02:00
Marcin Woźniak
0aaac9f627 Added the handlers into nvim 2022-04-29 13:17:13 +02:00

View File

@ -178,12 +178,19 @@ local on_attach = function(client, bufnr)
--vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end end
-- LSP settings (for overriding per client)
local handlers = {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {border = border}),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {border = border }),
}
-- Use a loop to conveniently call 'setup' on multiple servers and -- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches -- map buffer local keybindings when the language server attaches
local servers = { 'pyright', 'bashls', 'ansiblels' } local servers = { 'pyright', 'bashls', 'ansiblels' }
for _, lsp in pairs(servers) do for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup { require('lspconfig')[lsp].setup {
on_attach = on_attach, on_attach = on_attach,
handlers=handlers,
capabilities = capabilities, capabilities = capabilities,
flags = { flags = {
debounce_text_changes = 150, debounce_text_changes = 150,
@ -191,6 +198,12 @@ for _, lsp in pairs(servers) do
} }
end end
-- Handlers when you are in the insert mode you see the errors
vim.lsp.handlers["textDocument/publishDiagnostics"] =
vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics,
{update_in_insert = true})
-- Setup a yamlls plugin
require'lspconfig'.yamlls.setup{ require'lspconfig'.yamlls.setup{
settings = { settings = {
json = { json = {
@ -269,8 +282,13 @@ cmp.setup.cmdline('/', {
{ name = 'buffer' } { name = 'buffer' }
} }
}) })
EOF EOF
" Added popout window to see diagnostic
set updatetime=250
autocmd! CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false, scope="cursor"})
" Neoformat " Neoformat
let g:neoformat_try_formatprg = 1 let g:neoformat_try_formatprg = 1
let g:neoformat_basic_format_trim = 1 let g:neoformat_basic_format_trim = 1