ivy-erlang-complete
gives context sensitive completion for Erlang
without connecting to Erlang nodes. It also can go to
definition/references/specs and find files in the current Erlang
project. Projects will be setup automatically based on rebar or rebar3
configs, and some heuristics. For now this package also support
eldoc
.
You can now install the package ivy-erlang-complete
from
MELPA. Just M-x
package-install
Enter ivy-erlang-complete
Enter.
- findutils
- coreutils
- sed
- grep
- the_silver_searcher
ag
(for finding definition, references and specs) or - ripgrep
rg
(preferred). Ripgrep is faster on this cases so if you install itivy-erlang-complete
will userg
for finding definition, references and specs. Just install ripgrep.
To start using ivy-erlang-complete
you need add the following to init.el
:
(require 'ivy-erlang-complete)
(add-hook 'erlang-mode-hook #'ivy-erlang-complete-init)
;; automatic update completion data after save
(add-hook 'after-save-hook #'ivy-erlang-complete-reparse)
For a better Erlang development experience you also can add these packages:
rebar
for building & testingflycheck
for on the fly error checking (will setup automatically)wrangler
for smart refactoring
This is my emacs config for erlang developement:
;;;; Erlang
(defun my-erlang-hook ()
"Setup for erlang."
(require 'wrangler)
(ivy-erlang-complete-init)
(defvar erlang-extended-mode-map)
(define-key erlang-extended-mode-map (kbd "M-.") nil)
(define-key erlang-extended-mode-map (kbd "M-,") nil)
(define-key erlang-extended-mode-map (kbd "M-?") nil)
(define-key erlang-extended-mode-map (kbd "(") nil))
(add-hook 'erlang-mode-hook #'my-erlang-hook)
(add-hook 'after-save-hook #'ivy-erlang-complete-reparse)
(add-to-list 'auto-mode-alist '("rebar\\.config$" . erlang-mode))
(add-to-list 'auto-mode-alist '("relx\\.config$" . erlang-mode))
(add-to-list 'auto-mode-alist '("system\\.config$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.app\\.src$" . erlang-mode))
;;; wrangler
;; install https://github.com/RefactoringTools/wrangler/blob/master/INSTALL
;; before usage
(add-to-list 'load-path "/usr/lib/erlang/lib/wrangler-1.2.0/elisp")
;(require 'wrangler)
; Some code inspection functionalities of Wrangler generate .dot
; files, which can be compiled and previewed in Emacs if the
; Graphviz-dot mode for Emacs is enabled.
;(load-library "graphviz-dot-mode")
By default next keybindings will be setup (can be disabled by setting
variable ivy-erlang-complete-use-default-keys
to nil
):
key | function | description |
---|---|---|
C-: |
ivy-erlang-complete |
start completion at point |
C-c C-h |
ivy-erlang-complete-show-doc-at-point |
show docs for function under point (from standart library) in your browser |
C-c C-e |
ivy-erlang-complete-set-project-root |
manually setup project root for strange cases (if you find that case please open issue) |
M-. |
ivy-erlang-complete-find-definition |
go to definition |
M-? |
ivy-erlang-complete-find-references |
go to references |
C-c C-f |
ivy-erlang-complete-find-spec |
go to spec or callback definition |
M-, |
xref-pop-marker-stack |
for emacs 25+ go back |
M-, |
pop-global-mark |
for emacs 24 go back |
C-c C-o |
ivy-erlang-complete-find-file |
find file in current project (preselect file or symbol under point) |
For now project is useful for production erlang development. There are
some minor issues with context identifying. In this cases accuracy
sacrificed for speed. Also completing for functions in modules with
export_all
directive doesn't work. I can implement it. But I don't
do it because this implementation is very slow. Also I think that
export_all
is bad practice.
There are context sensitive completions for:
- local variables
- local functions
- module names
- module functions
- record names
- record fields
- macros names
- guards
- types
Also you can find:
- definition of:
- functions
- macros
- records
- types
- references of:
- functions
- records
- macros
- types
- specs for:
- functions
- callbacks from used behaviours
See documentation for functions from standard library in your browser.
- create company backend
- add eldoc support
- improve working with macros (add arity and eldoc)
- renew gifs in this file (added link to asciinema)
distel
is great. I think distel
much better than this package in
some cases. But I can't configure it for work with my job's projects.
I thought that only licensed nodes can connect to cluster, distel
nodes can not. It was mistake. I was trying to use esense
instead. But
esense
project is now dead and nobody fix crashes in it. So I start
this project. For now this project can do all the things that esense
can do and more.
edts
need for project configuration for every project you
work with. Every day I work with many erlang projects. And I don't
like configuration process at all. So this package no need it - it
work out of the box. Also I don't use edts
sufficient time so please
add your comparison here.
Patches are welcome :) You also can send your bugreports and feature requests here.