better linting with basedpyright
This commit is contained in:
parent
81a7e5a123
commit
e5ed78d82d
2 changed files with 55 additions and 6 deletions
37
init.lua
37
init.lua
|
|
@ -68,12 +68,8 @@ vim.keymap.set("n", "<leader>f", ":lua vim.lsp.buf.format()<CR>")
|
|||
|
||||
-- diagnostics
|
||||
vim.keymap.set("n", "<leader>ds", ":lua vim.diagnostic.open_float()<CR>")
|
||||
vim.keymap.set("n", "<leader>dn", function()
|
||||
vim.diagnostic.jump({ count = 1 })
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>dp", function()
|
||||
vim.diagnostic.jump({ count = -1 })
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>dn", function() vim.diagnostic.jump({ count = 1 }) end)
|
||||
vim.keymap.set("n", "<leader>dp", function() vim.diagnostic.jump({ count = -1 }) end)
|
||||
|
||||
-- VIM PACKS
|
||||
vim.pack.add({
|
||||
|
|
@ -117,6 +113,11 @@ vim.pack.add({
|
|||
{ src = "https://github.com/nvim-lua/plenary.nvim" },
|
||||
{ src = "https://github.com/nvim-telescope/telescope.nvim" },
|
||||
|
||||
-- venv-selector
|
||||
{ src = "https://github.com/mfussenegger/nvim-dap" },
|
||||
{ src = "https://github.com/mfussenegger/nvim-dap-python" },
|
||||
{ src = "https://github.com/linux-cultist/venv-selector.nvim" },
|
||||
|
||||
-- dashboard
|
||||
{ src = "https://github.com/nvimdev/dashboard-nvim" },
|
||||
})
|
||||
|
|
@ -128,6 +129,19 @@ vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Telescope live gr
|
|||
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Telescope buffers" })
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Telescope help tags" })
|
||||
|
||||
require("dap-python").setup("python3")
|
||||
require("venv-selector").setup({
|
||||
-- Optional: Customize search paths for virtual environments
|
||||
search = {
|
||||
-- Example: Add a custom search path
|
||||
-- { path = "~/my_projects/venvs", depth = 1 },
|
||||
},
|
||||
-- Optional: Customize plugin options
|
||||
options = {
|
||||
-- Example: Set a default picker (e.g., "telescope")
|
||||
-- picker = "telescope",
|
||||
},
|
||||
})
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {},
|
||||
modules = {},
|
||||
|
|
@ -220,6 +234,7 @@ require("mason").setup()
|
|||
require("mason-lspconfig").setup()
|
||||
require("mason-tool-installer").setup({
|
||||
ensure_installed = {
|
||||
"basedpyright",
|
||||
"biome",
|
||||
"djlint",
|
||||
"emmet-language-server",
|
||||
|
|
@ -299,3 +314,13 @@ require("dashboard").setup({
|
|||
},
|
||||
})
|
||||
|
||||
local enable_providers = {
|
||||
"python3_provider",
|
||||
}
|
||||
|
||||
for _, plugin in pairs(enable_providers) do
|
||||
vim.g["loaded_" .. plugin] = nil
|
||||
vim.cmd("runtime " .. plugin)
|
||||
end
|
||||
|
||||
vim.g.loaded_python3_provider = nil
|
||||
|
|
|
|||
|
|
@ -10,3 +10,27 @@ vim.lsp.config("pylsp", {
|
|||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config('basedpyright', {
|
||||
cmd = { 'basedpyright-langserver', '--stdio' },
|
||||
filetypes = { 'python' },
|
||||
root_markers = {
|
||||
'pyproject.toml',
|
||||
'setup.py',
|
||||
'setup.cfg',
|
||||
'requirements.txt',
|
||||
'Pipfile',
|
||||
'pyrightconfig.json',
|
||||
'.git',
|
||||
},
|
||||
settings = {
|
||||
basedpyright = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = 'openFilesOnly',
|
||||
typeCheckingMode = 'basic',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue