1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
return {
{
'neovim/nvim-lspconfig',
event = {
'BufReadPre',
'BufNewFile'
},
dependencies = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
},
config = function()
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
local lsp_attach = function(client, bufnr) end
local lspconfig = require('lspconfig')
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { texthl = hl, numhl = hl })
end
vim.diagnostic.config({
update_in_insert = true,
virtual_text = false,
})
vim.api.nvim_create_autocmd("CursorHold", {
buffer = bufnr,
callback = function()
local opts = {
pad_top = 1,
pad_bottom = 1,
header = '',
source = 'always',
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", },
prefix = ' ',
scope = 'cursor',
}
vim.diagnostic.open_float(nil, opts)
end
})
require('mason').setup()
require('mason-lspconfig').setup()
require('mason-lspconfig').setup_handlers({
function(server_name)
lspconfig[server_name].setup({
on_attach = lsp_attach,
capabilities = lsp_capabilities,
})
end,
})
end,
},
}
|