aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/tblgen_lsp_server.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lsp/tblgen_lsp_server.lua')
-rw-r--r--lsp/tblgen_lsp_server.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/lsp/tblgen_lsp_server.lua b/lsp/tblgen_lsp_server.lua
new file mode 100644
index 00000000..932d8a23
--- /dev/null
+++ b/lsp/tblgen_lsp_server.lua
@@ -0,0 +1,23 @@
+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
+
+---@brief
+---
+---https://mlir.llvm.org/docs/Tools/MLIRLSP/#tablegen-lsp-language-server--tblgen-lsp-server
+--
+-- The Language Server for the LLVM TableGen language
+--
+-- `tblgen-lsp-server` can be installed at the llvm-project repository (https://github.com/llvm/llvm-project)
+return {
+ cmd = get_command(),
+ filetypes = { 'tablegen' },
+ root_markers = { 'tablegen_compile_commands.yml', '.git' },
+}