jcollard / elm-mode

Elm mode for emacs
GNU General Public License v3.0
375 stars 67 forks source link

elm-oracle + eldoc? #77

Closed losingkeys closed 8 years ago

losingkeys commented 8 years ago

The title says it all. It'd be cool to see type signatures when near/inside of functions. This code almost does it:

 (add-hook 'elm-mode-hook                                                                               
    (lambda ()                                                                                                
      (set (make-local-variable 'eldoc-documentation-function)                                           
        'elm-oracle-type-at-point)))  

But needs to be cleaned up:

losingkeys commented 8 years ago

Thanks for working on this! Unfortunately I'm getting some confusing results: nil

diff

string

Though it does seem to work if you're right on the function: intersect

Bogdanp commented 8 years ago

@losingkeys I've fixed the prefixing issue, but I'm unable to reproduce the issue in your first screenshot. Can you try M-x toggle-debug-on-error RET and post the stack trace?

losingkeys commented 8 years ago

Here's the stacktrace:

Debugger entered--Lisp error: (void-function nil)
  nil()
  apply(nil nil)
  #[128 "\301\302\300!\"\207" [eldoc-documentation-function apply default-value] 4 "\n\n(fn &rest ARGS)"]()
  apply(#[128 "\301\302\300!\"\207" [eldoc-documentation-function apply default-value] 4 "\n\n(fn &rest ARGS)"] nil)
  #[128 "\300\301\"\206

The broken characters appear to be control characters. There are some ^Bs, ^Ks, ^@s, and others. Let me know if you need them exactly.

AlexKovalevych commented 8 years ago

Having probably a similar issue (GNU emacs 25.1 on OSX):

Debugger entered--Lisp error: (void-function string-empty-p)
  string-empty-p("Array.")
  elm-oracle--function-at-point()
  elm-oracle--completion-at-point()
  elm-oracle--type-at-point()
  elm-eldoc()
  apply(elm-eldoc nil)
  #[128 "\300\301\"\206\300\302\"\207" [apply elm-eldoc #[128 "\301\302\300!\"\207" [eldoc-documentation-function apply default-value] 4 "\n\n(fn &rest ARGS)"] nil] 4 nil]()
  eldoc-print-current-symbol-info()
  #[0 "\204  \205\n\303>?\205\304 \207" [eldoc-mode global-eldoc-mode eldoc-documentation-function (nil ignore) eldoc-print-current-symbol-info] 2]()
  apply(#[0 "\204    \205\n\303>?\205\304 \207" [eldoc-mode global-eldoc-mode eldoc-documentation-function (nil ignore) eldoc-print-current-symbol-info] 2] nil)
  timer-event-handler([t 0 0 750000 t #[0 "\204  \205\n\303>?\205\304 \207" [eldoc-mode global-eldoc-mode eldoc-documentation-function (nil ignore) eldoc-print-current-symbol-info] 2] nil idle 0])