just formatting
This commit is contained in:
parent
8cff14c262
commit
32471236f8
|
@ -7,7 +7,7 @@ return {
|
||||||
-- ========================================
|
-- ========================================
|
||||||
{
|
{
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
event = { "BufReadPre", "BufNewFile" }, -- Load LSP config early
|
event = { 'BufReadPre', 'BufNewFile' }, -- Load LSP config early
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Dependencies for nvim-lspconfig itself, if any.
|
-- Dependencies for nvim-lspconfig itself, if any.
|
||||||
-- Mason and mason-lspconfig are removed as Nix handles LSP installation.
|
-- Mason and mason-lspconfig are removed as Nix handles LSP installation.
|
||||||
|
@ -24,11 +24,11 @@ return {
|
||||||
-- Define the list of LSP servers you want to configure.
|
-- Define the list of LSP servers you want to configure.
|
||||||
-- These servers must be installed via Nix/Home Manager and be in your PATH.
|
-- These servers must be installed via Nix/Home Manager and be in your PATH.
|
||||||
local servers_to_setup = {
|
local servers_to_setup = {
|
||||||
"lua_ls",
|
'lua_ls',
|
||||||
"clangd",
|
'clangd',
|
||||||
"pyright",
|
'pyright',
|
||||||
"nixd",
|
'nixd',
|
||||||
"ruff",
|
'ruff',
|
||||||
-- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc.
|
-- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc.
|
||||||
-- Ensure the corresponding packages (e.g., pkgs.bash-language-server)
|
-- Ensure the corresponding packages (e.g., pkgs.bash-language-server)
|
||||||
-- are in your Home Manager home.packages list.
|
-- are in your Home Manager home.packages list.
|
||||||
|
@ -75,27 +75,29 @@ return {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then
|
if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then
|
||||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override',
|
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false })
|
||||||
{ clear = false })
|
vim.api.nvim_create_autocmd(
|
||||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' },
|
{ 'CursorHold', 'CursorHoldI' },
|
||||||
{ buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight })
|
{ buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight }
|
||||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' },
|
)
|
||||||
{ buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references })
|
vim.api.nvim_create_autocmd(
|
||||||
vim.api.nvim_create_autocmd('LspDetach',
|
{ 'CursorMoved', 'CursorMovedI' },
|
||||||
{
|
{ buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references }
|
||||||
|
)
|
||||||
|
vim.api.nvim_create_autocmd('LspDetach', {
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }),
|
group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }),
|
||||||
callback = function(
|
callback = function(event2)
|
||||||
event2)
|
vim.lsp.buf.clear_references()
|
||||||
vim.lsp.buf.clear_references(); vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf }
|
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf }
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Inlay hints toggle
|
-- Inlay hints toggle
|
||||||
if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then
|
if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then
|
||||||
map('<leader>th',
|
map('<leader>th', function()
|
||||||
function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end,
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||||
'[T]oggle Inlay [H]ints')
|
end, '[T]oggle Inlay [H]ints')
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -107,18 +109,21 @@ return {
|
||||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||||
signs = vim.g.have_nerd_font and {
|
signs = vim.g.have_nerd_font and {
|
||||||
text = {
|
text = {
|
||||||
[vim.diagnostic.severity.ERROR] = ' ', [vim.diagnostic.severity.WARN] = ' ', [vim.diagnostic.severity.INFO] = ' ', [vim.diagnostic.severity.HINT] = ' ',
|
[vim.diagnostic.severity.ERROR] = ' ',
|
||||||
|
[vim.diagnostic.severity.WARN] = ' ',
|
||||||
|
[vim.diagnostic.severity.INFO] = ' ',
|
||||||
|
[vim.diagnostic.severity.HINT] = ' ',
|
||||||
},
|
},
|
||||||
} or {},
|
} or {},
|
||||||
virtual_text = {
|
virtual_text = {
|
||||||
source = 'if_many', spacing = 2,
|
source = 'if_many',
|
||||||
|
spacing = 2,
|
||||||
format = function(diagnostic)
|
format = function(diagnostic)
|
||||||
local diagnostic_message = {
|
local diagnostic_message = {
|
||||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||||
[vim.diagnostic.severity.INFO] =
|
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||||
diagnostic.message,
|
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||||
[vim.diagnostic.severity.HINT] = diagnostic.message
|
|
||||||
}
|
}
|
||||||
return diagnostic_message[diagnostic.severity]
|
return diagnostic_message[diagnostic.severity]
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in New Issue