3 "nvim-treesitter/nvim-treesitter",
4 opts = function(_, opts)
5 if type(opts.ensure_installed) == "table" then
6 vim.list_extend(opts.ensure_installed, { "ninja", "python", "rst", "toml" })
11 "neovim/nvim-lspconfig",
13 ---@type lspconfig.options
17 root_dir = function(fname)
18 return require("lspconfig.util").root_pattern("pyproject.toml", "setup.cfg", "ruff.toml")(fname)
24 vim.lsp.buf.code_action({
27 only = { "source.organizeImports" },
32 desc = "Organize Imports",
40 autopep8 = { enabled = false },
41 flake8 = { enabled = false },
42 mccabe = { enabled = false },
43 pycodestyle = { enabled = false },
44 pydocstyle = { enabled = false },
45 pyflakes = { enabled = false }, -- covered by flake8
53 require("lazyvim.util").lsp.on_attach(function(client, _)
54 if client.name == "ruff_lsp" then
55 -- Disable hover in favor of Pyright
56 client.server_capabilities.hoverProvider = false
64 "nvim-neotest/neotest",
66 "nvim-neotest/neotest-python",
70 ["neotest-python"] = {
71 dap = { justMyCode = false }},
76 "mfussenegger/nvim-dap",
78 "mfussenegger/nvim-dap-python",
81 { "<leader>dPt", function() require('dap-python').test_method() end, desc = "Debug Method", ft = "python" },
82 { "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" },
85 local path = require("mason-registry").get_package("debugpy"):get_install_path()
86 require("dap-python").setup(path .. "/venv/bin/python")
91 "linux-cultist/venv-selector.nvim",
93 opts = function(_, opts)
94 if require("lazyvim.util").has("nvim-dap-python") then
95 opts.dap_enabled = true
97 return vim.tbl_deep_extend("force", opts, {
106 keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },