Skip to content

cameron-martin/bazel-lsp

Repository files navigation

Bazel LSP

This is a LSP for bazel, based on starlark-rust.

Features

  • Go to definition for identifiers & labels
  • Autocomplete for identifiers & labels
  • Auto-import (currently only for open files)

Usage

Installation

Download a release from github releases and move it to somewhere on your $PATH.

Alternatively, it can be installed from source by cloning this repo and building with Bazel:

bazel build //:bazel-lsp -c opt

VSCode

Ensure you have the Bazel extension installed, and add the following config to your user settings.json:

{
  "bazel.lsp.command": "bazel-lsp"
}

Restart vscode for this to take effect.

Logging

Logging can be enabled using the RUST_LOG environment variable. For more info on the syntax of this environment variable, see the tracing_subscriber docs.

This can be set in vscode by setting the bazel.lsp.env configuration option:

{
  "bazel.lsp.env": { "RUST_LOG": "info" },
}