Starlark Language Server
The Starlark Language Server component provides intellisense features for BUILD
, BUILD.bazel
, WORKSPACE
, *.bzl
and related files.
A different feature set is provided for .bazelrc
files.
Configuration
The language server is configured automatically, no specific configuration is required. To increase logging level, add --log_level=info
to the bsv.bzl.lsp.command
setting.
You can enable/disable various codelens actions via the settings if you find them overly intrusive.
Codelens
Codelens actions are the little links that appear above rule declarations:
//example/routeguide:routeguide_proto
the codelens with the full label will copy the bazel label to the clipboard.build
will runbazel build LABEL
in an integrated terminal.test
will runbazel test LABEL
in an integrated terminal.run
will runbazel run LABEL
in an integrated terminal.debug
will launch a debug session withbazel build LABEL --experimental_skylark_debug
.codesearch
will open up the codesearch webview that will search within the bazel query defined bydeps(LABEL)
.browse
will open a browser tab in the Bezel UI at the corresponding rule.
Hover
Hover over any builtin rule/function/provider/attribute to get inline documentation:
Hover over any custom starlark rule to get inline documentation:
info
Hover documentation for custom/third-party rules is a subscription feature.
Hover over flags in a .bazelrc
file to get flag documentation:
Click on the provided link to go to the bazel docs, or perform a codesearch for the flag in https://cs.opensource.google/bazel/bazel.
Signature Help
Signature help (aka "Parameter Hints") are available for rules and starlark functions:
Completion
Type to get autocompletion for builtin rules:
info
Autocompletion for custom and third-party starlark rules (ones defined in .bzl files within your repo, or an external repository) is a subscription feature.
Use ctrl+space
within the context of a rule/function to get completion
suggestions without typing.
Type ""
in a load statement to get autocompletion of available load symbols:
info
Completion for load symbols is a subscription feature.
Completion for flags is provided within .bazelrc
files:
Definition
Type F12
in a bazel label (string literal) to jump to the definition of the label:
F12
over a rule name to jump the file where the symbol is declared:
info
Jump-to-definition for custom/third-party rules is a subscription feature.
Jump-to-label
Use the bsv.bzl.goToLabel
command (mac: โ+;
; just below the familiar โ+p
accelerator) to pop open an input box. Enter the bazel label to navigate to and
press ENTER
:
Syntax Highlighting
Syntax highlighting is provided for bazel
and starlark
files.