                                       (format "%s is busy. Open nearest BUILD file? " ar/bazel-command)
                                     "No rule found. Open nearest BUILD file? "))
                  (find-file (concat (file-name-as-directory package-dpath) "BUILD"))
-                 (re-search-forward fname)))
+                 (goto-char (point-min))
+                 (re-search-forward (format "\"%s\"" fname))
+                 (backward-sexp)))
       (find-file (concat (file-name-as-directory package-dpath) "BUILD"))
       (save-excursion
         (save-restriction

            (setq rule-pos (re-search-forward fname)))))
      (goto-char rule-pos)
      (backward-sexp))))

(defun ar/bazel--rules-cache-fpath ()
  "Bazel rules cache path for current project."

          (message rule))
        (ar/bazel-workspace-build-rules)))

(defun ar/bazel-jump-to-build-rule (fork-command)
  "Jump to the closest BUILD rule for current file."
  (interactive "P")
  (assert (executable-find ar/bazel-command) nil
          "\"%s\" not found. Did you set `ar/bazel-command'?" ar/bazel-command)
  (let* ((rule-pos)
         ;; path/to/root (from path/to/root/WORKSPACE)
         (workspace-dpath (expand-file-name
                           (or (locate-dominating-file default-directory "WORKSPACE")
                               (error "Not in a bazel project."))))
         ;; path/to/root/package/subpackage (from path/to/root/package/subpackage/BUILD)
         (package-dpath (expand-file-name
                         (or (locate-dominating-file default-directory "BUILD")
                             (error "No BUILD found."))))
         ;; source.swift
         (fname (replace-regexp-in-string package-dpath
                                          "" (expand-file-name
                                              (or buffer-file-name
                                                  (error "Not visiting a file")))))
         ;; //package/subpackage
         (package (replace-regexp-in-string workspace-dpath
                                            "//" (string-remove-suffix "/" package-dpath)))
