feat(LspAttach): Correct indentation in LspAttach function

This commit is contained in:
Dionisio E Alonso 2023-12-31 16:47:12 -03:00
parent 48c9c1b2a7
commit 1d5e0676a2
1 changed files with 44 additions and 44 deletions

View File

@ -55,53 +55,53 @@ local nvim_lsp = require("lspconfig")
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", { clear = false }),
callback = function(args)
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
vim.api.nvim_create_autocmd("CursorHoldI", {
group = vim.api.nvim_create_augroup("Diagnostics", { clear = true }),
buffer = bufnr,
callback = function()
vim.diagnostic.open_float({ focusable = false, header = "" })
end
})
callback = function(args)
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
vim.api.nvim_create_autocmd("CursorHoldI", {
group = vim.api.nvim_create_augroup("Diagnostics", { clear = true }),
buffer = bufnr,
callback = function()
vim.diagnostic.open_float({ focusable = false, header = "" })
end
})
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true,
virtual_text = { source = "if_many", spacing = 24 },
}
)
vim.diagnostic.config({
float = { source = "if_many", border = "rounded" }
})
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true,
virtual_text = { source = "if_many", spacing = 24 },
}
)
vim.diagnostic.config({
float = { source = "if_many", border = "rounded" }
})
local cmp = require("cmp")
cmp.setup {
mapping = {
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<CR>"] = cmp.mapping({
i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
c = function(fallback)
if cmp.visible() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })
else
fallback()
local cmp = require("cmp")
cmp.setup {
mapping = {
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<CR>"] = cmp.mapping({
i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
c = function(fallback)
if cmp.visible() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })
else
fallback()
end
end
end
}),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
},
formatting = {format = cmp_format},
sources = {
{name = "nvim_lsp"},
{name = "buffer", keyword_length = 5},
{name = "path"}
},
experimental = {ghost_text = true},
}
end,
}),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
},
formatting = {format = cmp_format},
sources = {
{name = "nvim_lsp"},
{name = "buffer", keyword_length = 5},
{name = "path"}
},
experimental = {ghost_text = true},
}
end,
})
local capabilities = vim.lsp.protocol.make_client_capabilities()