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:
parent
4e2e35ed6a
commit
50382dcdb5
|
|
@ -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', {
|
vim.lsp.config('pyright', {
|
||||||
settings = {
|
settings = {
|
||||||
pyright = { disableOrganizeImports = true },
|
pyright = {
|
||||||
python = { analysis = { ignore = { '*' } } },
|
-- Using Ruff's import organizer
|
||||||
|
disableOrganizeImports = true,
|
||||||
|
},
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
-- Ignore all files for analysis to exclusively use Ruff for linting
|
||||||
|
ignore = { '*' },
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
'mason-org/mason-lspconfig.nvim',
|
||||||
'mason-org/mason-lspconfig.nvim',
|
opts = {
|
||||||
opts = {
|
ensure_installed = { 'clangd', 'gopls', 'pyright', 'ts_ls', 'ruff' },
|
||||||
ensure_installed = { 'clangd', 'gopls', 'pyright', 'ts_ls', 'ruff' },
|
automatic_enable = true,
|
||||||
automatic_enable = true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
vim.api.nvim_create_autocmd('User', {
|
vim.api.nvim_create_autocmd('User', {
|
||||||
pattern = 'VeryLazy', once = true,
|
pattern = 'VeryLazy',
|
||||||
|
once = true,
|
||||||
callback = function()
|
callback = function()
|
||||||
local mr = require 'mason-registry'
|
local mr = require 'mason-registry'
|
||||||
mr.refresh(function()
|
mr.refresh(function()
|
||||||
local p = mr.get_package 'codelldb'
|
local ok, p = pcall(mr.get_package, 'codelldb')
|
||||||
if not p:is_installed() then p:install() end
|
if ok and not p:is_installed() then p:install() end
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue