mirror of
https://github.com/macocianradu/setup.git
synced 2026-03-18 12:50:05 +00:00
added test debugging
This commit is contained in:
@@ -15,7 +15,7 @@ dap.listeners.after.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
require("dap-python").setup("~/Projects/odoo/venv/bin/python3")
|
||||
require("dap-python").setup("~/projects/odoo/venv/bin/python3")
|
||||
dap.adapters['pwa-chrome'] = {
|
||||
type = 'server',
|
||||
host = 'localhost',
|
||||
@@ -29,6 +29,72 @@ dap.adapters['pwa-chrome'] = {
|
||||
}
|
||||
}
|
||||
|
||||
local function run_odoo_test_at_cursor()
|
||||
-- Safely get the node at cursor
|
||||
local status, node = pcall(vim.treesitter.get_node)
|
||||
if not status or not node then
|
||||
print("Error: Tree-sitter parser not found. Ensure you are in a Python buffer.")
|
||||
return
|
||||
end
|
||||
|
||||
-- Safety Limit: Prevent infinite loop if tree is malformed
|
||||
local attempts = 0
|
||||
while node do
|
||||
if node:type() == 'function_definition' then
|
||||
break
|
||||
end
|
||||
node = node:parent()
|
||||
attempts = attempts + 1
|
||||
if attempts > 50 then
|
||||
print("Error: Could not find function definition (traversal limit reached).")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if not node then
|
||||
print("Cursor is not inside a function definition.")
|
||||
return
|
||||
end
|
||||
|
||||
-- Extract function name safely
|
||||
local func_name = nil
|
||||
for child in node:iter_children() do
|
||||
if child:type() == 'identifier' then
|
||||
func_name = vim.treesitter.get_node_text(child, 0)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not func_name then
|
||||
print("Error: Could not extract function name.")
|
||||
return
|
||||
end
|
||||
|
||||
local db = vim.fn.input("Database: ")
|
||||
if db == nil or db == "" then
|
||||
print("Canceled (no database provided).")
|
||||
return
|
||||
end
|
||||
|
||||
print("Launching Debugger for: " .. func_name)
|
||||
|
||||
dap.run({
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Debug Test: " .. func_name,
|
||||
pythonPath = "/home/admac/projects/odoo/venv/bin/python3",
|
||||
program = "/home/admac/projects/odoo/odoo/odoo-bin",
|
||||
args = {
|
||||
"--addons-path", "/home/admac/projects/odoo/enterprise/,/home/admac/projects/odoo/odoo/addons/",
|
||||
"-d", db,
|
||||
"--log-level=warn",
|
||||
"--test-tags", "." .. func_name,
|
||||
"--stop-after-init",
|
||||
},
|
||||
console = "externalTerminal",
|
||||
})
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>5", function() dap.continue() end)
|
||||
vim.keymap.set("n", "<leader>6", function() dap.step_over() end)
|
||||
vim.keymap.set("n", "<leader>+", function() dap.step_into() end)
|
||||
@@ -37,18 +103,19 @@ vim.keymap.set("n", "<leader>b", function() dap.toggle_breakpoint() end)
|
||||
vim.keymap.set("n", "<leader>B", function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end)
|
||||
vim.keymap.set("n", "<leader>qd", function() dap.terminate() end)
|
||||
vim.keymap.set("n", "<leader>rd", function() dap.restart() end)
|
||||
vim.keymap.set("n", "<leader>dt", run_odoo_test_at_cursor, { desc = "Debug Odoo Test unde Cursor" })
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Launch Odoo",
|
||||
program = "/home/odoo/Projects/odoo/odoo/odoo-bin",
|
||||
program = "/home/admac/projects/odoo/odoo/odoo-bin",
|
||||
pythonPath = function()
|
||||
return "/home/odoo/Projects/odoo/venv/bin/python3"
|
||||
return "/home/admac/projects/odoo/venv/bin/python3"
|
||||
end,
|
||||
args = {
|
||||
"--addons-path", "/home/odoo/Projects/odoo/enterprise/,/home/odoo/Projects/odoo/odoo/addons/",
|
||||
"--addons-path", "/home/admac/projects/odoo/enterprise/,/home/admac/projects/odoo/odoo/addons/",
|
||||
"--dev", "all",
|
||||
"-d", "rd-pos"
|
||||
}
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "ccf25a5452b8697a823de3e5ecda63ed3d723b79" },
|
||||
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"everforest-nvim": { "branch": "main", "commit": "d2936185a6d266def29fd7b523d296384580ef08" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
|
||||
"everforest-nvim": { "branch": "main", "commit": "557bce922401e247a596583679bc181d4d688554" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "cdafc320f03f2572c40ab93a4eecb733d4016d07" },
|
||||
"harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "f0f5bbb9e5bfae5e6468f9359ffea3d151418176" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "35ec9e1425c2f9a36f556893336af4f302c63214" },
|
||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||
"neogit": { "branch": "master", "commit": "c6d00913f802acedfb93c01267e89185f25800ca" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "a7bcf1d88069fc67c9ace8a62ba480b8fe879025" },
|
||||
"nvim-dap": { "branch": "master", "commit": "6782b097af2417a4c3e33849b0a26ae2188bd7ea" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" },
|
||||
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
||||
"neogit": { "branch": "master", "commit": "4ba620addbeeca2594c794b151e611c037973480" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" },
|
||||
"nvim-dap": { "branch": "master", "commit": "5860c7c501eb428d3137ee22c522828d20cca0b3" },
|
||||
"nvim-dap-python": { "branch": "master", "commit": "64652d1ae1db80870d9aac7132d76e37acd86a26" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "cbd1e91296189a765094810de1b71a04e2597579" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "b7c48a7111534b66bee077da8035ac7208a294ff" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-scrollbar": { "branch": "main", "commit": "5b103ef0fd2e8b9b4be3878ed38d224522192c6c" },
|
||||
"nvim-scrollbar": { "branch": "main", "commit": "f8e87b96cd6362ef8579be456afee3b38fd7e2a8" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||
"odoo-neovim": { "branch": "main", "commit": "882aeb9bc0d6302cb99aa1235abe4820532fd416" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"smear-cursor.nvim": { "branch": "main", "commit": "abfa5835920b1d76c0e24e1465a618ad914be90a" },
|
||||
"smear-cursor.nvim": { "branch": "main", "commit": "ed64b7decb25e3db11befa0b76adc9073a3688b5" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "83a3a713d6b2d2a408491a1b959e55a7fa8678e8" },
|
||||
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
|
||||
"vim-projectionist": { "branch": "master", "commit": "5ff7bf79a6ef741036d2038a226bcb5f8b1cd296" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }
|
||||
|
||||
@@ -28,12 +28,7 @@ require("lazy").setup({
|
||||
vim.cmd('colorscheme everforest')
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
dir = '/home/odoo/Projects/odoo-neovim',
|
||||
lazy = false,
|
||||
},
|
||||
--'odoo/odoo-neovim',
|
||||
'odoo/odoo-neovim',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'theprimeagen/harpoon',
|
||||
'petertriho/nvim-scrollbar',
|
||||
@@ -75,5 +70,8 @@ require("lazy").setup({
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "everforest" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
checker = {
|
||||
enabled = true,
|
||||
frequency = 86400
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user