Giter VIP home page Giter VIP logo

ac-nrepl's People

Contributors

bbatsov avatar deg avatar jsnikeris avatar kingtim avatar purcell avatar samaaron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ac-nrepl's Issues

java.lang.ClassNotFoundException thrown

When enter something like "clojure.repl/", java.lang.ClassNotFoundException exception will be thrown. Here is a patch to fix that:
(Sorry the formatting is all messed up. Basically, Just one line is changed on "when-let" clause)

((defun ac-nrepl-candidates-static-methods ()
  "Return static method candidates."
  (ac-nrepl-candidates*
   (ac-nrepl-filtered-clj
    "(let [prefix \"%s\"]
       (if-not (.contains prefix \"/\")
         '()
          (let [scope (symbol (first (.split prefix \"/\")))]
            (map (fn [memb] (str scope \"/\" memb))
                 (when-let [class (try (complete.core/resolve-class scope) (catch java.lang.ClassNotFoundException e nil))]
                   (complete.core/static-members class))))))  ")))

Error when completing string starting with a "/" character.

An exception is thrown in the REPL, when completing a string that begins with a "/" character.

; nREPL 0.1.3                                                                                   
user> (println "/t")

results in the following exception after waiting for auto-completion pop-up:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt (String.java:686)
clojure.lang.Compiler.maybeResolveIn (Compiler.java:6786)
clojure.core$ns_resolve.invoke (core.clj:3883)
clojure.core$ns_resolve.invoke (core.clj:3880)
clojure.core$resolve.invoke (core.clj:3889)
complete.core$resolve_class.invoke (core.clj:83)
complete.core$eval670$fn__671.invoke (core.clj:100)
clojure.lang.MultiFn.invoke (MultiFn.java:167)
complete.core$completions.invoke (core.clj:124)
user$eval713.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:6511)
clojure.lang.Compiler.eval (Compiler.java:6477)
clojure.core$eval.invoke (core.clj:2797)
clojure.main$repl$read_eval_print__6405.invoke (main.clj:245)
clojure.main$repl$fn__6410.invoke (main.clj:266)
clojure.main$repl.doInvoke (main.clj:266)
clojure.lang.RestFn.invoke (RestFn.java:1096)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__337.invoke (interruptible_eval.clj:51)
clojure.lang.AFn.applyToHelper (AFn.java:159)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:601)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1771)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:36)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__374$fn__376.invoke (interruptible_eval.clj:162)
clojure.core$comp$fn__4034.invoke (core.clj:2278)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__367.invoke (interruptible_eval.clj:129)
clojure.lang.AFn.run (AFn.java:24)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
java.lang.Thread.run (Thread.java:662)

on-demand pop-up documentation

https://gist.github.com/dffbc82d523cf575e3e7

I really like the popup documentation that ac-nrepl gives you, but I wanted to be able to invoke it on-demand rather than only just when I've been autocompleted (see gist). I'm not sure if this is something that makes sense as a feature of ac-nrepl itself (maybe it should go up to nrepl mode instead?) but I thought I'd send the gist your way.

No completion for unsourced namespace

I have a buffer with contents:

#_(ns test)
(Double/)

With point behind /, I get proper completion. Note that nothing has been sourced yet.

But if I uncomment the first form, I get Namespace not found error when I try to complete.
After sourcing, the problem disappears.

It's a bit of a nuisance, since at the point when I need completion,
the code isn't in the valid state. And I'm currently just editing
within org-babel source blocks, so I need to drop out of source block etc.

Documentation pop up text shows "^M" on Windows

Now the text will show fully in the pop up, but the end of line "^M" are still there. Can be fixed with an extra replace-regexp-in-string "\r" "".

(defun ac-nrepl-documentation (symbol)
"Return documentation for the given SYMBOL, if available."
(substring-no-properties
(replace-regexp-in-string "\r" "" ;; remove "^M" on Windows
(replace-regexp-in-string
"^( |-------------------------\r?\n)" ""
(plist-get (nrepl-send-string-sync
(format "(clojure.repl/doc %s)" symbol)
(nrepl-current-ns))
:stdout)))))

ac-nrepl-popop-doc causes "Wrong type argument"

If I attempt to display popup documentation with point on a thing for which there is nil documentation (e.g. a space) I get a strange message:

popup-tip: Wrong type argument: stringp, nil

Fix to follow...

empty newlines getting inserted on completion popup

Hi Steve,

if place the point at the bottom of a buffer, type "clojure.core$", and then press <UP>, 12 newlines get inserted. Only happens in clojure-mode, not emacs-lisp-mode et al.

I am able to reproduce the issue with a minimal configuration which is available here: http://github.com/vemv/emacs-minimal

The workaround I found is performing (setq ac-quick-help-height 0). If you can reproduce the issue, perhaps you'd be interested in incorporating this knowledge to the readme.

Thank you - Victor

*1 not getting bound

In my nrepl buffer, with ac-nrepl, *1 is not getting bound to the results of the last expression evaluated. Instead, it is always ().

More details on the nrepl forum at clojure-emacs/cider#200. There, we identified that the bug appears to be connected to ac-nrepl.

Fail run ac-nrepl in *nrepl* and clojure-mode buffers.

The error is:

java.lang.NullPointerException: 
               Reflector.java:296 clojure.lang.Reflector.invokeNoArgInstanceMember
                     core.clj:118 clj-stacktrace.core/parse-exception
                     repl.clj:106 clj-stacktrace.repl/pst-on
                     repl.clj:129 clj-stacktrace.repl/pst+
                  RestFn.java:408 clojure.lang.RestFn.invoke
                     Var.java:415 clojure.lang.Var.invoke
                 NO_SOURCE_FILE:2 user/eval7
               Compiler.java:6511 clojure.lang.Compiler.eval
               Compiler.java:6477 clojure.lang.Compiler.eval
                    core.clj:2797 clojure.core/eval
                     main.clj:245 clojure.main/repl[fn]
                     main.clj:266 clojure.main/repl[fn]
                     main.clj:266 clojure.main/repl
                 RestFn.java:1096 clojure.lang.RestFn.invoke
        interruptible_eval.clj:51 clojure.tools.nrepl.middleware.interruptible-eval/evaluate[fn]
                     AFn.java:159 clojure.lang.AFn.applyToHelper
                     AFn.java:151 clojure.lang.AFn.applyTo
                     core.clj:601 clojure.core/apply
                    core.clj:1771 clojure.core/with-bindings*
                  RestFn.java:425 clojure.lang.RestFn.invoke
        interruptible_eval.clj:36 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
       interruptible_eval.clj:164 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval[fn]
                    core.clj:2278 clojure.core/comp[fn]
       interruptible_eval.clj:131 clojure.tools.nrepl.middleware.interruptible-eval/run-next[fn]
                      AFn.java:24 clojure.lang.AFn.run
                 (Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.runTask
                 (Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run
                 (Unknown Source) java.lang.Thread.run

Intermittent error

From time to time I get an error looking like the below. Most of the time everything works fine, and I haven't been able to determine exactly what triggers the error. I am using nREPL 0.1.8-preview and ac-nrepl 20130420.929.

Debugger entered--Lisp error: (args-out-of-range 1 143)
count-lines(143 1)
popup-create(143 69 20 :min-height 0 :around t :margin-left nil :margin-right nil :scroll-bar nil :face popup-tip-face :parent nil :parent-offset nil)
popup-tip("clojure.core/take\n([n coll])\nReturns a lazy sequence of the first n items in coll, or all items if\nthere are fewer than n.\n" :point 143 :height 20 :min-height 0 :around t :parent nil :parent-offset nil :point 143 :height 20 :nowait t)
apply(popup-tip "clojure.core/take\n([n coll])\nReturns a lazy sequence of the first n items in coll, or all items if\nthere are fewer than n.\n" :point 143 :height 20 :min-height 0 :around t :parent nil :parent-offset nil (:point 143 :height 20 :nowait t))
popup-menu-show-quick-help([cl-struct-popup 143 8 0 10 10 nil 1 [#<overlay from 146 to 146 in core.clj> #<overlay from 147 to 147 in core.clj> #<overlay from 148 to 148 in core.clj> #<overlay from 149 to 149 in core.clj> #<overlay from 150 to 150 in core.clj> #<overlay from 151 to 151 in core.clj> #<overlay from 152 to 152 in core.clj> #<overlay from 153 to 153 in core.clj> #<overlay from 154 to 154 in core.clj> #<overlay from 155 to 155 in core.clj>](keymap %28mouse-5 . ac-mouse-5%29 %28mouse-4 . ac-mouse-4%29 %28down-mouse-1 . ac-ignore%29 %28mouse-1 . ac-mouse-1%29 %2819 . ac-isearch%29 %2816 . ac-previous%29 %2814 . ac-next%29 keymap %28C-up . ac-quick-help-scroll-up%29 %28C-down . ac-quick-help-scroll-down%29 %2867108927 . ac-help%29 %28M-f1 . ac-persist-help%29 %28f1 . ac-help%29 %28up . ac-previous%29 %28down . ac-next%29 %2827 keymap %2857 . ac-complete-9%29 %2856 . ac-complete-8%29 %2855 . ac-complete-7%29 %2854 . ac-complete-6%29 %2853 . ac-complete-5%29 %2852 . ac-complete-4%29 %2851 . ac-complete-3%29 %2850 . ac-complete-2%29 %2849 . ac-complete-1%29 %2816 . ac-quick-help-scroll-up%29 %2814 . ac-quick-help-scroll-down%29 %2867108927 . ac-persist-help%29 %28112 . ac-previous%29 %28110 . ac-next%29 %289 . auto-complete%29%29 %28return%29 %2813%29 %28tab . ac-expand%29 %289 . ac-expand%29) nil 0 ac-candidate-face ac-candidate-mouse-face ac-selection-face popup-summary-face 1 0 nil t t 0 0 0 0 (#("take" 0 4 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-nth" 0 8 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-last" 0 9 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-while" 0 10 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v"))) 9 nil (#("take" 0 4 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-nth" 0 8 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-last" 0 9 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-while" 0 10 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")))] nil :point 143 :height 20 :nowait t)
ac-quick-help()
apply(ac-quick-help nil)
byte-code("r\301�\302H�\303H"\210)\301\207" [timer apply 5 6] 4)
timer-event-handler([t 0 0 500000 0.5 ac-quick-help nil idle 0])
accept-process-output(nil 0.005)
nrepl-send-request-sync(("ns" "com.jayway.rps.core" "op" "eval" "session" "c6135125-2940-4693-bdaa-741f1e075b90" "code" "(require 'complete.core) (filter #(.startsWith % "ta")(complete.core/namespaces ns))"))
nrepl-send-string-sync("(require 'complete.core) (filter #(.startsWith % "ta")(complete.core/namespaces ns))" "com.jayway.rps.core" "c6135125-2940-4693-bdaa-741f1e075b90")
ac-nrepl-sync-eval("(require 'complete.core) (filter #(.startsWith % "ta")(complete.core/namespaces ns))")
ac-nrepl-candidates_("(filter #(.startsWith % "ta")(complete.core/namespaces *ns_))")
ac-nrepl-candidates-ns()
ac-candidates-1(((candidates . ac-nrepl-candidates-ns) (symbol . "n") (available . ac-nrepl-available-p) (candidate-face . ac-nrepl-candidate-face) (selection-face . ac-nrepl-selection-face) (prefix . ac-nrepl-symbol-start-pos) (document . ac-nrepl-documentation)))
ac-candidates()
ac-update(t)
ac-show-menu()
apply(ac-show-menu nil)
byte-code("r\301�\302H�\303H"\210)\301\207" [timer apply 5 6] 4)
timer-event-handler([t 0 0 400000 0.4 ac-show-menu nil idle 0])

No pop up document is showing

Hi -

I know this is a newbie question, but I have spend couple of days trying to figure this out and haven't been successful.

As the title says: auto-complete is not displaying popup-tip documentation while in clojure-mode, repl, or cider-mode. Here is my emacs configuration for clojure:

;----------------;
;;;  Clojure   ;;;
;----------------;

(require 'ac-nrepl)

(add-hook 'clojure-mode-hook 'paredit-mode)
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)

(add-hook 'cider-repl-mode-hook 'paredit-mode)
(add-hook 'cider-repl-mode-hook 'rainbow-delimiters-mode)
(add-hook 'cider-repl-mode-hook 'ac-nrepl-setup)

(add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
(add-hook 'cider-mode-hook 'ac-nrepl-setup)

(eval-after-load "auto-complete"
  '(add-to-list 'ac-modes 'cider-repl-mode))

(defun set-auto-complete-as-completion-at-point-function ()
  (setq completion-at-point-functions '(auto-complete)))
(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)

(add-hook 'cider-repl-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function)

(eval-after-load "cider"
  '(define-key cider-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc))

(provide 'clojure-settings)

However, auto-complete is working fine while in other modes, example: Emacs Lisp mode.

I have attached couple of screen shots:

  1. Auto complete not working in clojure-mode:
    screen shot 2014-10-14 at 6 57 51 pm

  2. Auto complete working in any other mode:
    screen shot 2014-10-14 at 7 00 22 pm

I think, I have followed the directions correctly, and have spent some trying to figure it out. But, now its just getting to the point of being frustrating.

I hope you can help me with this issue.

Thanks,
Sagun

Solved: ac-nrepl installed via package.el doesn't work because `cider-0.1' is unavailable

Putting this here for future users who hit the same issue.

If you see the following on emacs startup.

Warning (emacs): Unable to activate package `ac-nrepl'.
Required package `cider-0.1' is unavailable

and ac-nrepl does not work after following the setup instructions, you
might have a broken package.el lying about (if you've upgraded from emacs 23
to emacs 24 and have stuff lying around ~/.emacs.d)


an updated package.el is bundled in emacs 24, try locating and removing
stale copies of it in ~/.emacs.d and restarting emacs.

Long docstrings in ac-nrepl-popup-doc get cut off

If a clojure form has a docstring consuming a lot of lines (I used proxy as an example here), ac-nrepl-popup-doc is unable to show all of it. Since the popup is not navigable, this means the part of the docstring that is cut off is inaccessible.

Screen Shot 2013-02-26 at 13 11 07

ac-nrepl displays nothing, java hogs cpu

I have a strange reproducable behaviour where ac-nrepl display nothing and java hogs up cpu.

Steps to reproduce

  1. create a fresh project with lein
  2. open emacs and open core.clj
  3. startup nREPL via C-c M-j (focus is now in nREPL)
  4. switch back to core.clj
  5. invoke C-c M-n to switch namespace in nREPL to your project namespace
  6. switch to nREPL
  7. type "(def"

ac-nrepl should now popup after a while but it doesn't. Java runs up to 100% on one core.

additonal steps / info (not sure if relevant)
  1. switch back to core.clj

  2. C-c C-k to compile, the following stacktrace show up in nREPL:

    clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: if-let in this context, compiling:(NO_SOURCE_PATH:1:1)
    at clojure.lang.Compiler.analyze (Compiler.java:6380)
    clojure.lang.Compiler.analyze (Compiler.java:6322)
    clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3573)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6562)
    clojure.lang.Compiler.analyze (Compiler.java:6361)
    clojure.lang.Compiler.analyze (Compiler.java:6322)
    clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5708)
    clojure.lang.Compiler$FnMethod.parse (Compiler.java:5139)
    clojure.lang.Compiler$FnExpr.parse (Compiler.java:3751)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6558)
    clojure.lang.Compiler.analyze (Compiler.java:6361)
    clojure.lang.Compiler.eval (Compiler.java:6616)
    clojure.lang.Compiler.eval (Compiler.java:6582)
    clojure.core$eval.invoke (core.clj:2852)
    clojure.main$repl$read_eval_print__6588$fn__6591.invoke (main.clj:259)
    clojure.main$repl$read_eval_print__6588.invoke (main.clj:259)
    clojure.main$repl$fn__6597.invoke (main.clj:277)
    clojure.main$repl.doInvoke (main.clj:277)
    clojure.lang.RestFn.invoke (RestFn.java:1096)
    clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__589.invoke (interruptible_eval.clj:56)
    clojure.lang.AFn.applyToHelper (AFn.java:159)
    clojure.lang.AFn.applyTo (AFn.java:151)
    clojure.core$apply.invoke (core.clj:617)
    clojure.core$with_bindings_STAR_.doInvoke (core.clj:1788)
    clojure.lang.RestFn.invoke (RestFn.java:425)
    clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:41)
    clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__630$fn__633.invoke (interruptible_eval.clj:171)
    clojure.core$comp$fn__4154.invoke (core.clj:2330)
    clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__623.invoke (interruptible_eval.clj:138)
    clojure.lang.AFn.run (AFn.java:24)
    java.util.concurrent.ThreadPoolExecutor.runWorker (:-1)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (:-1)
    java.lang.Thread.run (:-1)

configuration
  • emacs 24.3.1
  • Windows 7 64 bit
  • JRE 7 64 bit
  • latest versions of ac-nrepl, autocomplete, nrepl, clojure-mode, popup via melpa
minimal init.el which triggers behaviour

;; startup package initialization early
;; disable loading packages after startup (again)
(setq package-enable-at-startup nil)
(package-initialize)

;; auto-complete
(require 'auto-complete-config)
(ac-config-default)

;; ac-nrepl
(require 'ac-nrepl)
(add-hook 'nrepl-mode-hook 'ac-nrepl-setup)
(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
(eval-after-load "auto-complete" '(add-to-list 'ac-modes 'nrepl-mode))

ac-nrepl perceptibly slow. Any way to speed up?

With ac-nrepl on, I notice a delay in responsiveness as I type.
The reason, I think, could be that it tries to talk to nrepl as I type,
and nrepl doesn't respond fast enough.

I've got ac-delay on 0.1s, and it works great for e.g. ac-source-words-in-same-mode-buffers or elisp stuff.

Is it possible to have ac-delay on 0.1s for fast sources, and 0.5s for ac-nrepl sources?

Is it possible to choose to cache all completions and not to talk to nrepl at all?
Or, even better, start talking to nrepl only after a custom period of inactivity?

The documentation is not showed in full in pop-ups

e.g. for def, the pop-up shows:

 Please see http://clojure.org/special_forms#def 

but (doc def) returns:

def
  (def symbol doc-string? init?)
Special Form
  Creates and interns a global var with the name
  of symbol in the current namespace (*ns*) or locates such a var if
  it already exists.  If init is supplied, it is evaluated, and the
  root binding of the var is set to the resulting value.  If init is
  not supplied, the root binding of the var is unaffected.

  Please see http://clojure.org/special_forms#def

Is it possible to use ac-nrepl with ritz?

Hi purcell, I use your emacs.d for setting up clojure developing environment and it is awesome :-)
Recently I find ritz is powerful and maybe a good enhencement of nrepl.
The problem is after I use nrepl-ritz-jack-in, ac-nrepl do not work.
But, after I start a new server by nrepl-jack-in and switch back to the ritz server buffer, ac-nrepl partially works(e.g. popup the choice list but not consist of all candidates).
So, I wander is it possible to use ac-nrepl with ritz?

ac-source-nrepl-vars conflict with yasnippet?

I am using yasnippet along with auto complete and ac-nrepl.

When I start a fresh emacs session, open my .clj file, type something like def, I see bunch of normal candidates and highlighted yasnippet's target. I can then tab to complete or ret to call yas-expand.

However, I noticed that after I start nrepl, and evaluate the (ns ...) form of my clj file, I can no longer see yasnippet's target in auto-complete lists.

I than found out that if I comment out (add-to-list 'ac-sources 'ac-source-nrepl-vars)
in ac-nrepl-setup , the yasnippet's target appears again.

Remove eval'd clojure code in favor of cider's cider-dispatch-complete-symbol

https://github.com/clojure-emacs/cider/blob/master/cider-interaction.el#L582

This falls back to eval if not present, but will now rely on the presence of the 'complete' nrepl op, which also works with clojurescript repls.

Backend impl is here:
https://github.com/gtrak/cider-nrepl/blob/master/src/cider/nrepl/middleware/complete.clj

Company mode is doing something similar:
https://github.com/clojure-emacs/company-cider/blob/master/company-cider.el#

Seems sensible to me since ac-nrepl's already relying on cider.

nrepl.el needs huge amounts of time to do autocompletion

Using the latest nrepl.el and ac-nrepl packages from marmelade and with [org.clojure/tools.nrepl "0.2.2"] in my ~/.lein/profiles.clj, ac-nrepl will freeze whenever an autocomplete happens (triggered or automatic), freezing the nrepl/emacs UI along with it (without using extra CPU time I might add, and the rest of the system remains completely responsive).

The problem here is the 10+ secs it takes to do one autocomplete, not only making the feature defeat its own purpose, but effectively disabling proper typing in nrepl.el because of the automatic autocompletes while ac-nrepl is activated. This issue disappears on disabling ac-nrepl, prompting me to open an issue here as opposed to in nrepl.el.

The nrepl server is not on localhost, but on an android device I own, though that shouldn't be a problem as it never has been in the past.

In case it helps (TBH I don't really know if it's related), I found this entry in my Messages buffer when the latest AC was done:
Error in timer: (wrong-type-argument arrayp nil)

Namespace hint gets expanded into the code

A sequence of (.l auto-complete e gives:

.length [java.lang.String]
.length [java.lang.CharSequence]
.length [java.lang.StringBuffer]
.length [java.lang.StringBuilder]

Which is fine, but starting completion from (.le gives:

(.length [java.lang.

instead of just expanding to (.length.

ac-nrepl appears to break nrepl-enable-on-existing-clojure-buffers

There's some discussion about this issue here: clojure-emacs/cider#168

Where the issue is finally tracked down to some kind of interaction between the two hooks registered for nrepl-connected-hook.

When ac-nrepl's hook comes first and nrepl-connected-hook has the value: (ac-nrepl-refresh-class-cache nrepl-enable-on-existing-clojure-buffers), the second hook doesn't seem to get called (or at least doesn't have the desired effect).

If I manually reverse the order of the callbacks via (setq nrepl-connected-hook (reverse nrepl-connected-hook)) all works OK.

Not sure if this is ac-nrepl's or nrepl's fault, but suspect the former -- any ideas?

Cheers

ac-nrepl makes auto-complete very slow

My configuration of auto-complete is like this:

(setq ac-auto-start 3)
(setq ac-auto-show-menu .8)

so It will pop up completion menu automatically.but If I enable the sources provide by ac-nrepl, the auto-complete becomes very slow. Any solution to improve the performance?

Emacs crashes on displaying docstring

Sporadically, Emacs crashes horribly on autocompleting the docstring of a Clojure var :-(

It's hard to figure out what's happening as I don't get a stacktrace or any other useful information, other than seeing Emacs just die.

I believe it's when the docstring is autocompleted due to the timing of the crash, but it's not completely obvious that this is the case - it's just something that appears to be the case.

To reproduce this, I just fire up nrepl within Emacs, and then type (re and let it autocomplete to ref and then wait for the docstring to appear. If the docstring appears, it didn't crash, so I simply delete the e and retype it and see if it crashes. Rinse and repeat till it crashes. It's not a consistant number of times before a crash - it appears to be nondeterministic.

I have observed the following behaviours:

  • Autocompletes var, autocompletes docstring
  • Autocompletes var, doesn't display docstring
  • Autocompletes var, crashes

This is on a Mac running with the latest nrepl.el and latest ac-nrepl.el.

If there's anything I can do to help shed some light on this, please let me know.

Documentation pop up text not right on Windows

Because of those Linux style line endings in the text (I am really annoyed that Clojure cannot get the doc text right across platforms. Not ac-nrepl's fault)

I just changed ac-nrepl-documentation function to the following:

(defun ac-nrepl-documentation (symbol)
"Return documentation for the given SYMBOL, if available."
(substring-no-properties
(replace-regexp-in-string "\r" "" ;; Fix Linux style line-ending on Windows
(replace-regexp-in-string
"^( |-------------------------\n)" ""
(plist-get (nrepl-send-string-sync
(format "(clojure.repl/doc %s)" symbol)
(nrepl-current-ns))
:stdout)))))

That fixed the issue on Windows. I did not test if the above will break on Linux.

ac-nrepl does work on the REPL buffer, but not on .clj buffers

This could be a configuration issue, but I have set up ac-nrep according to the instructions and although it works well for nrepl buffers, it ails on any clojure file.

The failure is:

  • The list of symbols is not complete, e.g. "clojure.set/" only shows "clojure.set/difference" and "clojure.set/intersection" as completions, but it should list "clojure.set/difference" "clojure.set/index" "clojure.set/intersection" "clojure.set/join" "clojure.set/map-invert" "clojure.set/project" "clojure.set/rename" "clojure.set/rename-keys" "clojure.set/select" "clojure.set/subset?" "clojure.set/superset?" "clojure.set/union"
  • The documentation is not shown for any symbol

Exception when pulling the documentation for a namespace

When trying to complete something like clojure.set, the nrepl process will show this exception:

java.lang.ClassNotFoundException: clojure.set
 at java.net.URLClassLoader$1.run (URLClassLoader.java:202)
    java.security.AccessController.doPrivileged (AccessController.java:-2)
    java.net.URLClassLoader.findClass (URLClassLoader.java:190)
    clojure.lang.DynamicClassLoader.findClass (DynamicClassLoader.java:61)
    java.lang.ClassLoader.loadClass (ClassLoader.java:306)
    java.lang.ClassLoader.loadClass (ClassLoader.java:247)
    java.lang.Class.forName0 (Class.java:-2)
    java.lang.Class.forName (Class.java:247)
    clojure.lang.RT.classForName (RT.java:2039)
    clojure.lang.Compiler.maybeResolveIn (Compiler.java:6789)
    clojure.core$ns_resolve.invoke (core.clj:3883)
    clojure.core$ns_resolve.invoke (core.clj:3880)
    clojure.core$resolve.invoke (core.clj:3889)
    clojure.repl$doc.invoke (repl.clj:128)
    clojure.lang.Var.invoke (Var.java:423)
    clojure.lang.AFn.applyToHelper (AFn.java:167)
    clojure.lang.Var.applyTo (Var.java:532)
    clojure.lang.Compiler.macroexpand1 (Compiler.java:6366)
    clojure.lang.Compiler.macroexpand (Compiler.java:6427)
    clojure.lang.Compiler.eval (Compiler.java:6495)
    clojure.lang.Compiler.eval (Compiler.java:6477)
    clojure.core$eval.invoke (core.clj:2797)
    clojure.main$repl$read_eval_print__6405.invoke (main.clj:245)
    clojure.main$repl$fn__6410.invoke (main.clj:266)
    clojure.main$repl.doInvoke (main.clj:266)
    clojure.lang.RestFn.invoke (RestFn.java:1096)
    clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__609.invoke (interruptible_eval.clj:51)
    clojure.lang.AFn.applyToHelper (AFn.java:159)
    clojure.lang.AFn.applyTo (AFn.java:151)
    clojure.core$apply.invoke (core.clj:601)
    clojure.core$with_bindings_STAR_.doInvoke (core.clj:1771)
    clojure.lang.RestFn.invoke (RestFn.java:425)
    clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:36)
    clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__646$fn__648.invoke (interruptible_eval.clj:162)
    clojure.core$comp$fn__4034.invoke (core.clj:2278)
    clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__639.invoke (interruptible_eval.clj:129)
    clojure.lang.AFn.run (AFn.java:24)
    java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:886)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    java.lang.Thread.run (Thread.java:680)

Just not working, how to debug ?

Hello, i installed everything as described, "AC" and "nREPL" modes enabled, but no signs of popups or something similar, how to debug what is wrong ?

init.el:

;; autocomplete
(add-to-list 'load-path "/.emacs.d") ; This may not be appeared if you have already added.
(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-dictionary-directories "
/.emacs.d/ac-dict")
;; nrepl
(require 'ac-nrepl)
(add-hook 'nrepl-mode-hook 'ac-nrepl-setup)
(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
(eval-after-load "auto-complete"
'(add-to-list 'ac-modes 'nrepl-mode))

nrepl.el needs huge amounts of time to do autocompletion

Using the latest nrepl.el and ac-nrepl packages from marmelade and with [org.clojure/tools.nrepl "0.2.2"] in my ~/.lein/profiles.clj, ac-nrepl will freeze whenever an autocomplete happens (triggered or automatic), freezing the nrepl/emacs UI along with it (without using extra CPU time I might add, and the rest of the system remains completely responsive).

The problem here is the 10+ secs it takes to do one autocomplete, not only making the feature defeat its own purpose, but effectively disabling proper typing in nrepl.el because of the automatic autocompletes while ac-nrepl is activated. This issue disappears on disabling ac-nrepl, prompting me to open an issue here as opposed to in nrepl.el.

The nrepl server is not on localhost, but on an android device I own, though that shouldn't be a problem as it never has been in the past.

In case it helps (TBH I don't really know if it's related), I found this entry in my Messages buffer when the latest AC was done:
Error in timer: (wrong-type-argument arrayp nil)

.emacs slowdown

I find that (require 'ac-nrepl) pretty slows down the loading of .emacs (probably because it's dragging clojure/cider related dependencies at an early stage). Maybe it's better to suggest a "hooked" alternative as the preferred way to configure ac-nrepl.

Emacs freezes on displaying docstring

Now I'm starting to see Emacs freeze on autocompleting stuff.

I see the following Clojure stacktrace, and Emacs hangs. I assume that Emacs is waiting for a reply from the Clojure process which isn't being received due to this error. If this is the case, perhaps it's worth looking into adding timeouts to the synchronous comms?

Exception in thread "nREPL-worker-1" java.lang.NullPointerException
    at clojure.core$refer.doInvoke(core.clj:3775)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_lib.doInvoke(core.clj:5252)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5271)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:604)
    at clojure.core$use.doInvoke(core.clj:5363)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.main$repl.doInvoke(main.clj:258)
    at clojure.lang.RestFn.invoke(RestFn.java:1096)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__337.invoke(interruptible_eval.clj:51)
    at clojure.lang.AFn.applyToHelper(AFn.java:159)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at clojure.core$apply.invoke(core.clj:600)
    at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1769)
    at clojure.lang.RestFn.invoke(RestFn.java:425)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:36)
    at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__374$fn__376.invoke(interruptible_eval.clj:164)
    at clojure.core$comp$fn__3758.invoke(core.clj:2276)
    at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__367.invoke(interruptible_eval.clj:131)
    at clojure.lang.AFn.run(AFn.java:24)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)

Hangs caching JVM class names

I've noticed lengthy slowdowns before while ac-nrepl is 'caching JVM class names', but recently found a show-stopper where this hangs indefinitely (I just left it overnight) after adding "(use 'clj-stacktrace.repl)" to :repl-options :init in my .lein/profiles.clj.

Not sure whether this is ac-nrepl's fault or clj-stacktraces (so I opened mmcgrana/clj-stacktrace#18 too), but in general it might be good to put some kind of timeout or limits on this caching business, or do it in a separate thread (no idea if this is possible!) since it seems to block the emacs UI pretty severely with a killall emacs24 being the only way I found to interrupt it.

(If it's doing something recursive, perhaps it needs some recursion depth limit or cycle avoidance logic?)

Support company-mode?

There is useful, non-ac-dependent code here that I'd rather not duplicate in a separate package. How should I go about using it in an nrepl completion back-end for company-mode, without forcing the users to install auto-complete (even automatically)?

I suggest removing the hard dependency, or extracting all non-ac-specific bits to another package (nrepl-mode?).

Pushing the Clojure code upstream might be an alternative, as suggested in #15.

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.