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 - Handle errors in lazy-seqs at the root

Published by Olical over 5 years ago

So if you evaluated something that returned a lazy-seq that would throw when it was fully resolved it would cause an error that never displayed. This is because the error happens inside the actual internal prepl code, not inside my eval code where I try/catch. I've solved this with a doall before the pr-str which should prevent any of these in the future.

I added some more code to check for these unhandled errors in the future and log them with some information about it probably being a bug in Conjure, so you should report them if you see more!

This was raised in #33 and hopefully fixed in this patch.

conjure - Improve compiling for last breaking change

Published by Olical over 5 years ago

The new compile script needed some TLC around output and using -Sforce to fix some oddities in the first time compile.

conjure - Breaking: -Makefile +bin/compile +mranderson

Published by Olical over 5 years ago

I noticed some weird issues on first build of this version, I'll release a patch today that hopefully addresses them. Just rm -rf classes target && bin/compile if the initial compile failed for now.

This is a breaking change!

What you have to do

Replace your call to make compile with bin/compile. For me that's in my call to vim-plug as documented in the readme. Here's the change I made in my dotfiles, ignore the fact that I'm using the master branch, you should be using a tag. I use master because I know what's there and am okay with it breaking sometimes.

Why

I wanted to remove the dependency on make so I rolled my own "should I recompile?" check using modified times of the classes directory and the latest git commit.

Mr Anderson

I originally had a kind of hacky solution to injecting compliment that involved managing a list of files to load by hand. I've now replaced that with calls to Mr Anderson to fetch and munge injected dependencies as well as tool.namespace to parse and resolve the dependency order.

This means I can grow the list of dependencies to inject into your prepl as you connect as much as I want. It'll never conflict with your existing copes of those dependencies. If you need a specific version of tools.namespace in your project but Conjure needs a newer one to do it's thing you don't have to worry: It'll just work!

conjure - Completion performance

Published by Olical over 5 years ago

I realised that the fix I put in for #34 was doing a bunch of unnecessary Neovim API calls. There were a few duplicate requests for information from Neovim in a few places actually.

I've basically made Conjure only ask for data it needs and not ask for things twice, this could definitely be improved by some sort of internal declarative system.

Shouldn't notice any functionality changes in this patch but it should work a lot faster as you type and eval the root form!

conjure - Self prepl and Compliment injection

Published by Olical over 5 years ago

  • If you try to eval without any connections Conjure will prepl into it's own JVM. This means you can open up a .clj file anywhere on disk, hit <localleader>re and have it evaluate the form under the cursor.
  • Compliment is no longer a required dependency in your project! You can connect to any prepl and Compliment will be injected for you. It won't conflict with existing Compliment versions in your JVM.
  • Fix a bug with evaluating nils: https://github.com/Olical/conjure/commit/f7457355a27b1decfe82f796e1ff76f9746f31e6
  • Lower memory requirements from 512m to 256m, can probably go much lower but I need to have some metrics first.
  • Fix #34, evaluating the current form or root form would behave weirdly if it contained a string or comment with unbalanced parenthesis inside.
conjure - Pretty errors and some more tests

Published by Olical over 5 years ago

#12 is done! So errors now get pretty printed as a string, just like they do in the regular Clojure REPL. The full stack trace data structure is still printed in the log (through zprint) but it's folded. You can reveal it with zo and close it with zc, check out :help fold for more information on this feature. It's built into Vim!

Screenshot_2019-05-04_15-52-32

I also think I broke ClojureScript evals in the last patch version (SORRY) which is fixed now.

conjure - Lower Clojure version and internal changes

Published by Olical over 5 years ago

Just a small patch because I realised 1.10.1-beta2 can cause issues on some machines and setups. I hope it didn't break it for anyone! Also includes some internal changes in preparation for better errors, the errors are now pretty printed as strings above the stack trace too.

Also fixed a bug where really long namespace forms weren't being read correctly to set the namespace of the eval.

conjure - Better exit, more tests, consistent eval

Published by Olical over 5 years ago

This is a fairly large set of commits but I still wanted to add more. I thought I'd cut at this known good point though.

  • A PR to fix exiting the process nicely from @jlesquembre https://github.com/Olical/conjure/pull/26
  • Full codecov and CircleCI support with a small test suite. I'll grow it over time but I've already got some nice RPC mocking tools and tests for reading forms.
  • All kinds of evals will keep the line, column and origin file meta data on defs. So you can use gd to go to definition of things you evaluated with a range, form or buffer.
  • Added context support for compliment! So now you'll see local let bindings in your completions too, took quite a lot to get that working. The last thing on completion is making it work without you having to depend on Compliment yourself.

ClojureScript support for autocompletion and preserving def meta data will hopefully come some time soon! I hope you enjoy this release, let me know if you hit any issues!

A rather large block of changes this time although there's still more I want to do around completion (#16) and a test suite (#13). I've just added one "Hello, World!" test for now to get everything working in CircleCI (which is amazing btw).

  • The ,rt and ,rT test bindings will run the -test variant of your namespace name if available.
  • Test commands now take namespaces and regular expression filters just like the actual Clojure functions themselves.
  • Test output is captured and printed properly. (clojure.test/*test-out* is a thing but only in Clojure, not ClojureScript)
  • Added a JSON RPC server for plugins to use to talk to Conjure directly without going through the Neovim process. conjure#get_rpc_port() will get you the port to connect to, funnily enough.
  • Added a Deoplete source to the repo, so if you use Deoplete and have Compliment in your JVM you now get autocompletion as you type out of the box. I've recommended some settings in the readme that might make your experience slightly better though.
  • coc-conjure has updated to support this JSON RPC port too so it should get faster and smoother magically!
  • Started a test suite using kaocha and CircleCI.
  • Formatting output with zprint again since it looks really nice.

Whew, and there's lots more to come! But yay, full autocomplete as you type without blocking your editor! Omnicomplete still works as normal for those of you that prefer the good old <C-x><C-o> binding.

conjure - Simple test bindings

Published by Olical over 5 years ago

This is the beginning of test support, adds ,rt (run tests) and ,rT (run all tests) as part of https://github.com/Olical/conjure/issues/20. Also removed the paren guard because it broke ClojureScript in weird ways (https://github.com/Olical/conjure/commit/85a34f76a8845525839ab3ebc3481be037a4f259).

The next work on testing will be running tests in your current namespace as well as a -test variant of the same name if I can find one. I'm also thinking of loading those namespaces for you but I'm not sure, that assumption that I'm allowed to load your namespace might be dangerous.

Maybe I should keep eval and test separate for you to decide? Feedback is appreciated on #20!

conjure - Smoothed some sharp edges and fixed OSX support

Published by Olical over 5 years ago

So that's a few more closed issues and some more thought about async autocompletion. I think that'll land in v0.10.0 in the form of msgpack RPC over a port. So you can talk to the Conjure JVM process from other plugins directly without having to go through the nvim process which can block the UI thread.

Autocomplete plugins will just ask Conjure for it's RPC port then start communicating directly with it through there.

Have a great rest of your week!

conjure - Quieter CLJS completion (noop)

Published by Olical over 5 years ago

The CLJS completion while you were autocompleting would constantly complain that it wasn't implemented yet. Now it'll quietly return nil. Conjure will try to use all of your matching connections as completions sources, this will be slow if you have a lot of connections for one file, once I get that parallel it means ClojureScript and Clojure completions in one list!

So editing CLJC files should be quite... fun? It'll show completions from both environments (once compliment supports CLJS).

conjure - Makefile fix and completion tweaks

Published by Olical over 5 years ago

The makefile was (once again) compiling on every make compile not just when the code had changed. This has been resolved... again.

Also silenced completion so it doesn't complain about lack of connections. Added a function to just fetch the completions without any of the omnicomplete shenanigans for coc-conjure to hook into.

conjure - Go to definition

Published by Olical over 5 years ago

Added go to definition support under the gd keys, closes #9. Will work much more consistently once #18 is done.

Right now if you ,rf, ,re, or ,rE you'll lose the location meta data for the symbols you evaluated since they're fired across a REPL. ,rF will load the whole file and they'll be put back. If I can get the location data being assigned to the symbols you're sending through the REPL it should fix this problem.

It works great, just expect it to not work as well when you're redefining individual symbols and not loading the whole file. If it can't find a match it uses Neovim's built in "first occurrence of this word" functionality. It just falls through to vanilla gd.

This works in Clojure and ClojureScript, let me know if you spot any bugs!

conjure - Fix make compile

Published by Olical over 5 years ago

When running make compile without any existing classes dir it would fail because it can't rm a dir that doesn't exist. This fixes it. Thanks @jorinvo in #17 for pointing this out.

conjure - Omnicomplete

Published by Olical over 5 years ago

I've added omnicompletion support through Compliment, you can see my thoughts on it in #8. There's definitely more I could do but this is a great start and frees up my time to go add the next feature.

Once the core features are down and there's a solid test suite I'll look into make each feature more powerful and integrated. Such as autocompletion popups and context for completion.

I hope omnicompletion works well for you! Let me know of any issues 😄

conjure - Internal cleanup and a small bug fix

Published by Olical over 5 years ago

This is mainly just internal refactoring and renaming but I thought I'd release it anyway.

  • Replaced zprint with fipp for now since I value performance over absolute prettiness in the log window right now. Does a great job, may use zprint for code formatting in the future. #11
  • Lowered the max log buffer length to 3000 lines before it gets cut in half. It was 10,000.
  • Fixed a bug where if you tried to eval the current buffer when the last line was a ; comment it would error.

That's because it was commenting out the closing paren of some of my wrapper code that I wrap every eval inside for various reasons. You'd essentially end up with this...

(+ 10 10)
;; ohno

Becoming this (massively simplified)...

(do (+ 10 10)
;; ohno)

That last paren was being removed, thus, EOF.

conjure - Fixed and improved form-wise evaluation

Published by Olical over 5 years ago

  • Fixed escaping things as they're sent across the prepl, was causing some subtle bugs when you had a bunch of \\\\ in use.
  • Fixed #4 and improved it a lot. So now if no form is found nothing happens and it handles every case I could throw at it.

The eval current / outer form issues were caused by some of the Neovim API being 0 indexed and some being 1 indexed. So some values have to be decremented or incremented in different cases while hunting for matching (){}[] pairs of forms. That function was hard to get right but it works well in every case I can think of now!

Next up is a bunch of repo changes around documentation and then probably an initial autocomplete. Maybe some configuration as mentioned in #5, feel free to add your feedback there too!

conjure - Default mappings and better form selection

Published by Olical over 5 years ago

  • The mappings that were mentioned in the README are now included by default, you can opt out with let g:conjure_default_mappings = 0.
  • ConjureEvalCurrentForm and ConjureEvalRootForm now take [] and {} pairs into account.
  • Merged #3 which cleaned up some JVM arguments.
  • Lots of code shuffling into autoload/lua files.
conjure - Complete rewrite in Clojure!

Published by Olical over 5 years ago

This is the beginning of the new change log! Conjure used to be Rust, then I tried ClojureScript and finally settled on Clojure after throwing the two previous attempts away. The old attempts still live in branches.

The README contains everything you need to know so far. Here's to a long life of Conjure, v0.4.0 is a complete fresh start 😄