Function: js-find-symbol

js-find-symbol is an interactive and byte-compiled function defined in js.el.gz.

Signature

(js-find-symbol &optional ARG)

Documentation

Read a JavaScript symbol and jump to it.

With a prefix argument, restrict symbols to those from the current buffer. Pushes a mark onto the tag ring just like find-tag.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js-find-symbol (&optional arg)
  "Read a JavaScript symbol and jump to it.
With a prefix argument, restrict symbols to those from the
current buffer.  Pushes a mark onto the tag ring just like
`find-tag'."
  (interactive "P")
  (require 'xref)
  (let (symbols marker)
    (if (not arg)
        (setq symbols (js--get-all-known-symbols))
      (setq symbols (make-hash-table :test 'equal))
      (js--imenu-to-flat (js--imenu-create-index)
                               "" symbols))

    (setq marker (cdr (js--read-symbol
                       symbols "Jump to: "
                       (js--guess-symbol-at-point))))

    (xref-push-marker-stack)
    (switch-to-buffer (marker-buffer marker))
    (push-mark)
    (goto-char marker)))