Skip to content

Commit 50382dc

Browse files
committed
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)
1 parent 4e2e35e commit 50382dc

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

lua/custom/plugins/lsp.lua

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1+
-- Pyright settings merge via vim.lsp.config deep-merge; mason-lspconfig's
2+
-- automatic_enable fires vim.lsp.enable() for each ensure_installed server.
13
vim.lsp.config('pyright', {
24
settings = {
3-
pyright = { disableOrganizeImports = true },
4-
python = { analysis = { ignore = { '*' } } },
5+
pyright = {
6+
-- Using Ruff's import organizer
7+
disableOrganizeImports = true,
8+
},
9+
python = {
10+
analysis = {
11+
-- Ignore all files for analysis to exclusively use Ruff for linting
12+
ignore = { '*' },
13+
},
14+
},
515
},
616
})
717

818
return {
9-
{
10-
'mason-org/mason-lspconfig.nvim',
11-
opts = {
12-
ensure_installed = { 'clangd', 'gopls', 'pyright', 'ts_ls', 'ruff' },
13-
automatic_enable = true,
14-
},
19+
'mason-org/mason-lspconfig.nvim',
20+
opts = {
21+
ensure_installed = { 'clangd', 'gopls', 'pyright', 'ts_ls', 'ruff' },
22+
automatic_enable = true,
1523
},
1624
}

lua/custom/plugins/mason-extras.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
vim.api.nvim_create_autocmd('User', {
2-
pattern = 'VeryLazy', once = true,
2+
pattern = 'VeryLazy',
3+
once = true,
34
callback = function()
45
local mr = require 'mason-registry'
56
mr.refresh(function()
6-
local p = mr.get_package 'codelldb'
7-
if not p:is_installed() then p:install() end
7+
local ok, p = pcall(mr.get_package, 'codelldb')
8+
if ok and not p:is_installed() then p:install() end
89
end)
910
end,
1011
})

0 commit comments

Comments
 (0)