- go to definition insides bazel files
- build/test/run bazel target of current buffer
- jump to BUILD file of current buffer
- start debugger of gtest at current cursor position (requires nvim-dap or vimspector)
- get full bazel label at current cursor position inside BUILD file
For auto completion of bazel targets checkout cmp-bazel
Use your favorite package manager. Example lazy.nvim:
return {'alexander-born/bazel.nvim', dependencies = {'nvim-treesitter/nvim-treesitter', 'nvim-lua/plenary.nvim'} },
See configuration with lazyvim here and advanced configuration here. See keymaps example here.
To override the default executable of "bazel" to for example "blaze" use vim.g.bazel_cmd = "blaze"
.
GoToBazelDefinition() " Jump to definition
GoToBazelTarget() " Jumps to the BUILD file of current buffer
GetLabel() " Returns bazel label of target in build file
These can be called from lua via vim.fn.GoToBazelDefinition()
or from the command line via :call GoToBazelDefinition()
.
local bazel = require("bazel")
bazel.run_last()
bazel.run_here(command, args, opts)
bazel.query(args, opts)
bazel.cquery(args, opts)
bazel.get_workspace(path)
bazel.get_workspace_name(path)
bazel.is_bazel_workspace(path)
bazel.is_bazel_cache(path)
bazel.get_workspace_from_cache(path)
require("bazel.gtest").get_gtest_filter_args()
require("bazel.pytest").get_test_filter_args()