return {
- {
- "nvim-treesitter/nvim-treesitter",
- opts = function(_, opts)
- if type(opts.ensure_installed) == "table" then
- vim.list_extend(opts.ensure_installed, { "ninja", "python", "rst", "toml" })
- end
- end,
+ { "nvim-treesitter/nvim-treesitter",
+ opts = { ensure_installed = { "ninja", "rst" } },
},
- {
- "neovim/nvim-lspconfig",
+ { "neovim/nvim-lspconfig",
opts = {
- ---@type lspconfig.options
servers = {
- pyright = {},
- ruff_lsp = {
- root_dir = function(fname)
- return require("lspconfig.util").root_pattern("pyproject.toml", "setup.cfg", "ruff.toml")(fname)
- end,
+ ruff = {
+ cmd_env = { RUFF_TRACE = "messages" },
+ init_options = {
+ settings = {
+ logLevel = "error",
+ },
+ },
keys = {
{
"<leader>co",
- function()
- vim.lsp.buf.code_action({
- apply = true,
- context = {
- only = { "source.organizeImports" },
- diagnostics = {},
- },
- })
- end,
+ rmz.lsp.action["source.organizeImports"],
desc = "Organize Imports",
},
},
},
- pylsp = {
- settings = {
- pylsp = {
- plugins = {
- autopep8 = { enabled = false },
- flake8 = { enabled = false },
- mccabe = { enabled = false },
- pycodestyle = { enabled = false },
- pydocstyle = { enabled = false },
- pyflakes = { enabled = false }, -- covered by flake8
- }
- }
- }
- }
},
setup = {
- ruff_lsp = function()
- require("lazyvim.util").lsp.on_attach(function(client, _)
- if client.name == "ruff_lsp" then
- -- Disable hover in favor of Pyright
- client.server_capabilities.hoverProvider = false
- end
- end)
+ ["ruff"] = function()
+ rmz.lsp.on_attach(function(client, _)
+ -- Disable hover in favor of Pyright
+ client.server_capabilities.hoverProvider = false
+ end, "ruff")
end,
},
},
},
opts = {
adapters = {
- ["neotest-python"] = { },
+ ["neotest-python"] = {
+ dap = { justMyCode = false }},
},
},
},
"mfussenegger/nvim-dap",
dependencies = {
"mfussenegger/nvim-dap-python",
- -- stylua: ignore
keys = {
{ "<leader>dPt", function() require('dap-python').test_method() end, desc = "Debug Method", ft = "python" },
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" },
end,
},
},
- {
- "linux-cultist/venv-selector.nvim",
+ { "jay-babu/mason-nvim-dap.nvim",
+ opts = {
+ handlers = {
+ python = function() end,
+ },
+ ensure_installed = { "python" },
+ },
+ },
+ { "linux-cultist/venv-selector.nvim", enabled = false,
+ -- TODO needs fd to be installed (I don't know what that is)
+ branch = "regexp", -- Use this branch for the new version
cmd = "VenvSelect",
- opts = function(_, opts)
- if require("lazyvim.util").has("nvim-dap-python") then
- opts.dap_enabled = true
- end
- return vim.tbl_deep_extend("force", opts, {
- name = {
- "venv",
- ".venv",
- "env",
- ".env",
+ opts = {
+ settings = {
+ options = {
+ notify_user_on_venv_activation = true,
},
- })
+ },
+ },
+ -- Call config for python files and load the cached venv automatically
+ ft = "python",
+ keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv", ft = "python" } },
+ },
+ { "hrsh7th/nvim-cmp",
+ optional = true,
+ opts = function(_, opts)
+ opts.auto_brackets = opts.auto_brackets or {}
+ table.insert(opts.auto_brackets, "python")
end,
- keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
},
}