Open
Description
js2-mode
has a js2-jump-to-definition
functions which can jump to a local definition.
Currently I'm using a bit hacky approach:
(defun my-js-jump-to-definition ()
"Jump to a definition."
(interactive)
(condition-case-unless-debug nil
(js2-jump-to-definition)
(error
(xref-pop-marker-stack)
(xref-find-definitions (xref-backend-identifier-at-point (xref-find-backend))))))
The logic is simple: try jump with js2-mode ast, if it fails for whatever reason fallback to xref.
It would be cool if xref-js2
could use something like this for local jumps, because current behavior isn't quite good in my opinion.
Metadata
Metadata
Assignees
Labels
No labels