aboutsummaryrefslogtreecommitdiff
path: root/modules/neovim/nvim/lua/config/lsp/tblgen_lsp_server.lua
blob: 9e7b6505076a017edb30340887808fc45c06044c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 = get_command(),
  filetypes = { 'tablegen' },
  root_markers = { 'tablegen_compile_commands.yml', '.git' }
}