aboutsummaryrefslogtreecommitdiff
path: root/modules/neovim/nvim/lua/config/lsp/tblgen_lsp_server.lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/neovim/nvim/lua/config/lsp/tblgen_lsp_server.lua')
-rw-r--r--modules/neovim/nvim/lua/config/lsp/tblgen_lsp_server.lua18
1 files 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' }
}