split the lsp config
This commit is contained in:
parent
0f3ae65892
commit
4978435b1f
@ -1,85 +1,4 @@
|
||||
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
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
on_attach = function(client, bufnr)
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
@ -95,6 +14,8 @@ return {
|
||||
{ noremap = true, silent = false, desc = 'Diag next', buffer = bufnr })
|
||||
vim.keymap.set('n', '<space>a', vim.lsp.buf.code_action,
|
||||
{ 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,
|
||||
{ noremap = true, silent = false, desc = 'Definition', buffer = bufnr })
|
||||
vim.keymap.set('n', '<space>e', vim.lsp.buf.declaration,
|
||||
@ -179,8 +100,90 @@ return {
|
||||
},
|
||||
hi_parameter = 'IncSearch',
|
||||
}, bufnr)
|
||||
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 {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
|
Loading…
x
Reference in New Issue
Block a user