conjure

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

UNLICENSE License

Stars
1.7K

Bot releases are hidden (Show)

conjure - [Legacy Rust] Better completion, reload tools and subtle improvements

Published by Olical over 5 years ago

I'm still crawling towards a solid v1.0.0, this release is a big step in the right direction. I've got a long flight to Canada and back coming up so hopefully that'll give me more time to work on the key features as well as the documentation. The alpha trial gist is still relevant at the moment.

Slightly more complete completion

It won't spam you with errors if you try to complete without a connection and it will only refresh the completions if you've actually changed a Clojure file somewhere. This should stop my CPU from trying to melt through the laptop when I idly spam jkjkjkjkjk as I think about something (it updates completions on CursorHold).

Reload bindings!

You can now use <localleader>rr to reload changed namespaces and <localleader>rR to reload all namespaces. You can configure this reloading tool with settings in a .lvimrc or something:

" Check these directories for changed namespaces.
let g:conjure_refresh_dirs = ["src/clj", "src/cljc"]

" These args are tacked onto the tools namespace refresh call, this will call user/restart when done reloading.
let g:conjure_refresh_args = ":after 'user/restart"

This requires org.clojure/tools.namespace {:mvn/version "0.3.0-alpha4"} or greater in your project. Just ensure that you depend on it somewhere and it'll be required for you.

Bonus binding: Buffer eval

The new <localleader>rb will evaluate the buffer without touching the file on disk at all (unlike <localleader>rf). This works great if you're connected to a remote REPL in your live or staging environment.

Under the hood

I no longer pass the path to Rust so that it can work out the namespace etc since this required reading the file from disk, not cool. Now the Rust code works out your context by asking Neovim over the RPC interface. This means less stuff for VimL to worry about and no reliance on being able to read the file.

I've turned off the file logging by default, you can turn it on again easily:

" Log to ~/.config/nvim/plugged/conjure/target/debug/conjure.log
let g:conjure_logging = 1

I've also added a warning when you try to eval or do something without having a REPL connected for that operation. This prevents you trying to eval then sitting there for a while wondering why nothing happened.

conjure - [Legacy Rust] Completing and fixing things

Published by Olical almost 6 years ago

Completion!

There's omnicompletion now, it works really well for Clojure and will show all symbols / aliases / namespaces available to you. I haven't bothered with keywords yet but I suppose that could be added somehow?

ClojureScript isn't as good, it only completes your local namespace symbols and cljs.core because I don't have the functions I need to look things up in that environment. Maybe I'll find workarounds some day though! I just need a way to list aliases and all namespaces 🤔

I'm using these deoplete settings and they're working fairly well. Although sometimes the cursor flashes if it has no matches which is a bit weird, suggestions appreciated.

let g:deoplete#enable_at_startup = 1
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
set completeopt-=preview

call deoplete#custom#option('omni_patterns', {
\ 'clojure': '\w\|-\|\.\|+\|*\|/',
\})

Completion is asynchronous and the cache is updated on cursor idle per-buffer. It should be extremely snappy. Let me know if it's really slow for you though! It may well be on large projects, I might need to rethink it if this lazy approach uses waaaay too much memory and CPU.

Go to fixes

Go to definition was a bit borked with some files, that should be fine now. It was inserting file: before some files when I looked them up in io/resources but I'm stripping that off now.

Subtle improvements

Stuff like using user as the default for Clojure and cljs.user for ClojureScript. Things that you'd only notice in some rare cases really but I improved them anyway. Much more to come in the "under the hood tidy ups" department.

conjure - [Legacy Rust] Hello, World!

Published by Olical almost 6 years ago

Initial extremely alpha release as documented in this gist.

Contains eval, documentation lookup and go to definition.