This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-29
Channels
- # announcements (35)
- # aws (40)
- # babashka (10)
- # beginners (119)
- # calva (25)
- # cider (13)
- # clj-kondo (15)
- # cljsrn (23)
- # clojure (205)
- # clojure-dev (3)
- # clojure-europe (15)
- # clojure-germany (3)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-uk (58)
- # clojurescript (193)
- # community-development (2)
- # conjure (147)
- # core-async (49)
- # cursive (47)
- # datomic (27)
- # duct (1)
- # fulcro (19)
- # graalvm (3)
- # graphql (1)
- # helix (3)
- # hoplon (11)
- # jackdaw (1)
- # joker (1)
- # juxt (5)
- # kaocha (1)
- # keechma (3)
- # lambdaisland (6)
- # local-first-clojure (27)
- # malli (5)
- # off-topic (41)
- # rdf (27)
- # re-frame (7)
- # reagent (15)
- # reitit (5)
- # rum (11)
- # shadow-cljs (157)
- # spacemacs (18)
- # sql (4)
- # xtdb (8)
Okay, it probably needs some severe testing... but... I kinda did some black magic hackery, deleted a bunch of code and got a best of both worlds scenario for stdout / stderr output.
So now if you (print ...)
(no trailing newline) and flush, you'll see that output RIGHT away. No delay or batching. Then if you (println ...)
something else it'll still end up on the end of that same line.
The code is less complex and stateful than before but it works better and has no batching or delay to the output.
@dominicm Thanks for the nudge towards keeping it immediate, was worth the thought! It only took a morning and a coffee. Going to reward myself with a second one.
https://asciinema.org/a/QOngmPWoK3NkQmuDLrgdLtdb6 check it ouuuut π
It's so live you can animate a progress bar, hah! https://asciinema.org/a/kWZBUArB1q8hvavQl6pTxGkGJ
Trimming the log will now avoid cutting forms in half at all costs. So if your log gets REALLY long, it'll always avoid cutting a form now. It used to try to but then sometimes give up if there wasn't a good cutting point. Now it'll let the log grow until it can cut it down safely between your eval results.
Improved Deoplete support to make it actually async, blocking the Python process rather than your Neovim. Will do the same with CoC.
The blocking part relies on a thing in Neovim that allows events to continue in the background, it's just your input that gets slowed down. I'll make it completely async now.
Also no idea how to get var args other than slicing around with arguments
, maybe there's a less awful way these days.
i'll be damned: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters
Yeah, I expected something to exist but to only work in Chrome v247 on a Tuesday with some flag enabled.
Published [email protected]
which is truly async.
I assume CoC uses your local node version, so if it doesn't support async await I don't think coc-conjure will work :thinking_face: might need rewriting at some point to use plain old promises
Which also won't work in some versions of node, so may need a promise shim at some point too?
i don't think there would be anything wrong with documenting that coc-conjure requires node 8+
@matthew.newland I've changed the Deoplete and CoC completion support to be truly async, I didn't realise the method I mentioned before was blocking (although it allowed some events to continue in the background of Neovim which is nice)
Deoplete now looks like this: https://github.com/Olical/conjure/blob/25b27d65d4ecb1fdf2f84d0b91ce067706211560/rplugin/python3/deoplete/sources/conjure.py
And CoC like this: https://github.com/Olical/coc-conjure/blob/e34413be524a38a589a510b0d3eb6cd1195cb97a/index.js
All you have to do is call completions-promise
(as you have been) then call done?
on the result until it's true with a delay between. With Python and Node I can pause execution before making another check, asynccomplete can't do this since it's in process.
I'm under the impression you can implement a completer with a callback though? So if you want to get it fully async, all you need to do is work out how that callback based interface works and then have some vim timer (built in) call your check function repeatedly until the promise is done. Then give the result of calling close
to the callback of asyncomplete.
This isn't essential but it's the change you'd need to make to get it completely async. I have no idea how you use the callback interface for asyncomplete, I just read about it.
Ah, I see. So you'd start by calling conjure.eval's completions-promise and capturing that result.
Then you do some sort of timer loop (there's a function for this in nvim) to check conjure.promise's done?
function until it returns true.
Then you call asyncomplete#complete
with the result of conjure.promise's close function. A bit like the three step one you had before.
Cheers @olical. I will take a look at your CR and your comments here.
i'm working on our integration tests repo now using the "eval at mark" feature. it's so good! and the HUD experience makes it so much better
Yesss so glad to hear that! And now eval at mark doesn't flicker to the code it's evaluating, it all happens behind the scenes thanks to Lua land.
Will there be a write up on how to get all the various parts to work nicely? i.e., coc + aysnc + neovim + conjure?
I'm just trying to get all the docs there in :help for now, then build on that with more prose.
Really though it's: Start regular CIDER nREPL (LOADS of resources out there for this), open Clojure file. Start typing.
Plug 'Olical/conjure', { 'branch': 'master', 'do': 'bin/compile', 'for': 'clojure' }
Plug 'eraserhd/parinfer-rust', {'do': 'cargo build --release', 'for': 'clojure'}
Plug 'guns/vim-clojure-highlight', {'for': 'clojure'}
Plug 'guns/vim-clojure-static', {'for': 'clojure'}
Plug 'guns/vim-sexp', {'for': 'clojure'}
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'tpope/vim-sexp-mappings-for-regular-people', {'for': 'clojure'}
i don't claim to 100% know what i'm doing, but it's nice to know that someone else has independently arrived at the same conclusion π
And then you need to configure coc to use https://github.com/jlesquembre/coc-conjure (I've published the dev version as coc-conjure-olical
)
You don't need it, but if you want CoC to complete over your Conjure connection you need to install it.
It's all still a black magic art about which plugin to isntall and what mappings/vars to set for them all to work
So all you should need is Conjure, then you get omnicomplete. You just need to add further plugins if you want async complete as you type since Vim doesn't support that out of the box.
Is there something in the Conjure specific stuff that's highly confusing then? Or like Clojure in Neovim in general?
Because once Conjure (develop) is out I'll write up a post for how I set up Neovim for Conjure from scratch maybe :thinking_face:
It's more Clojure and Neovim. Of course, my chosen plugin is Conjure, so it is related. it's FOMO, perhaps I'm not having the most optimal experience because I've got a plugin enabled that I don't need or a plugin that I'm missing...
Fair enough! I think moving from things like fireplace means you get stuck with things like clojure-vim/async-clj-omni. I don't think you need much at all, the baseline is quite simple, it's what you want to add later that gets interesting. I'll write about it at some point to try and clear some things up π
Almost finished updating the asyncomplete plugin by @matthew.newland to be completely async. I gave the wrong instructions before. So that means you'll have three good options for complete async completion.
Learning some vimscript while I'm at it... https://stackoverflow.com/questions/18409014/pass-local-variables-to-a-function-created-inside-eval-ie-closures-in-viml/18412199
@matthew.newland I did the fully async changes for you https://github.com/thecontinium/asyncomplete-conjure.vim/pull/1 π
Alright, my brain is pretty fried now, time for some video games and water π more progress! Next task on my list is "release", so if anyone can break the new Conjure, please let me know! π
let g:coc_global_extensions = ['coc-conjure', 'coc-json', 'coc-yaml', 'coc-dictionary']
Wonderful! π (considering how much code I changed I'm very pleasantly surprised everything worked so well)
Where can I get docs on connecting Conjure to Shadow-cljs
Basically shadow + prepl never worked well and requires a LOT of work to get it working properly. I've instead rewritten Conjure and based it on nREPL. It works better in basically every way, easier to start and use too imho.
If you start a shadow-cljs server and open a CLJS file with the new Conjure (develop branch) installed, it'll automatically connect.
https://github.com/Olical/conjure/tree/develop should have all the info you need.
Add it as a plugin (no bin/compile
required anymore!), start a shadow-cljs server with nREPL (that's documented on the shadow site), open a ClojureScript file, run :ConjureShadowSelect my-app-name
, evaluate forms with <localleader>ee
and get autocompletion! π
:help conjure
and :help conjure-client-clojure-nrepl
for all the keys and config you can do.
Did you have to drop support for prepl?
ah, I see your note about a rewrite
Yes, they are COMPLETELY different things. nREPL + (optional) CIDER saves me about 6 months - 2 years worth of work π
I'm going to add a prepl based Clojure module you can swap in eventually though. It won't be as smart but it'll let you do some useful things!
Whats the reason for dropping prepl? Not enough support?
The new Conjure is a framework of "I want to run some code" with modules that handle how that happens. Which means it'll support multiple network REPL systems and languages.
Gotcha
Well, this is hands down the best clojure setup Iβve ever used
Well thank you! I really hope you'll like the rewrite more, it's just more of the same. Sped up, stream lined, extra JVM removed, more languages supported.
I would highly recommend using the new one since I'm going to be releasing it within a week or so π
prepl is a lovely concept (built in socket REPL for tools) it's just so inconsistent and broken between CLJS and CLJ. There's no way I could ever get completion working in CLJS for example, the new Conjure has it working out of the box.
I was on the edge of writing my own prepl as a dependency you had to add, then we're back to nREPL and reinventing the wheel. So I jumped on the bandwagon and the bandwagon is good.
Just ask if you have any questions! Trying to get people up and running and giving me feedback on the develop UX π
Autocompletion not working, any idea? <C-x><C-o> isnβt working either
worked fine on the master branch
If it's regular Clojure, you need to add the CIDER middleware to get all the goodies like go-to-def and autocompletion at the moment.
I added cider-nrepl to deps.edn, and go-to-def works but not completion
Oh interesting! That sucks :thinking_face: and this is regular Clojure, not ClojureScript?
CLojurescript
(I don't think anyone else has encountered that yet, so I'm trying to think of what could interfere with it)
Seems I need to configure the middleware in shadow
if it works i can submit a PR to you with an example
Sure, of course! I don't have anything shadow related in my repo though other than test code.
https://github.com/Olical/conjure/blob/develop/shadow-cljs.edn this config might help
There's an update coming for nREPL (without CIDER) that's going to enable simple completion without the middleware. So that'll be fun!
We get to benefit from all the work on nREPL and CIDER that all of the tool authors contribute. Should be good π
Trying to get a browser-repl connected in Vim.
oooo, interesting workflow that the new conjure allows. I'm working on transforming data from one big map to another. I have the original data in one conjure log split (that doesn't scroll because my cursor is not at the bottom) and have another log split to see the results of my function calls (that does scroll). Then I can reference the old while making the new.