From 8a2f89d27e3d96f87185a0805f0c58a6e583c9a8 Mon Sep 17 00:00:00 2001 From: Stefan Weigl-Bosker Date: Wed, 24 Dec 2025 13:47:09 -0500 Subject: tblgen_lsp_server: fix compile db detection --- .../neovim/nvim/lua/config/lsp/tblgen_lsp_server.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/neovim/nvim/lua/config/lsp/tblgen_lsp_server.lua b/modules/neovim/nvim/lua/config/lsp/tblgen_lsp_server.lua index 536ab79..9e7b650 100644 --- a/modules/neovim/nvim/lua/config/lsp/tblgen_lsp_server.lua +++ b/modules/neovim/nvim/lua/config/lsp/tblgen_lsp_server.lua @@ -1,5 +1,19 @@ +local function get_command() + local cmd = { ((vim.env.LLVM_DIR and (vim.env.LLVM_DIR .. "/bin/")) or "") .. "tblgen-lsp-server" } + local files = vim.fs.find( + { "tablegen_compile_commands.yml", "build/tablegen_compile_commands.yml" }, + { path = vim.fn.expand("%:p:h"), upward = true, type = "file" } + ) + if #files > 0 then + local file = files[1] + table.insert(cmd, "--tablegen-compilation-database=" .. file) + end + + return cmd +end + return { - cmd = { ((vim.env.LLVM_DIR and (vim.env.LLVM_DIR .. "/bin/")) or "") .. "tblgen-lsp-server" }, + cmd = get_command(), filetypes = { 'tablegen' }, - root_markers = { '.git' } + root_markers = { 'tablegen_compile_commands.yml', '.git' } } -- cgit v1.2.3