Skip to content

Commit c47fffd

Browse files
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.
1 parent bbb2430 commit c47fffd

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

lua/lspconfig/configs/tblgen_lsp_server.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
local util = require 'lspconfig.util'
22

3+
local function get_command()
4+
local cmd = { 'tblgen-lsp-server' }
5+
local files = vim.fs.find('tablegen_compile_commands.yml', { path = vim.fn.expand('%:p:h'), upward = true })
6+
if #files > 0 then
7+
local file = files[1]
8+
table.insert(cmd, '--tablegen-compilation-database=' .. vim.fs.dirname(file) .. '/tablegen_compile_commands.yml')
9+
end
10+
11+
return cmd
12+
end
13+
314
return {
415
default_config = {
5-
cmd = { 'tblgen-lsp-server' },
16+
cmd = get_command(),
617
filetypes = { 'tablegen' },
718
root_dir = function(fname)
819
return util.root_pattern 'tablegen_compile_commands.yml'(fname)

0 commit comments

Comments
 (0)