Function: bazel--annotate

bazel--annotate is a natively compiled function defined in bazel.el.

Signature

(bazel--annotate TARGET)

Documentation

Annotate Bazel TARGET for completion.

TARGET should be a completion candidate returned by
‘bazel--target-completion-table’. Return a string specifying the target
kind of TARGET, or nil if TARGET is not a Bazel target or its kind can’t be determined. This function is meant to be used as completion annotation function; see Info node (elisp) Programmed Completion.

Source Code

;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazel--annotate (target)
  "Annotate Bazel TARGET for completion.
TARGET should be a completion candidate returned by
‘bazel--target-completion-table’.  Return a string specifying the target
kind of TARGET, or nil if TARGET is not a Bazel target or its kind can’t
be determined.  This function is meant to be used as completion
annotation function; see Info node ‘(elisp) Programmed Completion’."
  (declare (ftype (function (string) (or string null)))
           (side-effect-free t))
  (cl-check-type target string)
  ;; Note that ‘bazel--complete-targets’ and ‘bazel--complete-files’ add the
  ;; ‘bazel-target-kind’ property to the last component of the target label, so
  ;; we check the last instead of the first character.
  (let ((n (length target)))
    (unless (eql n 0)
      (when-let* ((kind (get-text-property (1- n) 'bazel-target-kind target)))
        (format " (%s)" kind)))))