[mlir][mlir-lsp] Add a new C++ LSP server for MLIR named mlir-lsp-server
authorRiver Riddle <riddleriver@gmail.com>
Wed, 21 Apr 2021 21:33:04 +0000 (14:33 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Wed, 21 Apr 2021 21:44:37 +0000 (14:44 -0700)
commit751c14fc4218e26426007f61725f673bee4e08be
treefc95eb0d2840d545116420a6e9f4ce8a149aad0f
parentf8ac31314b4296ce8f33809154bc4ad726161e29
[mlir][mlir-lsp] Add a new C++ LSP server for MLIR named mlir-lsp-server

This commits adds a basic LSP server for MLIR that supports resolving references and definitions. Several components of the setup are simplified to keep the size of this commit down, and will be built out in later commits. A followup commit will add a vscode language client that communicates with this server, paving the way for better IDE experience when interfacing with MLIR files.

The structure of this tool is similar to mlir-opt and mlir-translate, i.e. the implementation is structured as a library that users can call into to implement entry points that contain the dialects/passes that they are interested in.

Note: This commit contains several files, namely those in `mlir-lsp-server/lsp`, that have been copied from the LSP code in clangd and adapted for use in MLIR. This copying was decided as the best initial path forward (discussed offline by several stake holders in MLIR and clangd) given the different needs of our MLIR server, and the one for clangd. If a strong desire/need for unification arises in the future, the existence of these files in mlir-lsp-server can be reconsidered.

Differential Revision: https://reviews.llvm.org/D100439
27 files changed:
mlir/include/mlir/Tools/mlir-lsp-server/MlirLspServerMain.h [new file with mode: 0644]
mlir/lib/CMakeLists.txt
mlir/lib/Tools/CMakeLists.txt [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/CMakeLists.txt [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/LSPServer.cpp [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/LSPServer.h [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/MLIRServer.h [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/MlirLspServerMain.cpp [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/lsp/Logging.cpp [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/lsp/Logging.h [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.cpp [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.h [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/lsp/Transport.cpp [new file with mode: 0644]
mlir/lib/Tools/mlir-lsp-server/lsp/Transport.h [new file with mode: 0644]
mlir/test/CMakeLists.txt
mlir/test/lit.cfg.py
mlir/test/mlir-lsp-server/definition.test [new file with mode: 0644]
mlir/test/mlir-lsp-server/exit-eof.test [new file with mode: 0644]
mlir/test/mlir-lsp-server/exit-with-shutdown.test [new file with mode: 0644]
mlir/test/mlir-lsp-server/exit-without-shutdown.test [new file with mode: 0644]
mlir/test/mlir-lsp-server/initialize-params-invalid.test [new file with mode: 0644]
mlir/test/mlir-lsp-server/initialize-params.test [new file with mode: 0644]
mlir/test/mlir-lsp-server/references.test [new file with mode: 0644]
mlir/tools/CMakeLists.txt
mlir/tools/mlir-lsp-server/CMakeLists.txt [new file with mode: 0644]
mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp [new file with mode: 0644]