[Mlir-commits] [mlir] [Documentation] Add neovim documentation for lsp servers (PR #154896)
Jasmine Tang
llvmlistbot at llvm.org
Wed Aug 27 11:03:10 PDT 2025
https://github.com/badumbatish updated https://github.com/llvm/llvm-project/pull/154896
>From eac7d1831af367b8e6bf9465a415ebcad13fcfb2 Mon Sep 17 00:00:00 2001
From: Jasmine Tang <jjasmine at igalia.com>
Date: Thu, 21 Aug 2025 22:47:51 -0700
Subject: [PATCH 1/3] Add neovim documentation for lsp servers
---
mlir/docs/Tools/MLIRLSP.md | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/mlir/docs/Tools/MLIRLSP.md b/mlir/docs/Tools/MLIRLSP.md
index 8270f922fffe8..585b664f2c42c 100644
--- a/mlir/docs/Tools/MLIRLSP.md
+++ b/mlir/docs/Tools/MLIRLSP.md
@@ -389,6 +389,25 @@ LSP Language plugins are available for many popular editors, and in principle
the language servers provided by MLIR should work with any of them, though
feature sets and interfaces may vary. Below are a set of plugins that are known
to work:
+### Neovim
+
+#### Setup
+Neovim supports integration of all three language servers through its built-in LSP client, which requires
+hooking up to third party servers.
+
+The quick start guide on its [LSP help page](https://neovim.io/doc/user/lsp.html) details how to set up
+a generic LSP config.
+
+For the most up-to-date configs of all three language server, visit the
+[lsp directory](https://github.com/neovim/nvim-lspconfig/tree/master/lsp) of nvim-lspconfig, copy and paste the config of
+choice to your local neovim config of the LSP. The file names of the servers' config are:
+
+- `mlir_lsp_server.lua`: for the MLIR LSP Language Server
+- `mlir_pdll_lsp_server.lua`: for the PDLL LSP Language Server
+- `tblgen_lsp_server.lua`: for the TableGen LSP Language Server
+
+Features such as find definitions, find references, hover, live diagnostics and verifiers are well supported.
+For extra information, please refer to each LSP's dedicated's section.
### Visual Studio Code
>From 83f9297ef4c3a55e9b4f9b4f9af75655d813423e Mon Sep 17 00:00:00 2001
From: Jasmine Tang <jjasmine at igalia.com>
Date: Wed, 27 Aug 2025 10:55:26 -0700
Subject: [PATCH 2/3] Update docs for downstream LSP like clangir and fir
---
mlir/docs/Tools/MLIRLSP.md | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/mlir/docs/Tools/MLIRLSP.md b/mlir/docs/Tools/MLIRLSP.md
index 585b664f2c42c..14a117deacd2a 100644
--- a/mlir/docs/Tools/MLIRLSP.md
+++ b/mlir/docs/Tools/MLIRLSP.md
@@ -392,7 +392,7 @@ to work:
### Neovim
#### Setup
-Neovim supports integration of all three language servers through its built-in LSP client, which requires
+Startin from v0.11, Neovim supports integration of all three language servers through its built-in LSP client, which requires
hooking up to third party servers.
The quick start guide on its [LSP help page](https://neovim.io/doc/user/lsp.html) details how to set up
@@ -402,13 +402,29 @@ For the most up-to-date configs of all three language server, visit the
[lsp directory](https://github.com/neovim/nvim-lspconfig/tree/master/lsp) of nvim-lspconfig, copy and paste the config of
choice to your local neovim config of the LSP. The file names of the servers' config are:
-- `mlir_lsp_server.lua`: for the MLIR LSP Language Server
-- `mlir_pdll_lsp_server.lua`: for the PDLL LSP Language Server
-- `tblgen_lsp_server.lua`: for the TableGen LSP Language Server
+- `mlir_lsp_server.lua`: for the MLIR LSP Language Server.
+- `mlir_pdll_lsp_server.lua`: for the PDLL LSP Language Server.
+- `tblgen_lsp_server.lua`: for the TableGen LSP Language Server.
Features such as find definitions, find references, hover, live diagnostics and verifiers are well supported.
For extra information, please refer to each LSP's dedicated's section.
+#### External/downstream LSPs
+
+For external or downstream LSPs that wishes to be integrated to nvim, there are two options:
+- If nvim-lspconfig houses a config of your LSP and your LSP server executable can be found in PATH, you can call it with `vim.lsp.enable("server_name")`.
+- If nvim-lspconfig doesn't have your LSP config in their repository, you'll need to register it locally. The following example
+is with the ClangIR LSP before it is eventually registered with PR [#4032](https://github.com/neovim/nvim-lspconfig/pull/4032).
+
+```lua
+vim.lsp.config['cir_lsp_server'] = {
+ cmd = { 'cir-lsp-server' },
+ filetypes = { 'cir' },
+}
+
+vim.lsp.enable('cir_lsp_server')
+```
+
### Visual Studio Code
The [MLIR extension](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-mlir)
>From 026b4bbf9ce23af4d2ec2222b9b12326feb6c7c1 Mon Sep 17 00:00:00 2001
From: Jasmine Tang <jjasmine at igalia.com>
Date: Wed, 27 Aug 2025 11:02:56 -0700
Subject: [PATCH 3/3] Fix typo, add extra directions
---
mlir/docs/Tools/MLIRLSP.md | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/mlir/docs/Tools/MLIRLSP.md b/mlir/docs/Tools/MLIRLSP.md
index 14a117deacd2a..b7aef6f48ea7a 100644
--- a/mlir/docs/Tools/MLIRLSP.md
+++ b/mlir/docs/Tools/MLIRLSP.md
@@ -392,7 +392,7 @@ to work:
### Neovim
#### Setup
-Startin from v0.11, Neovim supports integration of all three language servers through its built-in LSP client, which requires
+Starting from v0.11, Neovim supports integration of all three language servers through its built-in LSP client, which requires
hooking up to third party servers.
The quick start guide on its [LSP help page](https://neovim.io/doc/user/lsp.html) details how to set up
@@ -400,25 +400,26 @@ a generic LSP config.
For the most up-to-date configs of all three language server, visit the
[lsp directory](https://github.com/neovim/nvim-lspconfig/tree/master/lsp) of nvim-lspconfig, copy and paste the config of
-choice to your local neovim config of the LSP. The file names of the servers' config are:
+choice to your local neovim config of the LSP for further modification of LSP executable path and file types. The file names of the servers' config are:
- `mlir_lsp_server.lua`: for the MLIR LSP Language Server.
- `mlir_pdll_lsp_server.lua`: for the PDLL LSP Language Server.
- `tblgen_lsp_server.lua`: for the TableGen LSP Language Server.
Features such as find definitions, find references, hover, live diagnostics and verifiers are well supported.
-For extra information, please refer to each LSP's dedicated's section.
+For more information, please refer to each LSP's dedicated's section.
#### External/downstream LSPs
-For external or downstream LSPs that wishes to be integrated to nvim, there are two options:
-- If nvim-lspconfig houses a config of your LSP and your LSP server executable can be found in PATH, you can call it with `vim.lsp.enable("server_name")`.
-- If nvim-lspconfig doesn't have your LSP config in their repository, you'll need to register it locally. The following example
-is with the ClangIR LSP before it is eventually registered with PR [#4032](https://github.com/neovim/nvim-lspconfig/pull/4032).
+For external or downstream LSPs (for example: FlangIR) that wishes to be integrated to nvim, there are two options:
+- If nvim-lspconfig houses a config of your LSP AND your LSP server executable can be found in PATH, you can call it with `vim.lsp.enable("server_name")`.
+- If nvim-lspconfig doesn't have your LSP config in their repository OR your LSP server executable cannot be found in PATH,
+you'll need to register it locally. The following example is with the ClangIR LSP before it is eventually registered
+with PR [#4032](https://github.com/neovim/nvim-lspconfig/pull/4032).
```lua
vim.lsp.config['cir_lsp_server'] = {
- cmd = { 'cir-lsp-server' },
+ cmd = { '<your_clangir_build_path>/cir-lsp-server' },
filetypes = { 'cir' },
}
More information about the Mlir-commits
mailing list