This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-18
Channels
- # aleph (7)
- # announcements (11)
- # beginners (186)
- # calva (17)
- # cider (26)
- # clj-kondo (4)
- # cljdoc (12)
- # cljs-dev (3)
- # clojars (1)
- # clojure (105)
- # clojure-berlin (1)
- # clojure-chicago (1)
- # clojure-dev (34)
- # clojure-europe (3)
- # clojure-italy (4)
- # clojure-nl (27)
- # clojure-russia (19)
- # clojure-uk (25)
- # clojuredesign-podcast (4)
- # clojurescript (54)
- # cursive (6)
- # data-science (1)
- # datascript (11)
- # datomic (5)
- # emacs (3)
- # events (2)
- # fulcro (13)
- # graalvm (5)
- # jobs (15)
- # leiningen (7)
- # luminus (3)
- # melbourne (1)
- # nrepl (1)
- # nyc (2)
- # onyx (4)
- # pathom (6)
- # pedestal (18)
- # re-frame (19)
- # reagent (10)
- # shadow-cljs (27)
- # spacemacs (32)
- # sql (11)
- # tools-deps (35)
- # vim (50)
mylanguage#get_async_completions
is the fireplace part of the code in their example. Their example is how to integrate mylanguage#get_async_completions
with asyncomplete
(e.g. the kind of thing I do in async_clj_omni)
@tpope does the cider-nrepl completion api even stream the results? It's been a while since I looked, but I don't think it does.
and i just think it's weird that asyncomplete would be like "just write a generic async completion function" and then make you jump through a bunch of hoops to use it. this could be a 1 liner!
@dominicm try fireplace#omnicomplete(function('callback'), fireplace#omnicomplete(1, ''))
on the asyncomplete branch
It's kinda frustrating that s:get_complete_context cannot be trivially rewritten to use a specified location rather than the cursor. e.g. for command line completion. It's only minor I guess, but it would be nice.
Ctrl-X Ctrl-O seems to be giving me a E745: Using a List as a Number
and not filtering the results.
Your example never gives me any hits, but fireplace#omnicomplete(function('callback'), 'yad')
does (filtering for "yad" typed in)
anyway, this is working an absolute treat with asyncomplete. I'll give it a test in the slow env.
I've hooked this up to a local change to async_clj_omni, and with asyncomplete this is really snappy, great! (and not much code either!).
I've introduced a (Thread/sleep 3000)
into cider-nrepl to observe the effects of delays on locking up:
diff --git a/project.clj b/project.clj
index 079a19d..2487431 100644
--- a/project.clj
+++ b/project.clj
@@ -1,4 +1,4 @@
-(defproject cider/cider-nrepl "0.21.1"
+(defproject cider/cider-nrepl "0.21.1-SLOWMO"
:description "nREPL middlewares for CIDER"
:url ""
:license {:name "Eclipse Public License"
diff --git a/src/cider/nrepl/middleware/complete.clj b/src/cider/nrepl/middleware/complete.clj
index 2a9e733..5a5d8e7 100644
--- a/src/cider/nrepl/middleware/complete.clj
+++ b/src/cider/nrepl/middleware/complete.clj
@@ -25,6 +25,7 @@
(jvm-complete/documentation (str symbol) (u/as-sym ns))))
(defn complete-reply [msg]
+ (Thread/sleep 3000)
{:completions (complete msg)})
(defn doc-reply
With this, I've observed that vim does lock up when using mucomplete. If I use Ctrl-X Ctrl-O
after disabling mucomplete and continue typing, it also locks up for 3s. So I feel confident that the omnicomplete isn't async.I think bfredl mentioned he'd introduced an asyncish implementation in his plugins, probably for julia
oh yeah, I mis-remembered what fireplace#omnicomplete(1, '')
did. you'll need to use that integer to extract the keyword from the current line
regarding the asyncish implementation by bredl: https://github.com/bfredl/nvim-ipy/blob/14d2399ead1d7cf9e8aa6cdbe6c7bf241be76026/rplugin/python3/nvim_ipy/__init__.py#L346-L357 he has a custom binding which he binds to C-f in his special repl buffer.
I have working local copies of async_clj_omni with ncm2 now also. ncm2 is a fairly major async completion plugin, so that should cover most things for most people.
if you mean it was happening on that branch just with the built-in completion, possibly, but the latest rebase i pushed up today is working fine for me
I'll give it another go. But yeah, I meant with built-in omnicompletion. Worked great for me 😛
As an aside, you can definitely remove the async code intended for use from Ctrl-X Ctrl-O.
does it also behave strange on master? afaik this branch only adds an async api, it shouldn't affect ctrl-x ctrl-o
Maybe it's something environmental. If you have it fine on 0.3.8 then it should be okay 🙂
https://github.com/clojure-vim/async-clj-omni/blob/master/autoload/async_clj_omni/sources.vim#L2-L8 stuff like this should be replaced with a call to fireplace#omnicomplete(1, '')
to get the column fireplace thinks it should start in
but it's not a guarantee. technically it should include '
in all but the first position. if i fix that your code will break
i guess it depends on the interface you have to implement though. the omni function is looking at the current line while it looks like asyncomplete passes in a typed
field?
Yeah, assuming that the regexs match the same thing then they are equivalent.
Yeah, asyncomplete etc. provides a 'typed'
field, and pretty much all the completion plugins do. coc.nvim seems to use \k\+
as an 'input'
field. I need to dig deeper to figure out if those are conveniences or if they're key to how the plugins work.
At the moment the only risk is that you will occasionally get/not get certain locals so I'm not too worried about the fireplace side. I am less worried about it because I understand it. coc.nvim is 40k lines of typescript, much harder to understand.
@dominicm is this the same as your issue? https://github.com/tpope/vim-fireplace/issues/353