-
-
Notifications
You must be signed in to change notification settings - Fork 44
add callback argument to lumo get-completions #81
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? No Sign in to your account
Conversation
Yes, the completions work, but arglists aren't appearing while scrolling the completion list via company. Could you test this and the other pull request I made, or look over it. I see that on lumo side, sometimes lumo gives wrong completions, there is to say, all possible completions, in my case after ) character. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be more clear and maybe correct to use a prn
or (print (pr-str ...))
here just to make clear that this is a callback that writes out. I was even wondering why it is working now..We pass an anonymous callback that returns a list...however the return of get-completions
is nil
. Is it? I am confused 😀
So the callback thing is a pain (notice the
|
That nil should go trough the elisp |
I'd solve it this way:
|
Very good! Agree, I update the pull request and use your snippet 😄 Besides the nested % sign, doesn't want to quote it against emacs |
Fixed. |
Are you commenting on the correct pull requests? This fixes it or you've fixed it? |
No sorry I have fixed the comment with the snippet, I cannot fix the PR 😄 |
This has another problem due to pretty printing, I will raise it in |
PR updated. |
As per the linked
Don't know if it matters actually, I haven't tried in |
@@ -726,7 +726,10 @@ If you are using REPL types, it will pickup the most approapriate | |||
(define-obsolete-variable-alias 'inf-clojure-completion-command 'inf-clojure-completion-form "2.0.0") | |||
|
|||
(defcustom inf-clojure-completion-form-lumo | |||
"(doall (map str (lumo.repl/get-completions \"%s\")))" | |||
"(let [ret (atom)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swap!
accepts a function, reset!
is better.
If you set it too:
(do (set! lumo.repl/*pprint-results* false) (let [hack (atom)] (lumo.repl/get-completions "redu" #(reset! hack (map str %))) @hack))
and squash all commits into one, we are good 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that and squash. But isn't this a bit mean to someone who wants to prettyprint the results when emacs is always setting it to false?
Uhm, Antonio suggested it but you are right, it is global...Maybe this is the moment when we introduce a post processing step to completion. First I would try if it works with multiline lists, if not we have a fn that makes everything single line but we need to introduce some glue for post processing.. |
There are functions that can do that, but as far as I see, it returns a list of strings which is read as emacs data, so newline should be irrelevant, in my company-mode completions, makes no difference. |
Ok I changed Little related @arichiardi , there's a bug in lumo
Otherwise I think @bbatsov can merge this now. |
LGTM |
lumo.repl/get-completions takes two arguments.
https://github.com/anmonteiro/lumo/blob/master/src/cljs/snapshot/lumo/repl.cljs#L1252
So I added map str function into the callback, now I'm getting completions suggestions from company-mode.
Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
M-x checkdoc
warningsThanks!