diff --git a/lazy-lock.json b/lazy-lock.json index f5652fc..3332898 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -28,9 +28,7 @@ "mini.indentscope": { "branch": "main", "commit": "f0d7faa064c892b96997810afcddfadc3f2a15b3" }, "neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" }, "neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" }, - "neotest-golang": { "branch": "main", "commit": "7d0c75265cbd4567f4a41795c263913c354c7a91" }, - "neotest-plenary": { "branch": "master", "commit": "dcaf5ed67a9e28a246e9783319e5aa6c9ea1c584" }, - "neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" }, + "neotest-python": { "branch": "master", "commit": "2e83d2bc00acbcc1fd529dbf0a0e677cabfe6b50" }, "noice.nvim": { "branch": "main", "commit": "8f1d9966762e62fa8788e5fb1a5f6a86784221d9" }, "none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" }, "none-ls.nvim": { "branch": "main", "commit": "f1b438ab1709cf9d8875843559d20265013ac755" }, @@ -39,7 +37,7 @@ "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-dap": { "branch": "master", "commit": "5ba8ceace596360321cf33fa4b56d9d46e057ce9" }, - "nvim-dap-go": { "branch": "main", "commit": "a0c5a2b991d7e9304a9a032cf177e22a4b0acda1" }, + "nvim-dap-python": { "branch": "master", "commit": "ae0225d0d4a46e18e6057ab3701ef87bbbd6aaad" }, "nvim-dap-ui": { "branch": "master", "commit": "f7d75cca202b52a60c520ec7b1ec3414d6e77b0f" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "d7c695ea39542f6da94ee4d66176f5d660ab0a77" }, "nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" }, diff --git a/lua/custom/default.lua b/lua/custom/default.lua index fbc341d..19ef7e5 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -148,12 +148,8 @@ pcode.rest_client = true -- https://github.com/mfussenegger/nvim-dap pcode.nvim_dap = false -- not support for windows os (auto config mason-nvim-dap) -pcode.nvim_dap_python = false - --- https://github.com/nvim-neotest/neotest-python --- https://docs.pytest.org/en/7.1.x/getting-started.html -pcode.pytest = false +-- conefig special support test & dap pcode.active_rust_config = false pcode.active_javascript_config = { status = false, @@ -161,4 +157,5 @@ pcode.active_javascript_config = { jest_config = "jest.config.mjs", } pcode.active_php_config = false -pcode.active_golang_config = true +pcode.active_golang_config = false +pcode.active_python_config = true diff --git a/lua/plugins/coderunner.lua b/lua/plugins/coderunner.lua index f079ef9..785d31a 100644 --- a/lua/plugins/coderunner.lua +++ b/lua/plugins/coderunner.lua @@ -2,7 +2,7 @@ -- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt" local rfile = { java = "cd $dir && javac $fileName && java $fileNameWithoutExt", - python = "python3 -u", + python = "python -u", typescript = "ts-node $dir/$fileName", rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt", cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", diff --git a/lua/plugins/dap_py.lua b/lua/plugins/python.lua similarity index 55% rename from lua/plugins/dap_py.lua rename to lua/plugins/python.lua index d8c9986..ec51088 100644 --- a/lua/plugins/dap_py.lua +++ b/lua/plugins/python.lua @@ -1,5 +1,5 @@ local M = {} -if pcode.nvim_dap_python then +if pcode.active_python_config then M = { { "mfussenegger/nvim-dap", @@ -51,6 +51,45 @@ if pcode.nvim_dap_python then { "dU", "lua require'dapui'.toggle({reset = true})", desc = "Toggle UI" }, }, }, + -- https://github.com/nvim-neotest/neotest-python + -- https://docs.pytest.org/en/7.1.x/getting-started.html + { + "nvim-neotest/neotest", + dependencies = { + "mfussenegger/nvim-dap-python", + "antoinemadec/FixCursorHold.nvim", + "nvim-neotest/nvim-nio", + "nvim-neotest/neotest-python", + }, + config = function() + local mason_path = vim.fn.glob(vim.fn.stdpath("data") .. "/mason/") + pcall(function() + require("dap-python").setup(mason_path .. "packages/debugpy/venv/bin/python") + end) + require("neotest").setup({ + adapters = { + require("neotest-python")({ + dap = { justMyCode = false }, + args = { "--log-level", "DEBUG" }, + runner = "pytest", + python = "python", + }), + }, + }) + end, + -- stylua: ignore + keys = { + { "T","",desc="  Test"}, + { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, + { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, + { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, + { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, + { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, + { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, + { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, + { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, + }, + }, } end return M diff --git a/lua/plugins/test_py.lua b/lua/plugins/test_py.lua deleted file mode 100644 index 03bafe4..0000000 --- a/lua/plugins/test_py.lua +++ /dev/null @@ -1,42 +0,0 @@ -local M = {} -if pcode.pytest then - M = { - "nvim-neotest/neotest", - dependencies = { - "mfussenegger/nvim-dap-python", - "antoinemadec/FixCursorHold.nvim", - "nvim-neotest/nvim-nio", - "nvim-neotest/neotest-python", - }, - config = function() - local mason_path = vim.fn.glob(vim.fn.stdpath("data") .. "/mason/") - pcall(function() - require("dap-python").setup(mason_path .. "packages/debugpy/venv/bin/python") - end) - require("neotest").setup({ - adapters = { - require("neotest-python")({ - dap = { justMyCode = false }, - args = { "--log-level", "DEBUG" }, - runner = "pytest", - python = "python", - }), - }, - }) - end, - -- stylua: ignore - keys = { - { "T","",desc="  Test"}, - { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, - { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, - { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, - { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, - { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, - { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, - { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, - { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, - }, - } -end - -return M diff --git a/lua/plugins/themes/_globalvar.lua b/lua/plugins/themes/_globalvar.lua index 7b47687..0297f2c 100644 --- a/lua/plugins/themes/_globalvar.lua +++ b/lua/plugins/themes/_globalvar.lua @@ -64,4 +64,11 @@ if pcode.active_golang_config then table.insert(pcode.null_ls_ensure_installed, "ast_grep") table.insert(pcode.null_ls_ensure_installed, "gofumpt") end +-- run if python config true +if pcode.active_python_config then + table.insert(pcode.treesitter_ensure_installed, "python") + table.insert(pcode.mason_ensure_installed, "pyright") + table.insert(pcode.null_ls_ensure_installed, "flake8") + table.insert(pcode.null_ls_ensure_installed, "black") +end return {}