From c47fffd9660c482a80e6f1b9909ecebfc058203e Mon Sep 17 00:00:00 2001 From: Anirudh Date: Wed, 2 Apr 2025 19:12:14 +0530 Subject: fix(tblgen): find tablegen_compile_commands.yml #3649 The tblgen_lsp_server doesn't seem to load any specific compilation database server and hence we need to explicitly specify the command-line argument to pick the correct database path. --- lua/lspconfig/configs/tblgen_lsp_server.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lua/lspconfig') diff --git a/lua/lspconfig/configs/tblgen_lsp_server.lua b/lua/lspconfig/configs/tblgen_lsp_server.lua index ccb44bb6..ca0713af 100644 --- a/lua/lspconfig/configs/tblgen_lsp_server.lua +++ b/lua/lspconfig/configs/tblgen_lsp_server.lua @@ -1,8 +1,19 @@ local util = require 'lspconfig.util' +local function get_command() + local cmd = { 'tblgen-lsp-server' } + local files = vim.fs.find('tablegen_compile_commands.yml', { path = vim.fn.expand('%:p:h'), upward = true }) + if #files > 0 then + local file = files[1] + table.insert(cmd, '--tablegen-compilation-database=' .. vim.fs.dirname(file) .. '/tablegen_compile_commands.yml') + end + + return cmd +end + return { default_config = { - cmd = { 'tblgen-lsp-server' }, + cmd = get_command(), filetypes = { 'tablegen' }, root_dir = function(fname) return util.root_pattern 'tablegen_compile_commands.yml'(fname) -- cgit v1.2.3-70-g09d2