conjure

Interactive evaluation for Neovim (Clojure, Fennel, Janet, Racket, Hy, MIT Scheme, Guile, Python and more!)

UNLICENSE License

Stars
1.7K

Bot releases are visible (Hide)

conjure - Internal tweaks and virtual text clearing improvements

Published by Olical about 5 years ago

Hello! I hope you're having a good week!

I've been using develop for a while at work and I'm happy with the behaviour so I thought I'd cut a release ahead of my work on more testing and "hooks" which should allow everyone to "hook" into things like REBL to display evaluation results via some simple configuration!

  • @daveyarwood improved the wording of the message you see if Conjure exits with an unexpected error code.
  • I've removed medley as a dependency of Conjure's internal JVM, this might help startup time a tiny tiny bit, I only needed the deep-merge function from there anyway.
  • The Deoplete integration should handle restarts of Conjure's JVM now, which shouldn't happen unless things are exploding anyway, so hopefully you won't notice this one.
  • Internal refactoring so that I can re-eval Conjure's internal RPC handling functions without restarting the whole thing.
  • More refactoring so that the code to generate code to look up definitions for "go to definition" is implemented in terms of templated Clojure data, rather than string templates. This means there are no more string templates in conjure.code 😄
  • Changed virtual text so the clearing is more aggressive, the commit explains it a little.
commit 85d6d83deb94cc580df2f1979043244fdef2638a
Author: Oliver Caldwell <[email protected]>
Date:   Sun Sep 22 16:02:06 2019 +0100

    Make virtual text clearing more aggressive
    
    So if you're not using any of the quick_doc tools it should still stay
    clean. As long as you move your cursor around it should clear off that
    pesky hanging virtual text.
    
    This opens up more possibilities into virtual text information such as
    progress of dependency injection.

 plugin/conjure.vim | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
  • Capped hunting for a namespace name in a buffer, this should prevent massive buffers from causing the cursor to lag slightly (I mean 5k+ lines). There's still work to be done here to make the log buffer work a lot better when it's huge.
  • Skip host+port combinations we're already connected to. So if you have some global config to connect to localhost:5555 and some project local config for the same, you won't get two connections. This prevents your evaluations from happening twice, the first connection will win.

With that last change, I was hitting the edge case at work where I had two configurations looking for a .prepl-port file, both were finding the same file and connecting to the same port. I think this behaviour is undesired, so I removed it. Hopefully it's the right call.

Next up on my to do list is a bunch more unit and integration testing to give us some robustness in the face of changes and work on "hooks". The next update will probably be slightly breaking for those of you using the tools namespace refresh configuration, but it's for the best, I promise.

Have a great rest of your day and week!

image

conjure - Show source and ConjureEval completion

Published by Olical about 5 years ago

@justone has added "view source" through a PR! 🎉 thanks a lot, Nate! You can now hit <localleader>ss (by default) and see the source for the symbol under your cursor in the log buffer.

There's some oddities around it not working on the symbol if you've reevaluated it without loading the file from disk but they're easy enough to work around. Maybe someone would like to look into patch up those issues...

I've also added :ConjureEval completion, so as you're typing code to be evaluated you can tab complete as if you had omnicompletion. This was suggested through #conjure on Slack.

I've also fixed an error around Conjure's exit code if it gets SIGTERMed, it's now cool with that method of death. I think in the latest Neovim update (0.4) they changed how processes get killed on quit which causes some weird log output from Conjure that thought it was being helpful.

As an aside, Neovim now has floating windows! I think there will be a lot of usage of those in Conjure in the future and most of the virtual text (for things like doc) will get replaced by them. We'll see!

conjure - Smarter dep injection, better remote prepl tools

Published by Olical about 5 years ago

Smarter dep injection

Self prepling should be somewhat quicker now, so if you open a Clojure file within any random directory where no prepls are configured and running you can get to evaluating a little quicker.

This is due to some internal refactoring around how dependencies are managed and injected.

Better remote prepl tools

I've improved how paths work within Conjure for evaluations and go to definition. This means that when you're prepled into a Docker container or remote machine that doesn't share your file system structure you'll still be able to go to definition on symbols, it'll find the file local to your computer that matches a part of the path.

Evaluations will also set the "source file" in the meta data of symbols to a relative path so as not to break other tools in the ecosystem if you're sharing a REPL environment with anyone else.

This works by taking absolute paths and successively removing parts from the front until we find a common relative path that matches a readable file. I added this because I've started working with projects running inside Docker containers 😄

I hope you're having a great week and enjoy these changes!

conjure - ConjureUp flag fixes and multiline output fix

Published by Olical about 5 years ago

  • Flags for which prepl you wanted to connect to, like :ConjureUp -lein +propel were broken due to a reaaaaly dumb mistake: https://github.com/Olical/conjure/commit/a1a1e50cd5fb17bf5c9f34dc8998f4efac4a1866 this all now works properly!
  • Some outputs were saying they were multiline when they really were not, this caused some weird display issues for some people. The output of evaluations and taps are now trimmed so any stray new lines won't trick Conjure into thinking it's a multiline output.

Enjoy! 🎉

conjure - Fixing record display

Published by Olical about 5 years ago

Dave Yarwood pointed out over in #conjure on Slack that an old bug had resurfaced, if you executed the following:

(defrecord Foo [x])
(->Foo 10)

It would return nil instead of #user.Foo{:x 10} as expected. This now displays as expected.

conjure - v1.0.0!

Published by Olical about 5 years ago

I'm finally happy enough to tag a v1.0.0 release! 🎉 😱

Not an awful lot has changed since the last one but it's more of a ceremonial line in the sand with a re-written README and a few internal cleanups.

  • Refactored how the injected deps are built and managed. You no longer need to compile them! So that's less to do post-install, just AOT of the Conjure classes remains (bin/compile does less work, basically).
  • Don't allow evaluations until all deps are injected, prevents some weird potential race conditions, you will have to wait to see the "done" message before you can start working though.
  • Completely rewrote the README, it's got a gentler introduction and fairly pretty tables now. More guides and documentation to come!
  • Always fall through to Conjure's own JVM self prepl if no connections work. This means if your main development server is down you can still get autocompletion and documentation / eval of core Clojure things. You won't get your project dependencies, but it's an improvement!

I've laid the foundation for ClojureScript dependency injection which will make autocompletion for CLJS fairly easy once Compliment releases it's new version. There's definitely more improvements that can be made around injected dependencies but I'll reserve judgement for now, you just have to wait 2-3 seconds upon the first connection which I don't think is too bad.

conjure - Namespace refreshing, args in completion, internal cleaning

Published by Olical about 5 years ago

A fairly chunky release and hopefully the last one before ClojureScript gets dependencies injected into the REPL so we can have the same autocompletion / doc / go to def experience in Clojure and ClojureScript.

Initial connection to a REPL can take a couple of seconds now because there's some optimisation work I've got to get through. It should get lower with time, the only reason it went up is because I'm beginning to implement things like tools.namespace stuff and Orchard.

  • Show the arguments to functions in completion results. Get argument lists as you type!
  • Show full doc strings in floating windows as you type in newer versions of Neovim and it's completion plugins.
  • Refreshing of changed namespaces via tools.namespace and configured through your .conjure.edn. See the README.
  • Completely refactored the conjure.code namespace so I'm no longer building code strings out of strings, I'm using code as data as templates. I've got a custom ball of macros and multimethods built atop of backtick that make it really neat to work with now.

Next up is more ClojureScript polish via some injected dependencies and rewriting of the documentation / guides ahead of v1.0.0! I have next week off so hopefully I'll get it all done or at least get very close, how exciting! 🎉

I hope you enjoy this pupdate!

image

conjure - Pretty errors, better log trimming, ClojureScript eval improvement

Published by Olical about 5 years ago

  • Error data is no longer dumped in the folded area under an error. It's now run through a function called pretty-error that formats it as a (hopefully!) easy to read string. Let me know if you had any suggestions about improving the format.
  • Improved some of the zprint config that makes some edge cases a little easier on the eye. I think I found a bug in zprint too but I've worked around it. No time to dig deeper and work out if it is a bug right now.
  • ClojureScript evals need to be wrapped in a do block to ensure only one value is returned from the prepl. @djblue in #54 pointed out that this breaks some evaluations of ns forms. I've now made it so that single form evaluations aren't wrapped in a do block since it's not required. This might've fixed some other weird ClojureScript stuff by mistake.
  • The log buffer is now trimmed a lot more aggressively, so now if you pass the 1000 line threshold (say 1500) you'll see your entire output (yay!). But as soon as you add another line the log will be cut down to a maximum of 500 lines before your output is added.

So fairly small changes but improvements all the same! Enjoy!

This pupdate is brought to you by my favourite breed, the Corgo.

image

conjure - Configurable mappings, better log filter config (breaking) + more!

Published by Olical about 5 years ago

More kind of under the hood and subtle changes. I think I'm running out of small stuff to fix and can move onto a few smaller features like better error parsing / formatting as well as code formatting. Here's the changes, watch out for the breaking change around g:conjure_log_auto_open, it's been replaced by g:conjure_log_blacklist: https://github.com/Olical/conjure/commit/e90c56ac9725cefcae33344032913a99bbc3262e

  • Add configurable mappings so you can remap or disable any specific mapping that Conjure defines. You can still switch off all of Conjure's default mappings if you so wish.
  • Hardening against some more weird responses from the Neovim RPC API.
  • More virtual text clearing even when you have quick doc disabled entirely.
  • Assorted internal refactoring.
  • ConjureUp output now displays in the log under conjure/up instead of conjure/out.
  • ConjureStatus is printed under conjure/status in the same way.
  • Breaking: Remove the g:conjure_log_auto_open config, replace it with g:conjure_log_blacklist setting which is very similar but now excludes things you don't want to pop the log open, rather than the other way around.
  • Show a summary of connections made in virtual text post ConjureUp so you'll know if you're connected even if you blacklist up log lines.
  • More README tweaks, still need a full documentation overhaul but for now I'm just trying to make sure everything's written down somewhere, even if it's hard to follow.

This pupdate is brought to you by Princess Pip, our family Chocolate Labrador. There will be more of Pip.

WhatsApp Image 2019-07-10 at 08 25 42

conjure - Virtual text improvements and various tweaks

Published by Olical over 5 years ago

Another Conjure release, fresh from semi-sunny London!

  • Virtual text will be dismissed when it's not required, still more to do here but it's better.
  • You now get four kinds of virtual texts! https://imgur.com/a/lTabSwI
  • Swapped from Cheshire to Jsonista, it should be a little faster for autocompletion stuff. Probably not noticeable though.
  • Updated a few internal dependencies.
  • Fixed OSX support by removing usage of stat... I thought I did it last version but missed one.
  • Catch more uncaught errors in nicer ways, there's only a few times I see errors leak out now and they're not bad. I'm slowly fixing them! It's just where Neovim returns nil when I ask for the cursor position and I'm not sure why, I think it's a race condition thing in Neovim? I'll solve them all eventually.
  • Socket disconnects don't show errors now, they're nice and quiet.
  • Starting to add all the config for you to remap every mapping to whatever key you want, not done yet though.

I hope you enjoy this pupdate and you have a great weekend ahead of you.

conjure - Exception handling overhaul and OSX compile fix

Published by Olical over 5 years ago

  • Fixed #40 by overhauling how exceptions and results from evaluations are handled in #47.
  • Fixed a bug with OSX where it wouldn't let you run bin/compile because I was using stat -c which Apple removed support for 🙃 I'm now using date -r ... +%s to get the modified time of files in seconds to work out if I have to compile or not.
  • Fixed ClojureScript prelude string building, oops.
  • conjure.result is no more! The world is a simpler place!

Basically everything got a lot more robust but ClojureScript support will be a little iffy around exceptions until my patch for ClojureScript is merged and release. I hope it works well for you! Doc lookup for things like spec keywords will now work too, yay!

This should not be a breaking change. Have a doggo for keeping up to date responsibly.

image

conjure - A bunch of smaller improvements

Published by Olical over 5 years ago

Everything seems stable and there's some nice tweaks in here so I thought I'd tag it as a release. The next one should hopefully include fully configurable mappings!

  • Don't init if Conjure isn't compiled, related to #44.
    • It'll now check for the compiled classes and dependencies for injection.
    • It won't go into a restart loop if something goes wrong
  • Reuse the ctx map throughout the code, makes some internal functions a little nicer.
  • Only evaluate the injected dependencies (just compliment at the moment) if they aren't loaded yet.
    • This may not be noticeable but for slower machines it should bring down the connection time ever so slightly.
    • As you upgrade Conjure, it'll inject the new injected deps if they're required.
    • You can run old and new versions of Conjure against the same JVM, they won't interfere with each other, even if your colleague doesn't want to upgrade yet.
  • The current version number is shown in the first line of the log.
  • Added a little badge to the README pointing to #conjure in Clojurians slack. Come say hi!

Well done for upgrading responsibly, have some doggos.

conjure - [BREAKING] Multiline result folding + many small improvents

Published by Olical over 5 years ago

  • @justone added optional folding of multiline results!
  • Improved calculation of the current working directory of Neovim.
  • Don't load in non-Neovim or if already loaded.
  • Fixed CONJURE_LOG_PATH, it was relative to Conjure's source, not your nvim.
  • Tidy up the development workflow (see CONTRIBUTING), no longer require .localvimrc.
  • Cleaner exiting of the process, Neovim asks Conjure to exit politely rather than executing it on the spot.
  • Make the mappings silent, prevents some printing of "press enter to continue" on small screens.
  • Fix #slurp-edn and allow it to return nil if a file can't be read.
  • Allow nil :port values, mainly from #slurp-edn, the connections with a nil port are ignored.
  • Improve how the log buffer and window are upserted, fixed a subtle bug.
  • Add a mapping to eval the word under the cursor.
  • Add a mapping to toggle the log instead of just opening or closing it.

Breaking!

  • g:conjure_log_auto_open` is now a set of the kinds of log entries you wish to open the log. See the README for more, essentially you have to replace the 1 or 0 with an array of kinds of log entries you want to open the log for. For example:
let g:conjure_log_auto_open = ["out", "err", "tap", "doc", "test"]
conjure - [BREAKING] Declarative prepl connections and various fixes

Published by Olical over 5 years ago

  • Various fixes and protection against some nils coming back from Neovim
  • Added g:conjure_log_auto_open config
  • #15 (declarative prepl connections) is finished!
  1. Set up your .conjure.edn
  2. Open Neovim
  3. ???
  4. Profit!

Further documentation for this new style can be found in the README.

No input required! It'll connect to what's running at the time, if you start your prepl after Neovim you can just hit <localleader>cu by default to ConjureUp which will reload the config and sync the connections.

You can also provide +some -flags to ConjureUp which will toggle on and off specific connections. Great if you set some to be :enabled? false by default (live server port forward for example) which you want to explicitly toggle on at some point.

I hope this is good for everyone and is seen as a positive change, it is breaking (no more ConjureAdd / ConjureRemove / ConjureRemoveAll) but it's the last breaking one I could think of. I've wanted to implement it for quite a while now, glad I've finally got around to it!

Get in touch with me on Clojurians Slack (#conjure @Olical) or twitter (@OliverCaldwell) if you have some questions around this change.

conjure - Virtual text on eval and many fixes

Published by Olical over 5 years ago

Phew! This looks like the last release before I take a swing at #15 which will be a breaking change.

  • Tidied up how quick doc worked.
  • Got quick doc working on insert mode
  • A bunch of small internal refactoring
  • Improved the compile script slightly, does less work each time now
  • Added a few options you can use to disable things like quick doc (see the README)
  • Refactored the log buffer to allow appending while it's not visible which allowed me to...
  • Show single line eval results as virtual text, only show the log if there's output that doesn't fit in virtual text

So the log buffer is going to appear a lot less now, but you still have access to it when you want and it contains the history of your evals. I think this UX is a lot nicer, your windows and splits are only messed with when there's large output or when you ask for the log buffer now.

If you don't like this change or want more config etc, hop in #conjure in the Clojurians Slack or hit me up on twitter via @OliverCaldwell. Or open an issue here and we can discuss your thoughts!

conjure - Safer parsing

Published by Olical over 5 years ago

See #40 for more details, but records being returned from your REPL will cause Conjure to barf at the moment. I can't fix that until I rework how errors are managed and I can't do that until I get a patch into ClojureScript (although I might work around that...).

I've basically made it so these weird parse errors will no longer kill your connection, they'll just show you the error. You can still convert records to maps and continue with your day. I'll get this fixed as soon as I can.

conjure - Actually fix quick doc bug

Published by Olical over 5 years ago

Sorry about the patches, I thought I'd fixed it, realised I hadn't then actually fixed it. Hooray for v0... and patches! See v0.16.0 to see more about quick doc.

conjure - More guards for quick doc

Published by Olical over 5 years ago

See v0.16.0 for the real update, this patch just adds some more protections just in case something goes wrong. It shouldn't, but it's more resilient now.

conjure - Virtual text doc on CursorHold

Published by Olical over 5 years ago

I've added documentation lookup on CursorHold that displays with virtual text next to your current line.

It doesn't use the word under the cursor, like K, it uses the head symbol of the current form. So if your cursor is the | in this example you'll see documentation for +.

(+ 10 |10)

Screenshot_2019-05-30_21-15-20

conjure - Log config and tidier mappings

Published by Olical over 5 years ago

  • The brilliant @jlesquembre has added configuration to the log window in #35! So now you can control the size (with percentage values) and direction of the split. Exciting!
  • I rethought the mappings and added support for .edn files in #37. There's now a lot more space for adding more mappings without stepping on the toes of other parts of the tool.

I think I'm going to move to a next branch where all development happens soon. That way master should stay pointing at the latest version. I don't want to update the README with new things if they're not technically released yet.

I hope you enjoy!