Skip to content

Commit

Permalink
[wip] feat(#116): Add functions that allow jumping to any symbol. (#121)
Browse files Browse the repository at this point in the history
* feat(#116): Add functions that allow jumping to any symbol.
* fix: use generic completing-read.
  • Loading branch information
iocanel authored and mopemope committed Sep 10, 2018
1 parent 132e655 commit 59568a4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions meghanada.el
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,26 @@ e.g. java.lang.annotation)."
(format "\"%s\"" sym))))
(message "client connection not established")))

(defun meghanada--list-symbols ()
"List all available symbols."
(if (and meghanada--server-process (process-live-p meghanada--server-process))
(let* ((output (meghanada--send-request-sync "ls")))
(split-string output "\n"))
(message "client connection not established")))

(defun meghanada-jump-symbol ()
"Jump to the specified symbol."
(interactive)
(if (and meghanada--server-process (process-live-p meghanada--server-process))
(let ((sym (completing-read "Symbol: " (meghanada--list-symbols) nil nil)))
(when sym
(meghanada--send-request "js" #'meghanada--jump-callback
(buffer-file-name)
(meghanada--what-line)
(meghanada--what-column)
(format "\"%s\"" sym))))
(message "client connection not established")))

(defun meghanada-back-jump ()
"TODO: FIX DOC."
(interactive)
Expand Down

0 comments on commit 59568a4

Please sign in to comment.