diff --git a/lua/astrocommunity/pack/python-basedpyright/README.md b/lua/astrocommunity/pack/python-basedpyright/README.md new file mode 100644 index 000000000..d9d050e69 --- /dev/null +++ b/lua/astrocommunity/pack/python-basedpyright/README.md @@ -0,0 +1,9 @@ +# Basedpyright Python Pack + +**Requirements:** `python` must be in your `PATH` and executable + +This plugin pack does the following: + +- Adds `basedpyright` language server + +**Note:** This pack does not include Python syntax highlighting or debugging. Use [Python Pack](../python) for that. diff --git a/lua/astrocommunity/pack/python-basedpyright/init.lua b/lua/astrocommunity/pack/python-basedpyright/init.lua new file mode 100644 index 000000000..c5d80c1b9 --- /dev/null +++ b/lua/astrocommunity/pack/python-basedpyright/init.lua @@ -0,0 +1,50 @@ +return { + { + "AstroNvim/astrolsp", + optional = true, + ---@type AstroLSPOpts + opts = { + ---@diagnostic disable: missing-fields + config = { + basedpyright = { + before_init = function(_, c) + if not c.settings then c.settings = {} end + if not c.settings.python then c.settings.python = {} end + c.settings.python.pythonPath = vim.fn.exepath "python" + end, + settings = { + basedpyright = { + analysis = { + typeCheckingMode = "basic", + autoImportCompletions = true, + diagnosticSeverityOverrides = { + reportUnusedImport = "information", + reportUnusedFunction = "information", + reportUnusedVariable = "information", + reportGeneralTypeIssues = "none", + reportOptionalMemberAccess = "none", + reportOptionalSubscript = "none", + reportPrivateImportUsage = "none", + }, + }, + }, + }, + }, + }, + }, + }, + { + "williamboman/mason-lspconfig.nvim", + optional = true, + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "basedpyright" }) + end, + }, + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + optional = true, + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "basedpyright" }) + end, + }, +} diff --git a/lua/astrocommunity/pack/python-black/README.md b/lua/astrocommunity/pack/python-black/README.md new file mode 100644 index 000000000..f37b0c2a0 --- /dev/null +++ b/lua/astrocommunity/pack/python-black/README.md @@ -0,0 +1,9 @@ +# Python Black Pack + +**Requirements:** `python` must be in your `PATH` and executable + +This plugin pack does the following: + +- Adds [black](https://pypi.org/project/black/) formatter + +**Note:** This pack does not include Python syntax highlighting or debugging. Use [Python Pack](../python) for that. diff --git a/lua/astrocommunity/pack/python-black/init.lua b/lua/astrocommunity/pack/python-black/init.lua new file mode 100644 index 000000000..532cbb1d0 --- /dev/null +++ b/lua/astrocommunity/pack/python-black/init.lua @@ -0,0 +1,25 @@ +return { + { + "jay-babu/mason-null-ls.nvim", + optional = true, + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "black" }) + end, + }, + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + optional = true, + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "black" }) + end, + }, + { + "stevearc/conform.nvim", + optional = true, + opts = function(_, opts) + if not opts.formatters_by_ft then opts.formatters_by_ft = {} end + if not opts.formatters_by_ft.python then opts.formatters_by_ft.python = {} end + table.insert(opts.formatters_by_ft.python, "black") + end, + }, +} diff --git a/lua/astrocommunity/pack/python-isort/README.md b/lua/astrocommunity/pack/python-isort/README.md new file mode 100644 index 000000000..a73eb7c58 --- /dev/null +++ b/lua/astrocommunity/pack/python-isort/README.md @@ -0,0 +1,9 @@ +# Python Isort Pack + +**Requirements:** `python` must be in your `PATH` and executable + +This plugin pack does the following: + +- Adds [isort](https://pypi.org/project/isort/) formatter + +**Note:** This pack does not include Python syntax highlighting or debugging. Use [Python Pack](../python) for that. diff --git a/lua/astrocommunity/pack/python-isort/init.lua b/lua/astrocommunity/pack/python-isort/init.lua new file mode 100644 index 000000000..74237b2ac --- /dev/null +++ b/lua/astrocommunity/pack/python-isort/init.lua @@ -0,0 +1,25 @@ +return { + { + "jay-babu/mason-null-ls.nvim", + optional = true, + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "isort" }) + end, + }, + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + optional = true, + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "isort" }) + end, + }, + { + "stevearc/conform.nvim", + optional = true, + opts = function(_, opts) + if not opts.formatters_by_ft then opts.formatters_by_ft = {} end + if not opts.formatters_by_ft.python then opts.formatters_by_ft.python = {} end + table.insert(opts.formatters_by_ft.python, 1, "isort") + end, + }, +} diff --git a/lua/astrocommunity/pack/python/README.md b/lua/astrocommunity/pack/python/README.md index 1e35ea996..d5d8a808c 100644 --- a/lua/astrocommunity/pack/python/README.md +++ b/lua/astrocommunity/pack/python/README.md @@ -5,8 +5,4 @@ This plugin pack does the following: - Adds `python` and `toml` Treesitter parsers -- Adds `basedpyright` language server -- Adds the following `null-ls` sources: - - [black](https://pypi.org/project/black/) - - [isort](https://pypi.org/project/isort/) - Adds `debugpy` for debugging diff --git a/lua/astrocommunity/pack/python/init.lua b/lua/astrocommunity/pack/python/init.lua index 5fbfa6e4f..3276e175b 100644 --- a/lua/astrocommunity/pack/python/init.lua +++ b/lua/astrocommunity/pack/python/init.lua @@ -1,38 +1,4 @@ return { - { - "AstroNvim/astrolsp", - optional = true, - ---@type AstroLSPOpts - opts = { - ---@diagnostic disable: missing-fields - config = { - basedpyright = { - before_init = function(_, c) - if not c.settings then c.settings = {} end - if not c.settings.python then c.settings.python = {} end - c.settings.python.pythonPath = vim.fn.exepath "python" - end, - settings = { - basedpyright = { - analysis = { - typeCheckingMode = "basic", - autoImportCompletions = true, - diagnosticSeverityOverrides = { - reportUnusedImport = "information", - reportUnusedFunction = "information", - reportUnusedVariable = "information", - reportGeneralTypeIssues = "none", - reportOptionalMemberAccess = "none", - reportOptionalSubscript = "none", - reportPrivateImportUsage = "none", - }, - }, - }, - }, - }, - }, - }, - }, { "nvim-treesitter/nvim-treesitter", optional = true, @@ -42,20 +8,6 @@ return { end end, }, - { - "williamboman/mason-lspconfig.nvim", - optional = true, - opts = function(_, opts) - opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "basedpyright" }) - end, - }, - { - "jay-babu/mason-null-ls.nvim", - optional = true, - opts = function(_, opts) - opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "black", "isort" }) - end, - }, { "jay-babu/mason-nvim-dap.nvim", optional = true, @@ -69,8 +21,7 @@ return { "WhoIsSethDaniel/mason-tool-installer.nvim", optional = true, opts = function(_, opts) - opts.ensure_installed = - require("astrocore").list_insert_unique(opts.ensure_installed, { "basedpyright", "black", "isort", "debugpy" }) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "debugpy" }) end, }, { @@ -116,13 +67,4 @@ return { table.insert(opts.adapters, require "neotest-python"(require("astrocore").plugin_opts "neotest-python")) end, }, - { - "stevearc/conform.nvim", - optional = true, - opts = { - formatters_by_ft = { - python = { "isort", "black" }, - }, - }, - }, }