split the lsp config
This commit is contained in:
parent
0f3ae65892
commit
4978435b1f
@ -1,85 +1,4 @@
|
|||||||
return {
|
on_attach = function(client, bufnr)
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
dependencies = {
|
|
||||||
'williamboman/mason.nvim',
|
|
||||||
'williamboman/mason-lspconfig.nvim',
|
|
||||||
'p00f/clangd_extensions.nvim',
|
|
||||||
'jose-elias-alvarez/null-ls.nvim',
|
|
||||||
'ray-x/lsp_signature.nvim',
|
|
||||||
{
|
|
||||||
'folke/neodev.nvim',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require('neodev').setup({
|
|
||||||
})
|
|
||||||
require('mason').setup({
|
|
||||||
ui = {
|
|
||||||
border = 'rounded'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
require('mason-lspconfig').setup({
|
|
||||||
automatic_installation = false,
|
|
||||||
})
|
|
||||||
local lspconfig = require('lspconfig')
|
|
||||||
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(
|
|
||||||
0,
|
|
||||||
'LspReferenceText',
|
|
||||||
{
|
|
||||||
bold = true,
|
|
||||||
ctermbg = 'red',
|
|
||||||
bg = '#5a524c'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
vim.api.nvim_set_hl(
|
|
||||||
0,
|
|
||||||
'LspReferenceRead',
|
|
||||||
{
|
|
||||||
bold = true,
|
|
||||||
ctermbg = 'red',
|
|
||||||
bg = 'DarkGreen'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
vim.api.nvim_set_hl(
|
|
||||||
0,
|
|
||||||
'LspReferenceWrite',
|
|
||||||
{
|
|
||||||
bold = true,
|
|
||||||
ctermbg = 'red',
|
|
||||||
bg = 'DarkRed'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
local diagnostics = {
|
|
||||||
Error = ' ',
|
|
||||||
Warning = ' ',
|
|
||||||
Information = ' ',
|
|
||||||
Question = ' ',
|
|
||||||
Hint = ' ',
|
|
||||||
}
|
|
||||||
local signs = {
|
|
||||||
{ name = 'DiagnosticSignError', text = diagnostics.Error },
|
|
||||||
{ name = 'DiagnosticSignWarn', text = diagnostics.Warning },
|
|
||||||
{ name = 'DiagnosticSignHint', text = diagnostics.Hint },
|
|
||||||
{ name = 'DiagnosticSignInfo', text = diagnostics.Information },
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, sign in ipairs(signs) do
|
|
||||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
|
|
||||||
end
|
|
||||||
|
|
||||||
OpenDiagFloat = function()
|
|
||||||
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
|
|
||||||
if vim.api.nvim_win_get_config(winid).zindex then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
vim.diagnostic.open_float({ focusable = false, width = 80 })
|
|
||||||
end
|
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
local function buf_set_option(...)
|
local function buf_set_option(...)
|
||||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||||
end
|
end
|
||||||
@ -95,6 +14,8 @@ return {
|
|||||||
{ noremap = true, silent = false, desc = 'Diag next', buffer = bufnr })
|
{ noremap = true, silent = false, desc = 'Diag next', buffer = bufnr })
|
||||||
vim.keymap.set('n', '<space>a', vim.lsp.buf.code_action,
|
vim.keymap.set('n', '<space>a', vim.lsp.buf.code_action,
|
||||||
{ noremap = true, silent = false, desc = 'Code action', buffer = bufnr })
|
{ noremap = true, silent = false, desc = 'Code action', buffer = bufnr })
|
||||||
|
vim.keymap.set('x', '<space>a', vim.lsp.buf.range_code_action,
|
||||||
|
{ noremap = true, silent = false, desc = 'Code action', buffer = bufnr })
|
||||||
vim.keymap.set('n', '<space>d', tele_builtins.lsp_definitions,
|
vim.keymap.set('n', '<space>d', tele_builtins.lsp_definitions,
|
||||||
{ noremap = true, silent = false, desc = 'Definition', buffer = bufnr })
|
{ noremap = true, silent = false, desc = 'Definition', buffer = bufnr })
|
||||||
vim.keymap.set('n', '<space>e', vim.lsp.buf.declaration,
|
vim.keymap.set('n', '<space>e', vim.lsp.buf.declaration,
|
||||||
@ -181,6 +102,88 @@ return {
|
|||||||
}, bufnr)
|
}, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
dependencies = {
|
||||||
|
'williamboman/mason.nvim',
|
||||||
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
'p00f/clangd_extensions.nvim',
|
||||||
|
'jose-elias-alvarez/null-ls.nvim',
|
||||||
|
'ray-x/lsp_signature.nvim',
|
||||||
|
{
|
||||||
|
'folke/neodev.nvim',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('neodev').setup({
|
||||||
|
})
|
||||||
|
require('mason').setup({
|
||||||
|
ui = {
|
||||||
|
border = 'rounded'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
require('mason-lspconfig').setup({
|
||||||
|
automatic_installation = false,
|
||||||
|
})
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
|
vim.api.nvim_set_hl(
|
||||||
|
0,
|
||||||
|
'LspReferenceText',
|
||||||
|
{
|
||||||
|
bold = true,
|
||||||
|
ctermbg = 'red',
|
||||||
|
bg = '#5a524c'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
vim.api.nvim_set_hl(
|
||||||
|
0,
|
||||||
|
'LspReferenceRead',
|
||||||
|
{
|
||||||
|
bold = true,
|
||||||
|
ctermbg = 'red',
|
||||||
|
bg = 'DarkGreen'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
vim.api.nvim_set_hl(
|
||||||
|
0,
|
||||||
|
'LspReferenceWrite',
|
||||||
|
{
|
||||||
|
bold = true,
|
||||||
|
ctermbg = 'red',
|
||||||
|
bg = 'DarkRed'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
local diagnostics = {
|
||||||
|
Error = ' ',
|
||||||
|
Warning = ' ',
|
||||||
|
Information = ' ',
|
||||||
|
Question = ' ',
|
||||||
|
Hint = ' ',
|
||||||
|
}
|
||||||
|
local signs = {
|
||||||
|
{ name = 'DiagnosticSignError', text = diagnostics.Error },
|
||||||
|
{ name = 'DiagnosticSignWarn', text = diagnostics.Warning },
|
||||||
|
{ name = 'DiagnosticSignHint', text = diagnostics.Hint },
|
||||||
|
{ name = 'DiagnosticSignInfo', text = diagnostics.Information },
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, sign in ipairs(signs) do
|
||||||
|
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
|
||||||
|
end
|
||||||
|
|
||||||
|
OpenDiagFloat = function()
|
||||||
|
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||||
|
if vim.api.nvim_win_get_config(winid).zindex then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.diagnostic.open_float({ focusable = false, width = 80 })
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
lspconfig['pyright'].setup {
|
lspconfig['pyright'].setup {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user