This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-11
Channels
- # announcements (6)
- # architecture (9)
- # beginners (120)
- # calva (13)
- # cider (28)
- # clj-kondo (8)
- # cljs-dev (7)
- # clojure (113)
- # clojure-europe (13)
- # clojure-italy (7)
- # clojure-nl (9)
- # clojure-spec (44)
- # clojure-uk (7)
- # clojuredesign-podcast (15)
- # clojurescript (18)
- # cursive (9)
- # data-science (3)
- # datomic (32)
- # defnpodcast (1)
- # events (2)
- # fulcro (6)
- # jobs (1)
- # kaocha (5)
- # london-clojurians (2)
- # luminus (2)
- # nyc (2)
- # off-topic (54)
- # ring (6)
- # shadow-cljs (136)
- # sql (1)
- # testing (2)
- # tools-deps (64)
- # vim (83)
hi everyone, i used to program in clojure a while ago - at that time vim wasn't supported as well as emacs, there was no such thing as a language server, etc... i feel like things might be different now, and while i can get by in spacemacs i would prefer to use neovim. Could someone point me at a 2019 friendly setup for neovim? I have been using coc for most of my other languages and have clojure-lsp working but i get a LOT of errors (unknown namespace, unknown symbol, etc) and i'm thinking i have something setup wrong. if anyone could point me at their dotfiles as an example or an up to date tutorial i would be grateful, thanks (p.s. - something that works well for clojure and clojurescript would be great) thank you for any help
Hi @fredmonroe. Mine probably isn't a lot better than what you've got, but it's working well: https://github.com/walterl/dotfiles/tree/master/nvim
thank you @clojurians-slack100
If you're using vim-fireplace
, make sure that you have it connected to a running nrepl. That enables a bunch more interactive functionality.
But it seems like there are quite a few cool alternatives going around, with authors in this channel ๐
haha yes - i have some paralysis because of that (e.g. - https://github.com/clojure-vim/acid.nvim)
oh, something that may not be clear from the dotfiles: I have clj-kondo
in my $PATH
, so ale picks it up and uses it automagically https://github.com/borkdude/clj-kondo
One day I should also get around to adding this to my dotfiles repo:
$ cat ~/.lsp/config.edn
{"macro-defs"
{clojure.java.jdbc/with-db-connection
[:bindings :bound-elements]
clojure.java.jdbc/with-db-transaction
[:bindings :bound-elements]
metabase.api.common/defendpoint
[:element
{:pred :string}
{:pred :string}
:function-params-and-bodies]
schema.core/defn
[{:element :declaration, :tags [:local]}
':-
:element ; return value signature
{:pred :string} ; docstring
[{:element [:param ':- :element], :repeat true}] ; parameters
:bound-elements ; body
]
schema.core/defmethod
[{:element :declaration, :tags [:local]}
:element
':-
:element ; return value signature
{:pred :string} ; docstring
[{:element [:param ':- :element], :repeat true}] ; parameters
:bound-elements ; body
]}}
oh! very helpful - i feel like some of my errors are related to arguments in macros - ("let-release", "with-release") - would this help with those?
My config won't help for those macros you mention, but if you add something similar to ~/.lsp/config.edn
, it can. Docs are here: https://github.com/snoe/clojure-lsp#macro-defs, but there's a few details undocumented. So if you want to go deep, check out clojure-lsp
's parsing code: https://github.com/snoe/clojure-lsp/blob/master/src/clojure_lsp/parser.clj
you are awesome thanks much. if you ever need help w/ fastai/python or something in that kind of realm i'm your guy - pretty rusty on clojure these days
gtg, but if you don't manage with the macro-defs, leave them (and the definitions of the macros) here and I'll have a look later
this is a simple example, i'll work on it myself, just to show you: (time (dotimes [i 10000] * Unknown symbol: i (mv! t (col a i) y))) * Unknwon symbol: i
@fredmonroe && @clojurians-slack100 I'd be happy to take your macrodefs as contributions too, my stance is clojure.core and popular library macros should be included.
@snoe Iโm so noob Iโm still trying to figure out which errors are just me setting things up wrong - but will definitely share macrodefs once I know what Iโm doing
Thank you for making closure-lsp!
@fredmonroe you may also want to consider conjure instead of fireplace (#conjure). It's a plugin for neovim that uses an io-repl - has support for coc (using coc-conjure) and will shortly (to be merged into master) have the ability to hook into REBL
didn't know about coc-conjure, I somehow had autocompletion with coc and conjure installed anyway ...
is there a way to check what happens on pressing tab? what function gets called?
thanks @U11EL3P9U it looks pretty nice, will try it - do you have any public dotfiles i could look at to see how you approach things in general?
Even if we're all dabbling in different things. I suppose there's only about 12 of us in the Vim+Clojure Venn diagram so there's enough room for each of us to have a totally different setup ๐ฌ
Here's a spanner for you guys: what would it take to "language server" these 12 plugins. How can we make it so we aren't all rewriting each other's plugins all the time in order to build on top of a different base is slight set of differences.
I thought about this for a long time before I started work and realised LSP is designed for static languages, not lisps. I live and die by the eval, LSP has zero awareness about languages which involve evaluations to develop things. It can do some stuff that is common with other languages, but I couldn't find anything that would let me run code in a structured way. I found that it wouldn't be worth it since I don't want static analysis, I want a running program to tell me things.
It's probably doable, I just didn't like the idea of writing that approach myself and wanted a Clojure program driving Neovim talking to other Clojure programs without the weight of someone else's API design on my mind.
Well I think LSP's cross editor support is something that would be good for the clojure community, it's crazy that every editor has to reinvent this stuff (and follow a similar path to vim). I think paredit commands could be useful but parinfer is basically impossible in lsp because of it's async nature. REPL commands could definitely be done, but putting all of, for instance, cider in lsp might be a mistake and would certainly run up against the protocol. I would love to have this conversation though. Maybe time for an #lsp channel?
For example, a UI library for clojure displays might be one way of doing that. And it could be wired into different connection managers. You pass it a map of info and it would display the doc however the user wants it (repl buffer, echo, preview buffer, etc)
Honestly, I feel the amount of choice is a double-edged sword. For (relative) beginners (to clojure, not vim) it is very hard if not impossible to choose the right set of plugins, some of which are even conflicting (e.g. I discovered that slurp/barf from vim-sexp (I think) donโt work well when you have parinfer smart mode enabled). This is a great selling point of Calva/VSCode IMHO: just click โinstallโ and you have something that works quite well so that you can get started and have all that setup stuff out of the way. For me it would be great if someone(s) in this community would stand up and create a clear recommendation for beginners: install <these plugins> and youโre good to go. And, as a relative beginner/newcomer I would strongly suggest that parinfer smart mode should be part of that set of recommended plugins.
Fireplace. Vim-sexp. Async-clj-omni. Asyncomplete.nvim. Vim-sexp-for-regular-people.
Cool, so now please all maintainers of plugins put that in their READMEโs (โRecommended set of vim plugins for Clojure beginners: โฆโ) ๐
Interesting by the way that I havenโt heard of โasync-clj-omniโ and โasyncomplete.nvimโ yet even though I already have quite a bunch of plugins installed, Iโll check them out.
I started learning clojure in vim about 2 years ago with these 4 plugins and they made me super happy since then.
When I last looked there's only one rainbow plugin that works properly. I can't remember the details. I've personally never found them useful, so I turned them off.
Iโm using luochen1990/rainbow
(https://github.com/luochen1990/rainbow), it works well for me.
also this doc helped me a lot to setup the interactive workflow in cljs with Fireplace https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-with-Vim
Hasn't Shaun given up about smart mode? https://github.com/shaunlebron/parinfer/tree/master/lib
We have made separate attempts to implement Smart Mode in Cursive, Vim, Atom, and Emacs through some wrangling that made integration very difficult and delicate, and ultimately incomplete.
I was not aware of that. Iโve been using smart mode for a while, and even though it doesnโt always do the right thing, for me itโs still valuable. But maybe that indeed rules it out for the default set of plugins.
For a beginner to clojure and not vim. Those plugins are what you want. The completion ones are maybe optional.
is there some way to get a "set" of plugins? have been thinking that such sets could be convenient for trying out various combinations -- whether one is a beginner or not.
there is SpaceVim that has a Clojure layer
after working in Spacemacs for some time I really can see the value of distributions - they do save lots of time
Iโve been using vim-iced
(`coc.nvim` has been extremely flaky for me, so Iโve been using it only for TypeScript/JavaScript): https://github.com/mwistrand/dotfiles/tree/master/config/nvim
Never came across that one before. Has an impressive feature set! I will definitely try it!
Well I think LSP's cross editor support is something that would be good for the clojure community, it's crazy that every editor has to reinvent this stuff (and follow a similar path to vim). I think paredit commands could be useful but parinfer is basically impossible in lsp because of it's async nature. REPL commands could definitely be done, but putting all of, for instance, cider in lsp might be a mistake and would certainly run up against the protocol. I would love to have this conversation though. Maybe time for an #lsp channel?
i'd be interested to zero in on what exactly are the categories of plugins, which plugins are available in each category, and what makes somebody choose one over the other i think paredit vs. parinfer might be one category completion is another category. linting is another. etc.
i would bet that part of the problem is that we have some plugins (cough ALE cough) that do too much and cross the lines between categories
like, if you have to choose between X plugin that does ABC, and Y plugin that does BCD, what do you do if you want ABCD?
I've speculated that ALE is the result of building upon an emerging ecosystem at just the wrong time such that scope creeped.
I think most people don't 'choose' they pick what their coworkers use or what they got to work initially.
I'm discussing less LSP itself though, and more of a in-vim standard. Although the LSP clients may be amenable to taking this role. I'm talking about something that perhaps uses the socket repl or nrepl and passes the result to an LSP client to display.
But I'm happy to suggest making it clojure specific. The transport is irrelevant. We are all talking about the same thing. Arglists always look the same.
yeah, I get it, Jonathan Blow explicitly calls out lsp in his End of Civilization talk. But my feeling is that there's so much momentum across editors for lsp that taking advantage of the existing clients is a quicker path.
Hi all. Iโm drinking from the Clojure fire hose at the moment with Vim Fireplace. It it possible with Fireplace, or perhaps something else, to attach a debugger at a breakpoint in my code?