format lspconfig
This commit is contained in:
parent
97e4abc26b
commit
1c9eea9dca
@ -3,8 +3,7 @@ local lspKeys = function(client, bufnr)
|
|||||||
local options = { noremap = true, silent = false, buffer = bufnr }
|
local options = { noremap = true, silent = false, buffer = bufnr }
|
||||||
vim.keymap.set('n', '<space>,', vim.diagnostic.goto_prev, vim.tbl_extend('error', options, { desc = 'Diag prev' }))
|
vim.keymap.set('n', '<space>,', vim.diagnostic.goto_prev, vim.tbl_extend('error', options, { desc = 'Diag prev' }))
|
||||||
vim.keymap.set('n', '<space>;', vim.diagnostic.goto_next, vim.tbl_extend('error', options, { desc = 'Diag next' }))
|
vim.keymap.set('n', '<space>;', vim.diagnostic.goto_next, vim.tbl_extend('error', options, { desc = 'Diag next' }))
|
||||||
vim.keymap.set({ 'n', 'x' }, '<space>a', vim.lsp.buf.code_action,
|
vim.keymap.set({ 'n', 'x' }, '<space>a', vim.lsp.buf.code_action, vim.tbl_extend('error', options, { desc = 'Code action' }))
|
||||||
vim.tbl_extend('error', options, { desc = 'Code action' }))
|
|
||||||
vim.keymap.set('n', '<space>d', function()
|
vim.keymap.set('n', '<space>d', function()
|
||||||
fzf.lsp_definitions({ jump_to_single_result = true })
|
fzf.lsp_definitions({ jump_to_single_result = true })
|
||||||
end, vim.tbl_extend('error', options, { desc = 'Definition' }))
|
end, vim.tbl_extend('error', options, { desc = 'Definition' }))
|
||||||
@ -12,26 +11,18 @@ local lspKeys = function(client, bufnr)
|
|||||||
vim.keymap.set('n', '<space>h', function()
|
vim.keymap.set('n', '<space>h', function()
|
||||||
require('pretty_hover').hover()
|
require('pretty_hover').hover()
|
||||||
end, vim.tbl_extend('error', options, { desc = 'Hover' }))
|
end, vim.tbl_extend('error', options, { desc = 'Hover' }))
|
||||||
vim.keymap.set('n', '<space>c', vim.lsp.buf.outgoing_calls,
|
vim.keymap.set('n', '<space>c', vim.lsp.buf.outgoing_calls, vim.tbl_extend('error', options, { desc = 'Outgoing calls' }))
|
||||||
vim.tbl_extend('error', options, { desc = 'Outgoing calls' }))
|
vim.keymap.set('n', '<space>C', vim.lsp.buf.incoming_calls, vim.tbl_extend('error', options, { desc = 'Incoming calls' }))
|
||||||
vim.keymap.set('n', '<space>C', vim.lsp.buf.incoming_calls,
|
|
||||||
vim.tbl_extend('error', options, { desc = 'Incoming calls' }))
|
|
||||||
vim.keymap.set('n', '<space>m', vim.lsp.buf.rename, vim.tbl_extend('error', options, { desc = 'Rename' }))
|
vim.keymap.set('n', '<space>m', vim.lsp.buf.rename, vim.tbl_extend('error', options, { desc = 'Rename' }))
|
||||||
vim.keymap.set('n', '<C-t>', fzf.lsp_live_workspace_symbols,
|
vim.keymap.set('n', '<C-t>', fzf.lsp_live_workspace_symbols, vim.tbl_extend('error', options, { desc = 'Workspace symbols' }))
|
||||||
vim.tbl_extend('error', options, { desc = 'Workspace symbols' }))
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, vim.tbl_extend('error', options, { desc = 'Type definition' }))
|
||||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition,
|
vim.keymap.set({ 'n', 'i', 'x' }, '<C-k>', vim.lsp.buf.signature_help, vim.tbl_extend('error', options, { desc = 'Signature help' }))
|
||||||
vim.tbl_extend('error', options, { desc = 'Type definition' }))
|
|
||||||
vim.keymap.set({ 'n', 'i', 'x' }, '<C-k>', vim.lsp.buf.signature_help,
|
|
||||||
vim.tbl_extend('error', options, { desc = 'Signature help' }))
|
|
||||||
vim.keymap.set('n', '<space>r', fzf.lsp_references, vim.tbl_extend('error', options, { desc = 'References' }))
|
vim.keymap.set('n', '<space>r', fzf.lsp_references, vim.tbl_extend('error', options, { desc = 'References' }))
|
||||||
vim.keymap.set('n', '<A-m>', fzf.lsp_document_symbols, vim.tbl_extend('error', options, { desc = 'Document symbols' }))
|
vim.keymap.set('n', '<A-m>', fzf.lsp_document_symbols, vim.tbl_extend('error', options, { desc = 'Document symbols' }))
|
||||||
vim.keymap.set('n', '<space>s', fzf.lsp_live_workspace_symbols,
|
vim.keymap.set('n', '<space>s', fzf.lsp_live_workspace_symbols, vim.tbl_extend('error', options, { desc = 'Workspace symbols' }))
|
||||||
vim.tbl_extend('error', options, { desc = 'Workspace symbols' }))
|
vim.keymap.set('n', '<space>v', vim.diagnostic.open_float, vim.tbl_extend('error', options, { desc = 'Diagnostics Float' }))
|
||||||
vim.keymap.set('n', '<space>v', vim.diagnostic.open_float,
|
|
||||||
vim.tbl_extend('error', options, { desc = 'Diagnostics Float' }))
|
|
||||||
vim.keymap.set('n', '<space>V', fzf.diagnostics_document, vim.tbl_extend('error', options, { desc = 'Diagnostics' }))
|
vim.keymap.set('n', '<space>V', fzf.diagnostics_document, vim.tbl_extend('error', options, { desc = 'Diagnostics' }))
|
||||||
vim.keymap.set('n', '<A-o>', '<cmd>ClangdSwitchSourceHeader<CR>',
|
vim.keymap.set('n', '<A-o>', '<cmd>ClangdSwitchSourceHeader<CR>', vim.tbl_extend('error', options, { desc = 'Switch Source/Header' }))
|
||||||
vim.tbl_extend('error', options, { desc = 'Switch Source/Header' }))
|
|
||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some keybinds conditional on server capabilities
|
||||||
if client.server_capabilities.documentFormattingProvider then
|
if client.server_capabilities.documentFormattingProvider then
|
||||||
@ -155,9 +146,9 @@ return {
|
|||||||
}
|
}
|
||||||
local signs = {
|
local signs = {
|
||||||
{ name = 'DiagnosticSignError', text = diagnostics.Error },
|
{ name = 'DiagnosticSignError', text = diagnostics.Error },
|
||||||
{ name = 'DiagnosticSignWarn', text = diagnostics.Warning },
|
{ name = 'DiagnosticSignWarn', text = diagnostics.Warning },
|
||||||
{ name = 'DiagnosticSignHint', text = diagnostics.Hint },
|
{ name = 'DiagnosticSignHint', text = diagnostics.Hint },
|
||||||
{ name = 'DiagnosticSignInfo', text = diagnostics.Information },
|
{ name = 'DiagnosticSignInfo', text = diagnostics.Information },
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, sign in ipairs(signs) do
|
for _, sign in ipairs(signs) do
|
||||||
@ -208,7 +199,7 @@ return {
|
|||||||
return lspconfig.util.find_git_ancestor(fname)
|
return lspconfig.util.find_git_ancestor(fname)
|
||||||
end,
|
end,
|
||||||
single_file_support = true, -- suggested
|
single_file_support = true, -- suggested
|
||||||
on_attach = on_attach, -- on_attach is the on_attach function you defined
|
on_attach = on_attach, -- on_attach is the on_attach function you defined
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
lspconfig.neocmake.setup({})
|
lspconfig.neocmake.setup({})
|
||||||
@ -230,8 +221,7 @@ return {
|
|||||||
'--use-dirty-headers',
|
'--use-dirty-headers',
|
||||||
'--completion-style=detailed',
|
'--completion-style=detailed',
|
||||||
},
|
},
|
||||||
root_dir = lspconfig.util.root_pattern('.clangd', '.clang-tidy', '.clang-format', 'compile_flags.txt',
|
root_dir = lspconfig.util.root_pattern('.clangd', '.clang-tidy', '.clang-format', 'compile_flags.txt', 'configure.ac', '.git', 'build_nvim'),
|
||||||
'configure.ac', '.git', 'build_nvim'),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
require('clangd_extensions').setup({
|
require('clangd_extensions').setup({
|
||||||
@ -342,8 +332,7 @@ return {
|
|||||||
float = {
|
float = {
|
||||||
border = 'single',
|
border = 'single',
|
||||||
format = function(diagnostic)
|
format = function(diagnostic)
|
||||||
return string.format('%s (%s) [%s]', diagnostic.message, diagnostic.source,
|
return string.format('%s (%s) [%s]', diagnostic.message, diagnostic.source, diagnostic.code or diagnostic.user_data.lsp.code)
|
||||||
diagnostic.code or diagnostic.user_data.lsp.code)
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user