Skip to content

Commit f94330e

Browse files
committed
chore: fix python in nvim
1 parent d087be0 commit f94330e

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

config/nvim/lua/lsp.lua

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ require("mason").setup({
1313
require("mason-lspconfig").setup({
1414
ensure_installed = {
1515
"ruff",
16-
"pyright",
16+
"ruff-lsp",
1717
"lua_ls",
1818
"rust_analyzer",
1919
"ts_ls",
2020
"gopls",
2121
"terraformls",
2222
"tflint",
23+
"basedpyright",
24+
"pylsp",
2325
},
2426
})
2527

@@ -108,21 +110,19 @@ vim.lsp.config.ruff = {
108110
}
109111
vim.lsp.enable("ruff")
110112

111-
-- Pyright for go-to-definition, hover, type checking
112-
vim.lsp.config.pyright = {
113-
cmd = { "pyright-langserver", "--stdio" },
113+
vim.lsp.config.basedpyright = {
114+
cmd = { "basedpyright-langserver", "--stdio" },
114115
filetypes = { "python" },
115-
root_markers = {
116-
"pyrightconfig.json",
117-
"pyproject.toml",
118-
"setup.py",
119-
".git",
120-
},
116+
root_markers = { "pyrightconfig.json", "pyproject.toml", "setup.py", ".git" },
121117
capabilities = capabilities,
122118
on_attach = on_attach,
123119
settings = {
124-
pyright = {
125-
disableOrganizeImports = true, -- Let ruff handle this
120+
basedpyright = {
121+
analysis = {
122+
typeCheckingMode = "basic", -- or "off" if still too noisy
123+
diagnosticMode = "openFilesOnly",
124+
useLibraryCodeForTypes = true,
125+
},
126126
},
127127
python = {
128128
analysis = {
@@ -133,8 +133,16 @@ vim.lsp.config.pyright = {
133133
},
134134
},
135135
}
136-
vim.lsp.enable("pyright")
137-
136+
vim.lsp.enable("basedpyright")
137+
vim.lsp.config.pylsp = {
138+
cmd = { "pylsp" },
139+
filetypes = { "python" },
140+
root_markers = { "pyproject.toml", ".git" },
141+
capabilities = capabilities,
142+
on_attach = on_attach,
143+
settings = {},
144+
}
145+
vim.lsp.enable("pylsp")
138146
-- TypeScript/JavaScript
139147
vim.lsp.config.ts_ls = {
140148
cmd = { "typescript-language-server", "--stdio" },

0 commit comments

Comments
 (0)