Merge pull request #1 from macocianradu/odoo

Odoo
This commit is contained in:
Macocian Adrian Radu (admac)
2026-01-18 13:03:17 +01:00
committed by GitHub
14 changed files with 334 additions and 100 deletions

View File

@@ -0,0 +1,140 @@
local dap = require("dap")
local dapui = require("dapui")
dapui.setup()
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.after.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.after.event_exited["dapui_config"] = function()
dapui.close()
end
require("dap-python").setup("~/projects/odoo/venv/bin/python3")
dap.adapters['pwa-chrome'] = {
type = 'server',
host = 'localhost',
port = '${port}',
executable = {
command = 'node',
args = {
vim.fn.stdpath('data') .. '/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js',
'${port}',
},
}
}
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)
vim.keymap.set("n", "<leader>-", function() dap.step_out() end)
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/admac/projects/odoo/odoo/odoo-bin",
pythonPath = function()
return "/home/admac/projects/odoo/venv/bin/python3"
end,
args = function()
local db_name = vim.fn.input('Odoo DB: ', 'master')
return {
"--addons-path", "/home/admac/projects/odoo/enterprise/,/home/admac/projects/odoo/odoo/addons/",
"--dev", "all",
"-d", db_name
}
end
}
}
dap.configurations.javascript = {
{
type = "pwa-chrome",
request = "attach",
name = "Launch Odoo JS Tour",
program = "${file}",
cwd = vim.fn.getcwd(),
port = 9222,
webRoot = '${workspaceFolder}',
sourceMaps = true,
protocol = 'inspector',
}
}

View File

@@ -0,0 +1,51 @@
require('gitsigns').setup {
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signs_staged = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signs_staged_enable = true,
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
follow_files = true
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
use_focus = true,
},
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
}
vim.keymap.set('n', '<leader>gb', ':Gitsigns blame_line<CR>', { desc = '[G]it [B]lame' })

View File

@@ -1,56 +1,34 @@
local lspconfig = require('lspconfig')
local project_library_path = vim.fn.getcwd() .. '/node_modules'
local angular_cmd = {
'ngserver',
'--stdio',
'--tsProbeLocations',
project_library_path,
'--ngProbeLocations',
project_library_path .. '@angular/language-server'
}
lspconfig.ts_ls.setup {}
lspconfig.angularls.setup({
cmd = angular_cmd,
on_new_config = function(new_config, new_root_dir)
new_config.cmd = angular_cmd
end
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
lspconfig.cssls.setup {
capabilities = capabilities,
}
lspconfig.lua_ls.setup {}
vim.lsp.config('roslyn', {
settings = {
["csharp|inlay_hints"] = {
csharp_enable_inlay_hints_for_implicit_object_creation = true,
csharp_enable_inlay_hints_for_implicit_variable_types = true,
csharp_enable_inlay_hints_for_lambda_parameter_types = true,
csharp_enable_inlay_hints_for_types = true,
dotnet_enable_inlay_hints_for_indexer_parameters = true,
dotnet_enable_inlay_hints_for_literal_parameters = true,
dotnet_enable_inlay_hints_for_object_creation_parameters = true,
dotnet_enable_inlay_hints_for_other_parameters = true,
dotnet_enable_inlay_hints_for_parameters = true,
dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true,
dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true,
},
},
})
require('roslyn').setup({
exe = {
"dotnet",
vim.fs.joinpath(vim.fn.stdpath("data"), "roslyn", "Microsoft.CodeAnalysis.LanguageServer.dll"),
},
filewatching = true,
vim.lsp.config("*", {
capabilities = capabilities
})
-- vim.lsp.config("ts_ls", {})
vim.lsp.config("ruff", {})
vim.lsp.config("cssls", {})
vim.lsp.config("lua_ls", {})
vim.lsp.config("odoo_ls", {
cmd = {
vim.fn.expand('$HOME/.local/share/nvim/odoo/odoo_ls_server'),
'--config-path', vim.fn.expand('$HOME/projects/odoo/odools.toml'),
}
})
vim.lsp.config("lemminx", {})
vim.lsp.config("eslint", {
cmd = { "vscode-eslint-language-server", "--stdio" },
root_markers = { ".eslintrc", ".eslintrc.json", ".eslintrc.js", "package.json", ".git" },
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte" },
settings = {
validate = "on",
packageManager = "npm",
workingDirectory = { mode = "auto" },
debug = true,
format = true,
},
})
vim.lsp.enable({"odoo_ls", "ruff", "eslint", "cssls", "lua_ls", "lemminx"})
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('user_lsp_attach', { clear = true }),
@@ -103,4 +81,13 @@ cmp.setup({
},
})
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
vim.api.nvim_create_autocmd("FileType", {
pattern = "xml",
callback = function()
vim.bo.indentexpr = ""
vim.bo.cindent = false
vim.bo.smartindent = false
end
})
-- vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]

View File

@@ -2,9 +2,5 @@ require('mason').setup {}
require("mason-lspconfig").setup {
ensure_installed = { "lua_ls",
"cssls",
"angularls",
"roslyn",
"gopls",
"ts_ls",
"eslint" },
}

View File

@@ -1 +0,0 @@
vim.keymap.set("n", "<leader>gr", ":Merginal<CR>")

View File

@@ -0,0 +1,20 @@
require("scrollbar").setup({
-- Shows marks for gitsigns (add, change, delete)
handlers = {
gitsigns = true,
},
-- You can customize the marks used
marks = {
GitAdd = { color = "#39993A" },
GitChange = { color = "#61AFEF" },
GitDelete = { color = "#E06C75" },
DiagnosticError = { color = "#E06C75" },
DiagnosticWarn = { color = "#E5C07B" },
DiagnosticInfo = { color = "#61AFEF" },
DiagnosticHint = { color = "#C678DD" },
},
handle = { color = "#a7c979", },
})
vim.api.nvim_set_hl(0, "Scrollbar", { bg = "#2d353b" })
vim.api.nvim_set_hl(0, "ScrollbarHandle", { bg = "#7fbbb3" })

View File

@@ -0,0 +1,19 @@
require("oil").setup({
float = {
padding = 2,
max_width = 120,
max_height = 0,
border = "rounded",
win_options = {
winblend = 15,
},
preview_split = "vertical"
},
keymaps = {
["q"] = "actions.close",
["<Esc>"] = "actions.close",
},
view_options = {
show_hidden = true
}
})

View File

@@ -11,6 +11,7 @@ require('telescope').load_extension('ui-select')
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>p', builtin.git_files, {})
vim.keymap.set('n', '<leader>sw', '<cmd>Telescope lsp_workspace_symbols<cr>', {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") });
end)

View File

@@ -21,4 +21,18 @@ require 'nvim-treesitter.configs'.setup {
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
disable = { "xml", "python" },
},
fold = {
enable = true,
},
}
vim.o.foldmethod = "expr"
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99

View File

@@ -1,2 +1 @@
require("wicked")

View File

@@ -1,25 +1,33 @@
{
"LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" },
"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" },
"dotnet.nvim": { "branch": "main", "commit": "f5c52f9f52a3d8ca8dff6916c2228fb41a075274" },
"everforest-nvim": { "branch": "main", "commit": "8db2bd8af38ed7b1bd12baa9a28858ff92e839bf" },
"everforest-nvim": { "branch": "main", "commit": "557bce922401e247a596583679bc181d4d688554" },
"gitsigns.nvim": { "branch": "main", "commit": "dfac404ac94b0eb1461bd7da32279e16950dfd67" },
"harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" },
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
"neogit": { "branch": "master", "commit": "802f387b7a44731db2b5f3c0b605ae388b883f1d" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-lspconfig": { "branch": "master", "commit": "aaa807fb2ea8d3caf41c153a174c6b7e472a8428" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4cfe411526a7a99c18281135e8b4765ae6330d15" },
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
"mini.icons": { "branch": "main", "commit": "efc85e42262cd0c9e1fdbf806c25cb0be6de115c" },
"neogit": { "branch": "master", "commit": "d8bf9102692250193b855acd9025a826f1af2729" },
"nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" },
"nvim-dap": { "branch": "master", "commit": "cdfd55a133f63228c55f91378f12908cb2a78ded" },
"nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-lspconfig": { "branch": "master", "commit": "0b38bc74487e73489624d61396af7805af9cc75f" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-scrollbar": { "branch": "main", "commit": "f8e87b96cd6362ef8579be456afee3b38fd7e2a8" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" },
"nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" },
"odoo-neovim": { "branch": "main", "commit": "882aeb9bc0d6302cb99aa1235abe4820532fd416" },
"oil.nvim": { "branch": "master", "commit": "81b8a91735ad5cd24a6b3137f14a89f19176364f" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"roslyn.nvim": { "branch": "main", "commit": "0c4a6f5b64122b51a64e0c8f7aae140ec979690e" },
"smear-cursor.nvim": { "branch": "main", "commit": "4b86df8a0c5f46e708616b21a02493bb0e47ecbd" },
"smear-cursor.nvim": { "branch": "main", "commit": "c85bdbb25db096fbcf616bc4e1357bd61fe2c199" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"undotree": { "branch": "master", "commit": "28f2f54a34baff90ea6f4a735ef1813ad875c743" },
"vim-merginal": { "branch": "develop", "commit": "3dca10fd8bce10edbc2024651db4ffb6dd2d89de" }
"telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" },
"undotree": { "branch": "master", "commit": "178d19e00a643f825ea11d581b1684745d0c4eda" },
"vim-projectionist": { "branch": "master", "commit": "5ff7bf79a6ef741036d2038a226bcb5f8b1cd296" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }
}

View File

@@ -28,14 +28,17 @@ require("lazy").setup({
vim.cmd('colorscheme everforest')
end
},
'odoo/odoo-neovim',
'nvim-treesitter/nvim-treesitter',
'theprimeagen/harpoon',
'petertriho/nvim-scrollbar',
'mbbill/undotree',
'tpope/vim-surround',
'nvim-telescope/telescope-ui-select.nvim',
'idanarye/vim-merginal',
"sphamba/smear-cursor.nvim",
'sphamba/smear-cursor.nvim',
'williamboman/mason.nvim',
'lewis6991/gitsigns.nvim',
'tpope/vim-projectionist',
'williamboman/mason-lspconfig.nvim',
{
"NeogitOrg/neogit",
@@ -44,39 +47,35 @@ require("lazy").setup({
},
config = true
},
'seblj/roslyn.nvim',
'neovim/nvim-lspconfig',
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', lazy = true }
},
'hrsh7th/cmp-nvim-lsp',
{
'stevearc/oil.nvim',
dependencies = {{ "nvim-mini/mini.icons" }}
},
'hrsh7th/cmp-buffer',
'hrsh7th/nvim-cmp',
'L3MON4D3/LuaSnip',
-- {
-- "saghen/blink.nvim",
-- config = function()
-- require("blink").setup({
-- modules = {
-- cmp = true,
-- luasnip = true,
-- -- optionally enable more: lsp, luasnip, etc.
-- },
-- })
-- end
-- },
{
'MoaidHathot/dotnet.nvim',
config = function()
require("dotnet").setup({})
end
},
'mfussenegger/nvim-dap-python',
dependencies = {
'mfussenegger/nvim-dap',
'rcarriga/nvim-dap-ui',
'nvim-neotest/nvim-nio'
},
build = false,
}
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "everforest" } },
-- automatically check for plugin updates
checker = { enabled = true },
checker = {
enabled = true,
frequency = 86400
}
})

View File

@@ -1,7 +1,8 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("n", "<leader>pv", function ()
require("oil").toggle_float()
end)
vim.keymap.set("n", "<leader>pv", ":Ex<CR>")
vim.keymap.set("n", "<leader>u", ":UndotreeShow<CR>")
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
@@ -39,3 +40,5 @@ vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gi<Left><Left><Left>]])
vim.keymap.set("n", "<leader>x", "<cmd>!chmod _x %<CR>", { silent = true})
vim.keymap.set('n', '<leader>;', ':A<CR>', { desc = 'Alternate file' })

View File

@@ -27,6 +27,4 @@ vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "80"
vim.g.mapleader = " "