Function: bazel--target-completion-table
bazel--target-completion-table is a natively compiled function defined
in bazel.el.
Signature
(bazel--target-completion-table PATTERN ONLY-TESTS)
Documentation
Return a completion table for Bazel targets and target patterns.
See URL ‘https://bazel.build/run/build#specifying-build-targets’ for a description of target patterns. Completion starts with the package in ‘default-directory’. Return a completion table that can be passed to ‘completing-read’. See Info node (elisp) Basic Completion for more information about completion tables. The completion is not exact and only includes potential packages and rule targets. If PATTERN is non-nil, complete target patterns and skip files. If ONLY-TESTS is non-nil, restrict rule target completion to test targets. If ‘default-directory’ is not in a Bazel package or repository, return an empty completion table. This function should always be fast and not access the filesystem, but the returned completion table can access the filesystem.
Source Code
;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazel--target-completion-table (pattern only-tests)
"Return a completion table for Bazel targets and target patterns.
See URL ‘https://bazel.build/run/build#specifying-build-targets’
for a description of target patterns. Completion starts with the
package in ‘default-directory’. Return a completion table that
can be passed to ‘completing-read’. See Info node ‘(elisp) Basic
Completion’ for more information about completion tables. The
completion is not exact and only includes potential packages and
rule targets. If PATTERN is non-nil, complete target patterns and skip
files. If ONLY-TESTS is non-nil, restrict rule target completion
to test targets. If ‘default-directory’ is not in a Bazel
package or repository, return an empty completion table. This
function should always be fast and not access the filesystem, but
the returned completion table can access the filesystem."
(declare (ftype (function (string t) t)))
;; We return a completion function so that we don’t have to find all targets
;; eagerly. See Info node ‘(elisp) Programmed Completion’.
(bazel--target-completion-table-with-metadata
(when-let* ((directory default-directory))
(lambda (string predicate action)
(cl-check-type string string)
(cl-check-type predicate (or function null))
(when-let* ((root (bazel--repository-root directory))
(package (bazel--package-name directory root)))
(let ((case-fold-search completion-ignore-case)
(search-spaces-regexp nil))
;; We dynamically generate and use a helper completion table based on
;; the provided prefix pattern.
(complete-with-action
action
(bazel--target-completion-table-1 root package pattern only-tests
string)
string predicate)))))))