This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-05
Channels
- # beginners (46)
- # calva (89)
- # cider (24)
- # clara (7)
- # clj-kondo (36)
- # clojure (33)
- # clojure-australia (4)
- # clojure-dev (9)
- # clojure-europe (15)
- # clojure-israel (1)
- # clojure-nl (1)
- # clojure-uk (13)
- # clojurescript (55)
- # community-development (38)
- # conjure (1)
- # cryogen (12)
- # cursive (16)
- # data-science (4)
- # datomic (39)
- # events (2)
- # fulcro (5)
- # gorilla (3)
- # introduce-yourself (3)
- # jobs (9)
- # kaocha (5)
- # malli (16)
- # music (12)
- # off-topic (11)
- # polylith (4)
- # react (4)
- # reactive (1)
- # reagent (18)
- # remote-jobs (2)
- # reveal (2)
- # sci (4)
- # shadow-cljs (31)
- # timbre (4)
- # tools-build (70)
- # tools-deps (11)
- # vim (33)
- # xtdb (53)
anyone have solutions that they like to the "format this file or this section via an external command like cljfmt" problem?
I will not say I like it but this works https://github.com/nbardiuk/dotfiles/blob/50d8044614981626143091bbea15dd45c5ea5f29/nix/.config/nixpkgs/home/init.vim#L219-L231 I've added cljfmt to ale
which I use for other languages. Also it requires external cljfmt in path, lein native-image
builds it using graalvm https://github.com/weavejester/cljfmt/blob/master/cljfmt/project.clj#L24 . What I like in this is integration with Ale and that it is native (reasonably fast)
I might be missing something, but if you :set formatprg=cljfmt
it will literally call cljfmt for gqq etc.
i've been fairly happy with this simple
setl formatprg=cljstyle\ pipe
which is basically the same as noisesmith'si used to use a vim cljfmt plugin that would auto-format based on the project config but now i mostly work in repos that aren't consistent so i just use gq<motion>
myself
I have an autocmd for :BufWritePre that calls the lsp formatting_sync in neovim’s lsp provider
or could do it with a mapping (buffer or global)m but both just call vim.lsp.buf.formatting_sync()
Related to that: is there a way to have coc.nvim format code with the connected clojure-lsp, via equalprg
?
you mean calling clojure-lsp format which uses cljfmt under the hood?
what is equalprg
?
I'm assuming that it would be faster to use the running clojure-lsp for formatting, rather than starting up cljfmt/`clojure-lsp format`
I have a slight preference for not installing cljfmt separately (I don't have it installed now), in order to minimize the set of tools in use.
Yeah, certainly call clojure-lsp format of the running clojure-lsp would be way faster
With lsp-mode, which gives you commands to all LSP methods, and since format
is a official LSP method, there is a lsp-format-buffer
function and a lsp-format-region
one as well
Looks like we can setl formatexpr=CocAction('formatSelected')
with coc.nvim to format selections/ranges with gq
, or :call CocAction('format')
to format the entire buffer. https://github.com/neoclide/coc.nvim/
Thanks for the explanation, @UKFSJSM38. It nudged me to search in the right direction 👍
Is there some way to get more information about what iced repl
is doing in the background? I am trying to do a simple require
. When I do it through just clj
, it works fine. When I do it through my vim-iced editor integration, I get a missing namespace exception.
As far as I can read bash, the iced repl
discovers type of project and starts corresponding repl with extra nrepl middleware to support editor integration https://github.com/liquidz/vim-iced/blob/main/bin/iced
maybe you need to provide extra arguments to iced repl
to enable some alias from your deps.edn
https://liquidz.github.io/vim-iced/#iced_usage
I've been launching my project the same way for a while:
iced repl :main --force-shadow-cljs -A:dev
Made a couple of upgrades to my deps - both project and tooling - and now the same old command is throwing up an error when I :IcedConnect
like I always have. I'm trying to narrow down what may have broken it. Nothing in that iced code you linked, as far as I can understand it, really jumps out at me. The main observation so far is that the require
works in plain clj
but not when done through iced.If it used to work and now not, maybe it worth opening an issue in github, usually author is very helpful.
Thanks @U076FM90B, I'll try that if I can't figure it out soon.
I don't understand why, but it appears to work again after `$ rm -rf ~/.m2/repository/juxt`, recompiling, and restarting my tooling. Just leaving this here for posterity.
Looks like we can setl formatexpr=CocAction('formatSelected')
with coc.nvim to format selections/ranges with gq
, or :call CocAction('format')
to format the entire buffer. https://github.com/neoclide/coc.nvim/