Add completion after inserting ::

It is used in java 8 to reference methods
This commit is contained in:
Lukasz Klich 2015-07-19 11:50:50 +02:00 committed by syl20bnr
parent 010262e181
commit 2e8f62cc22
2 changed files with 16 additions and 3 deletions

View file

@ -11,12 +11,24 @@
(defun spacemacs/java-completing-dot ()
"Insert a period and show company completions."
(interactive "*")
(when (s-matches? (rx (+ (not space)))
(buffer-substring (line-beginning-position) (point)))
(delete-horizontal-space t))
(spacemacs//java-delete-horizontal-space)
(insert ".")
(company-emacs-eclim 'interactive))
(defun spacemacs/java-completing-double-colon ()
"Insert double colon and show company completions."
(interactive "*")
(spacemacs//java-delete-horizontal-space)
(insert ":")
(let ((curr (point)))
(when (s-matches? (buffer-substring (- curr 2) (- curr 1)) ":")
(company-emacs-eclim 'interactive))))
(defun spacemacs//java-delete-horizontal-space ()
(when (s-matches? (rx (+ (not space)))
(buffer-substring (line-beginning-position) (point)))
(delete-horizontal-space t)))
(defun spacemacs/java-maven-test ()
(interactive)
(eclim-maven-run "test"))

View file

@ -29,6 +29,7 @@
(evil-define-key 'insert java-mode-map
(kbd ".") 'spacemacs/java-completing-dot
(kbd ":") 'spacemacs/java-completing-double-colon
(kbd "M-.") 'eclim-java-find-declaration
(kbd "M-,") 'pop-tag-mark
(kbd "M-<mouse-3>") 'eclim-java-find-declaration