A language server for Mojom IDL. It supports:
mojom-lsp is tested on Visual Studio Code with vscode-mojom-idl extension and Emacs with eglot.
mojom-lsp is at an early stage of development and you need to build it from source. mojom-lsp requires stable Rust to build.
sh
$ cargo build --release --bin mojom-lsp-server
The server will be generated in target/release/
. Copy the binary mojom-lsp-server
into your $PATH
, or add target/release/
to your $PATH
.
mojom-lsp assumes that your LSP client sends rootUri
in the initialize
request. rootUri
should be a path that contains the src
directory of your Chromium working directory.
mojom-lsp itself doesn't provide syntax highlighting for now. You need to configure your editor to get syntax highlighting.
Use vscode-mojom-idl extension.
The Chromium repository provides basic mojom support.
An easy way to get syntax highliting is to use define-generic-mode
like below:
lisp
;; Mojom
(require 'generic)
(define-generic-mode mojom-mode
;; comments
'("//" ("/*" . "*/"))
;; keywords
'("module" "import" "struct" "union" "enum" "interface")
;; font-locks
nil
;; auto-mode
nil
;; hooks
nil
"Major mode for mojom")
(add-to-list 'auto-mode-alist '("\\.mojom$" . mojom-mode))