mojom-lsp

Crates.iomojom-lsp
lib.rsmojom-lsp
version0.1.2
sourcesrc
created_at2020-04-11 08:00:57.22857
updated_at2021-10-27 08:22:30.101245
descriptionA language server for Mojom IDL
homepage
repositoryhttps://github.com/GoogleChromeLabs/mojom-language-support
max_upload_size
id228554
size122,657
bashi (bashi)

documentation

README

mojom-lsp

A language server for Mojom IDL. It supports:

  • Syntax check
  • Goto definition

mojom-lsp is tested on Visual Studio Code with vscode-mojom extension and Emacs with eglot.

Installation

mojom-lsp requires stable Rust to build. Run the following command to install mojom-lsp.

# This generates `mojom-lsp` binary.
$ cargo install mojom-lsp

Be sure to include the binary to your $PATH.

Editor settings

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.

Syntax highlighting

mojom-lsp itself doesn't provide syntax highlighting for now. You need to configure your editor to get syntax highlighting.

VSCode

Use vscode-mojom extension.

Vim

The Chromium repository provides basic mojom support.

Emacs

An easy way to get syntax highliting is to use define-generic-mode like below:

;; 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))
Commit count: 116

cargo fmt