Code Monkey home page Code Monkey logo

distel-completion's Introduction

Distel-completion

Distel-completion is an Erlang completion library for both

  • auto-complete-mode
  • company-mode using Distel as a backend.

Usage:

with auto-complete-mode

(require 'auto-complete-distel)
(add-to-list 'ac-sources 'auto-complete-distel)

with company-mode

(require 'company-distel)
(add-to-list 'company-backends 'company-distel)

There is also optional parameters which can be modified.

(setq company-distel-popup-help t)

This will render company's doc-buffer (default <F1> when on a completion-candidate) in a small popup (using popup.el) instead of showing the whole help-buffer.

(setq company-distel-popup-height 30)

This variable specifies the height of the help popup created by company.

Extras

Get Erlang-docs from internet

Get the documentation from the internet:

(setq distel-completion-get-doc-from-internet t)

Change completion symbols

Change the allowed symbols to skip backwords in order to find start-of-word. (showing defaults)

(setq distel-completion-valid-syntax "a-zA-Z:_-")

Current issues

  1. fail: badrpc
fail: [rex [badrpc [EXIT [undef ([distel describe (io format 3) nil]
[rpc -handle_call_call/6-fun-0- 5 ([file rpc.erl] [line 206])])]]]]

This error comes when trying to get the documentation for a completion candidate. It actually uses same functionality as erl-fdoc-describe (C-c C-d d), and if this function stops at "Sent request; waiting for results..", it is the same fault.

  1. In company-mode restart completion after completing a module.

  2. Show whether the completion candidate is of a module or a local function.

  3. Add some formatting to documentation-buffer.

distel-completion's People

Contributors

bsdf avatar sebastiw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

distel-completion's Issues

Very aggressiv autocomplete popup suggestion

Hi

I have an issue where the popup suggestion is aggressive to the extent that it is barely usable. I am not sure if I have misconfigured something.

I use auto-complete, and the behaviour for other languages is as expected.

Currently, whenever the cursor is a whitespace, the autocomplete suggestions pops up. It is a little hard to explain, but for example:

If I set the cursor on a blank line the suggestion with come up, and if say, lists is on the top, I can press enter 5 times and the result would be:

lists
lists
lists
lists
lists

My config is:

;; Erlang
(require 'flycheck-dialyzer)

;; EQC Emacs Mode -- Configuration Start
(add-to-list 'load-path "/usr/local/Cellar/erlang/18.3/lib/erlang/lib/eqc-1.37.2/emacs/")
(autoload 'eqc-erlang-mode-hook "eqc-ext" "EQC Mode" t)
(add-hook 'erlang-mode-hook 'eqc-erlang-mode-hook)
(setq eqc-max-menu-length 30)
(setq eqc-root-dir "/usr/local/Cellar/erlang/18.3/lib/erlang/lib/eqc-1.37.2")
;; EQC Emacs Mode -- Configuration End

;; Erlang
(setq erlang-root-dir "/usr/local/Cellar/erlang/18.3/lib/erlang")
(setq load-path (cons "/usr/local/Cellar/erlang/18.3/lib/erlang/lib/tools-2.8.3/emacs" load-path))
(setq exec-path (cons "/usr/local/Cellar/erlang/18.3/lib/erlang/bin" exec-path))
(require 'erlang-start)

(add-to-list 'auto-mode-alist '("\\.[eh]rl\\'" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.yaws?\\'" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.escript?\\'" . erlang-mode))

;; distel
(push "~/.emacs.d/libs/distel/elisp/" load-path)
(require 'distel)
(distel-setup)

;; prevent annoying hang-on-compile
(defvar inferior-erlang-prompt-timeout t)
;; default node name to emacs@localhost
(setq inferior-erlang-machine-options '("-sname" "emacs"))
;; tell distel to default to that node
(setq erl-nodename-cache
      (make-symbol "emacs@localhost"))

;; company-distel
(require 'auto-complete-distel)
(add-hook 'erlang-mode-hook '(lambda () (add-to-list 'ac-sources 'distel-completions)))
(setq distel-completion-get-doc-from-internet nil)
(setq distel-completion-valid-syntax "a-zA-Z:_-")

(add-hook 'erlang-mode-hook 'flycheck-mode)
(add-hook 'erlang-mode-hook 'auto-complete-mode)

(provide 'erlang)

This may work as intended, and if this is the case, please let me know.

erl-company-help didn't work ?

when use erl-compnay-help to get the function's doc ,then somting string like /_//**/**_ appears,(the doc is chinese).
as i know this is because of the erl-fdoc-describe function in distel.el ,but i still don't find the answer to solve this problem

company-frontend-distel inserts ":" into completion of other languages

If company-frontend-distel is enabled with (require 'company-frontend-distel) I have an additional ":" in the completion of C/C++ projects. For example:

Suppose I have a struct:

struct C
{
    int x() { return 1; }
};

then later I declare an instance of C:
C c;
Using the suggested completion for c.x (pressing ENTER) will insert:
c.x:()

Disabling the distel frontend fixes the issue (and completion still works with the distel backend).

Thank you.

Melpa?

Hi,

Would you consider making company-distel a package on melpa.org?
Having to clone repositories into .emacs.d is really cumbersome especially in order to get updates or when setting up a new box.

auto-complete wont work

Hi

I am trying to use this plugin with auto-complete, but I cannot seem to figure out how.

I have added:
(require 'auto-complete-distel)
(setq ac-sources '(distel-completions))

to my config file, and I have made sure there is a connection between Emacs/distel and the erlang node. Both by pinging and by using distels M - Tab combination.

After some investigation, I see that emacs has not registered the function erl-ac-get-start, but the variable distel-completions is defined.

I have also tried to load auto-complete-distel.el manually, and it reports no errors.

Please let me know what information is needed.

Completion doesn't work

Hello.
I have some issue with company-distel.
All I do is:

  • Create new file
  • Open it
  • Try to complete something from lists module like lists:|

And in Messages buffer I see some strange errors (also without company-yasnippet):

Company: An error occurred in auto-begin
Company: backend (company-distel :with company-yasnippet) error "Args out of range: 1, 21" with args (candidates lists:)
Scanning for dabbrevs...done
Event: data
data: w�
arg: w�
nodedown: emacs@space-rocket
error in process filter: epmd-recv-port-resp: Assertion failed: (> (length arg) 2)
error in process filter: Assertion failed: (> (length arg) 2)

Note that after "data: w" and "arg: w" there's some symbol (^A), just for info.
I have latest distel from master branch, latest company-distel, emacs 24.5.1 on the Ubuntu 14.10 and following distel config:

(add-to-list 'load-path "~/.emacs.d/distel/elisp")
(require 'distel)
(distel-setup)

(defvar inferior-erlang-prompt-timeout t)
(setq inferior-erlang-machine-options '("-sname" "emacs"))
(setq erl-nodename-cache
      (make-symbol
       (concat
        "emacs@"
        (car (split-string (shell-command-to-string "hostname"))))))

(add-to-list 'load-path "~/.emacs.d/company-distel")
(require 'company-distel)
(require 'company)
(add-to-list 'company-backends '(company-distel :with company-yasnippet))

Maybe I'm doing something wrong?
Thank you a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.