Function: bazel--target-package-completion-table
bazel--target-package-completion-table is a natively compiled function
defined in bazel.el.
Signature
(bazel--target-package-completion-table ROOT REPOSITORY PACKAGE PATTERN)
Documentation
Return a completion table for package patterns.
ROOT is the main repository root, REPOSITORY is the external repository name or the empty string for the main repository, and PACKAGE is the current package. If PATTERN is non-nil, complete target patterns and include wildcards. This is a helper function for ‘bazel--target-completion-table’.
Source Code
;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazel--target-package-completion-table (root repository package pattern)
"Return a completion table for package patterns.
ROOT is the main repository root, REPOSITORY is the external
repository name or the empty string for the main repository, and
PACKAGE is the current package. If PATTERN is non-nil, complete
target patterns and include wildcards. This is a helper function
for ‘bazel--target-completion-table’."
(declare (ftype (function (string string string t) t)))
(cl-check-type root string)
(cl-check-type repository string)
(cl-check-type package string)
(when-let* ((root (if (string-empty-p repository) root
(bazel--external-repository repository root)))
(directory (file-name-as-directory
(expand-file-name package root))))
(lambda (string predicate action)
(let* ((slash (string-match-p (rx ?/ (* (not (any ?/))) eos) string))
(parent (substring-no-properties string 0 (or slash 0)))
(prefix (if slash (concat parent "/") ""))
(parent-directory (file-name-as-directory
(expand-file-name parent directory)))
(table (when (file-accessible-directory-p parent-directory)
;; Merge actual package names and the “...” wildcard.
(bazel--completion-table-with-prefix prefix
(completion-table-merge
(bazel--target-package-completion-table-1
parent-directory)
(and pattern '("..."))))))
(predicate
(if (string-empty-p package)
;; Skip convenience symlinks in the repository root.
(lambda (candidate)
(and (not (string-prefix-p "bazel-" candidate))
(if predicate (funcall predicate candidate) t)))
predicate)))
(complete-with-action action table string predicate)))))