just formatting

This commit is contained in:
dlond 2025-05-20 20:42:31 +12:00
parent 8cff14c262
commit 32471236f8
3 changed files with 166 additions and 161 deletions

View File

@ -7,7 +7,7 @@ return {
-- ========================================
{
'neovim/nvim-lspconfig',
event = { "BufReadPre", "BufNewFile" }, -- Load LSP config early
event = { 'BufReadPre', 'BufNewFile' }, -- Load LSP config early
dependencies = {
-- Dependencies for nvim-lspconfig itself, if any.
-- 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.
-- These servers must be installed via Nix/Home Manager and be in your PATH.
local servers_to_setup = {
"lua_ls",
"clangd",
"pyright",
"nixd",
"ruff",
'lua_ls',
'clangd',
'pyright',
'nixd',
'ruff',
-- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc.
-- Ensure the corresponding packages (e.g., pkgs.bash-language-server)
-- are in your Home Manager home.packages list.
@ -75,27 +75,29 @@ return {
end
end
if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override',
{ clear = false })
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' },
{ 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('LspDetach',
{
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false })
vim.api.nvim_create_autocmd(
{ 'CursorHold', 'CursorHoldI' },
{ 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('LspDetach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }),
callback = function(
event2)
vim.lsp.buf.clear_references(); vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf }
end
callback = function(event2)
vim.lsp.buf.clear_references()
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf }
end,
})
end
-- Inlay hints toggle
if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then
map('<leader>th',
function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end,
'[T]oggle Inlay [H]ints')
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
end, '[T]oggle Inlay [H]ints')
end
end,
})
@ -107,18 +109,21 @@ return {
underline = { severity = vim.diagnostic.severity.ERROR },
signs = vim.g.have_nerd_font and {
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 {},
virtual_text = {
source = 'if_many', spacing = 2,
source = 'if_many',
spacing = 2,
format = function(diagnostic)
local diagnostic_message = {
[vim.diagnostic.severity.ERROR] = diagnostic.message,
[vim.diagnostic.severity.WARN] = diagnostic.message,
[vim.diagnostic.severity.INFO] =
diagnostic.message,
[vim.diagnostic.severity.HINT] = diagnostic.message
[vim.diagnostic.severity.INFO] = diagnostic.message,
[vim.diagnostic.severity.HINT] = diagnostic.message,
}
return diagnostic_message[diagnostic.severity]
end,