refactor: polish lsp.lua and mason-extras.lua

- Restore pyright inline comments explaining Ruff delegation
- Add header comment documenting mason-lspconfig/vim.lsp.config coupling
- Unwrap lsp.lua outer spec table (consistency with blink-cmp.lua, conform.lua)
- pcall mason-registry.get_package (defensive against unknown package name)
- Split inline autocmd opts across lines (style)
This commit is contained in:
Brian Henderson 2026-04-14 22:50:00 +02:00
parent 4e2e35ed6a
commit 50382dcdb5
No known key found for this signature in database
2 changed files with 20 additions and 11 deletions

View File

@ -1,16 +1,24 @@
-- Pyright settings merge via vim.lsp.config deep-merge; mason-lspconfig's
-- automatic_enable fires vim.lsp.enable() for each ensure_installed server.
vim.lsp.config('pyright', {
settings = {
pyright = { disableOrganizeImports = true },
python = { analysis = { ignore = { '*' } } },
pyright = {
-- Using Ruff's import organizer
disableOrganizeImports = true,
},
python = {
analysis = {
-- Ignore all files for analysis to exclusively use Ruff for linting
ignore = { '*' },
},
},
},
})
return {
{
'mason-org/mason-lspconfig.nvim',
opts = {
ensure_installed = { 'clangd', 'gopls', 'pyright', 'ts_ls', 'ruff' },
automatic_enable = true,
},
'mason-org/mason-lspconfig.nvim',
opts = {
ensure_installed = { 'clangd', 'gopls', 'pyright', 'ts_ls', 'ruff' },
automatic_enable = true,
},
}

View File

@ -1,10 +1,11 @@
vim.api.nvim_create_autocmd('User', {
pattern = 'VeryLazy', once = true,
pattern = 'VeryLazy',
once = true,
callback = function()
local mr = require 'mason-registry'
mr.refresh(function()
local p = mr.get_package 'codelldb'
if not p:is_installed() then p:install() end
local ok, p = pcall(mr.get_package, 'codelldb')
if ok and not p:is_installed() then p:install() end
end)
end,
})