This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add the Emacs support for MLIR's LSP server
ClosedPublic

Authored by lxsameer on Apr 3 2022, 12:07 PM.

Details

Summary

In order to use the MLIR LSP server in Emacs, first the mlir-lsp-client.el
has to be loaded via elisp and then, one should call lsp-mlir-setup function
to setup the LSP client. After that simply calling the lsp function while
the mlir-mode is active with result in finding the language server (default
to mlir-lsp-server) via the lsp-mlir-server-executable customization variable
and connecting to it by the LSP library. Users who use MLIR's language server
library to create their own server can simply set the variable lsp-mlir-server-executable
to point to their own implementation executable.

Diff Detail

Event Timeline

lxsameer created this revision.Apr 3 2022, 12:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2022, 12:07 PM
lxsameer requested review of this revision.Apr 3 2022, 12:07 PM
tschuett added inline comments.
mlir/utils/emacs/mlir-lsp-client.el
20
lxsameer updated this revision to Diff 420088.Apr 3 2022, 2:00 PM

Fixed a typo

Do you want to eventually upstream the support for MLIR to https://github.com/emacs-lsp/lsp-mode/?

I've thought about it, but I had two pros for keeping it here in my head: 1) since the mlir-mode and the mlir-lsp-server are distributed with LLVM, maybe it is better to keep it here (for example to match the compatibility) 2) it might worth merging this client with the mlir-mode

wdyt?

I've thought about it, but I had two pros for keeping it here in my head: 1) since the mlir-mode and the mlir-lsp-server are distributed with LLVM, maybe it is better to keep it here (for example to match the compatibility) 2) it might worth merging this client with the mlir-mode

wdyt?

Totally up to you, but lsp-mode ships lsp-clients for many servers that are distributed over different channels. I use at least clangd and rust-analyzer.

lxsameer updated this revision to Diff 420092.Apr 3 2022, 2:57 PM

Added the missing custom group

I've thought about it, but I had two pros for keeping it here in my head: 1) since the mlir-mode and the mlir-lsp-server are distributed with LLVM, maybe it is better to keep it here (for example to match the compatibility) 2) it might worth merging this client with the mlir-mode

wdyt?

Totally up to you, but lsp-mode ships lsp-clients for many servers that are distributed over different channels. I use at least clangd and rust-analyzer.

So I think, let's keep it here for a while. I'm going to work more on it. and also I'll probably add support for eglot as well

@tschuett may I get your approval please?

tschuett accepted this revision.Apr 5 2022, 4:22 AM

LGTM

This revision is now accepted and ready to land.Apr 5 2022, 4:22 AM
This revision was automatically updated to reflect the committed changes.
keryell added a subscriber: keryell.Apr 8 2023, 6:02 AM
keryell added inline comments.
mlir/utils/emacs/mlir-lsp-client.el
20

It looks like this change did not get through.

What do you mean? The whole commit or that one line ?

What do you mean? The whole commit or that one line ?

The typo.