Skip to content

alexander-born/bazel.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Features

  • 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

Installation

Use your favorite package manager. Example lazy.nvim:

 return {'alexander-born/bazel.nvim', dependencies = {'nvim-treesitter/nvim-treesitter'} },

Configuration

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".

vim functions:

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().

lua functions:

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()

About

bazel plugin for nvim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published