aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig
diff options
context:
space:
mode:
Diffstat (limited to 'lua/lspconfig')
-rw-r--r--lua/lspconfig/configs/tblgen_lsp_server.lua13
1 files changed, 12 insertions, 1 deletions
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)