diff --git a/lua/astrocommunity/pack/python-ruff/README.md b/lua/astrocommunity/pack/python-ruff/README.md new file mode 100644 index 000000000..7f2e86b28 --- /dev/null +++ b/lua/astrocommunity/pack/python-ruff/README.md @@ -0,0 +1,11 @@ +# Python Ruff Language Pack + +**Requirements:** `python` must be in your `PATH` and executable + +This plugin pack does the following: + +- Adds `python` and `toml` Treesitter parsers +- Adds `pyright` and `ruff_lsp` language servers +- Adds the following `null-ls` sources: + - [ruff](https://pypi.org/project/ruff/) +- Adds `debugpy` for debugging diff --git a/lua/astrocommunity/pack/python-ruff/init.lua b/lua/astrocommunity/pack/python-ruff/init.lua new file mode 100644 index 000000000..24e32fbde --- /dev/null +++ b/lua/astrocommunity/pack/python-ruff/init.lua @@ -0,0 +1,43 @@ +local utils = require "astronvim.utils" +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "python", "toml" }) + end + end, + }, + { + "williamboman/mason-lspconfig.nvim", + opts = function(_, opts) + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "pyright", "ruff_lsp" }) + end, + }, + { + "jay-babu/mason-null-ls.nvim", + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "ruff" }) end, + }, + { + "jay-babu/mason-nvim-dap.nvim", + opts = function(_, opts) + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "python") + if not opts.handlers then opts.handlers = {} end + opts.handlers.python = function() end -- make sure python doesn't get set up by mason-nvim-dap, it's being set up by nvim-dap-python + end, + }, + { + "linux-cultist/venv-selector.nvim", + opts = {}, + keys = { { "lv", ":VenvSelect", desc = "Select VirtualEnv" } }, + }, + { + "mfussenegger/nvim-dap-python", + dependencies = "mfussenegger/nvim-dap", + ft = "python", -- NOTE: ft: lazy-load on filetype + config = function(_, opts) + local path = require("mason-registry").get_package("debugpy"):get_install_path() .. "/venv/bin/python" + require("dap-python").setup(path, opts) + end, + }, +} diff --git a/lua/astrocommunity/pack/python/README.md b/lua/astrocommunity/pack/python/README.md index 15febec03..9d9a4b0d2 100644 --- a/lua/astrocommunity/pack/python/README.md +++ b/lua/astrocommunity/pack/python/README.md @@ -5,7 +5,7 @@ This plugin pack does the following: - Adds `python` and `toml` Treesitter parsers -- Adds `pyright` and `ruff_lsp` language servers +- Adds `pyright` language servers - Adds the following `null-ls` sources: - [black](https://pypi.org/project/black/) - [isort](https://pypi.org/project/isort/) diff --git a/lua/astrocommunity/pack/python/init.lua b/lua/astrocommunity/pack/python/init.lua index 23810cfe6..1323e5f50 100644 --- a/lua/astrocommunity/pack/python/init.lua +++ b/lua/astrocommunity/pack/python/init.lua @@ -10,9 +10,7 @@ return { }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "pyright", "ruff_lsp" }) - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "pyright" }) end, }, { "jay-babu/mason-null-ls.nvim",