Is there a Groovy compatible auto-complete mode for emacs?
I also was not able to find a keyword dictionary that I can use with emacs autocomplete.
Help would be much appreciated.
The key to triggering the auto-completion in emacs is the Tab key. You will get a list of suggestions from the compiler. To select something from the list of suggestions, we recommend you to use C-n and C-p, but the down and up arrow keys can be used as well.
Auto-Complete is an intelligent auto-completion extension for Emacs. It extends the standard Emacs completion interface and provides an environment that allows users to concentrate more on their own work. Its features are: a visual interface, reduce overhead of completion by using statistic method, extensibility.
AFAIK there is no working (intelligent) auto-complete for Groovy. If you are inclined to a bit of hacking, the easiest way to achieving this would be to modify emacs-eclim (an Emacs package for talking to Eclipse) to work with the Eclipse Groovy plugin. Shouldn't be that bad, as there is existing code for working with Eclipse Java that you could use as scaffolding.
HTH and sorry :(
I have 'hacked' both emacs-eclim and Eclim to get code completion, not pretty or feature-complete, good enough for few hours of work.
1. Notes:
If using auto-complete, set the following:
(ac-set-trigger-key "TAB")
(setq ac-auto-start nil)
2. Installation
3. Sample Emacs configuration via use-package and ELPA.
If you don't use use-package, adapt as needed...
(use-package eclim
:ensure emacs-eclim // overwrite ELPA install with my copy
:init (setq help-at-pt-display-when-idle t
eclimd-default-workspace "~/Documents/workspace/"
help-at-pt-timer-delay 0.1)
:config (progn (help-at-pt-set-timer)
(mapc #'require '(eclimd auto-complete-config))
(ac-config-default)
(add-hook 'groovy-mode-hook 'auto-complete-mode)
(require 'ac-emacs-eclim-source)
(ac-emacs-eclim-config)
(defun ers/eclim-run-class ()
(interactive)
(beginning-of-buffer)
(search "class ")
(forward-word)
(eclim-run-class))
(bind-keys :map eclim-mode-map
("C-c C-e l m" . eclim-manage-projects)
("C-c C-e l r" . ers/eclim-run-class)
("C-c C-e l c" . garbage-collect)
("C-c C-e l b" . eclim-project-build))
(add-hook 'groovy-mode-hook
(lambda ()
(remove 'ac-source-clang 'ac-sources)
(eclim-mode t)))
(add-hook 'java-mode-hook
(lambda ()
(remove 'ac-source-clang 'ac-sources)
(eclim-mode t)))))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With