This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-10
Channels
- # beginners (50)
- # cider (112)
- # cljs-dev (7)
- # clojure (34)
- # clojure-brasil (1)
- # clojure-greece (4)
- # clojure-italy (8)
- # clojure-nl (14)
- # clojure-russia (4)
- # clojure-uk (94)
- # clojurescript (96)
- # clojutre (5)
- # cloverage (1)
- # cursive (5)
- # datomic (59)
- # docs (53)
- # figwheel (4)
- # fulcro (1)
- # hoplon (1)
- # hyperfiddle (3)
- # jobs (3)
- # luminus (6)
- # nyc (3)
- # off-topic (9)
- # onyx (3)
- # overtone (4)
- # re-frame (2)
- # reagent (16)
- # reitit (9)
- # ring (2)
- # ring-swagger (1)
- # rum (1)
- # shadow-cljs (81)
- # spacemacs (14)
- # specter (12)
- # sql (1)
- # tools-deps (2)
- # vim (110)
Gah. clj-refactor is just giving me "Cannot read from non-string object", when I try to rename symbols
Is it possible your code is invalid anywhere in the document? It relies on tools.analyzer.
Shouldn't be, no. I tried changing a function name first, from within the defn. That didn't work, so I just entered two top level foo
s, and changing them had the same result
I'm guessing the error comes from https://github.com/clojure-vim/clj-refactor.nvim/blob/master/src/clj_refactor/repl.cljs#L149
I'm now testing whether any repl command works. crrf also just opens an empty buffer without making any changes anywhere
Extract function does kinda make a new function, but it doesn't see that it needs to add parameters
I had one lein repl open, and closed that. After that I'm getting different results – mostly the commands don't give errors anymore, but neither do they do anything
Hm, except clean namespace now gives "Error: Unable to get results{...", :prune-ns-form "true"}=>nil"
It's very undeterministic. I'm trying to change whether the definition is in user profile or project, and the now the errors disappeared, while the commands still don't work
@tomi.hukkalainen_slac just to check, which versions of cider & refactor are you using?
17 is incompatible with 2.3.1, you have to use 2.4.0-snapshot to have them work together. But 0.14.0 should work, but it's old and I'm not too familiar with any issues it might have.
Hmph, so. {:op "rename-file-or-dir" :old-path current-file :new-path new-file}
, should be roughly equivalent to :echo fireplace#message({'op': "rename-file-or-dir", 'old-path': expand('%:p'), 'new-path': expand('%:p:h').'foo.clj'})
which might give us some more useful debugging info.
At first I thought nothing happened, since the buffer didn't change, but quitting and diffing showed the rename and also changed all the ns calls
fireplace command works means that there's a bug in how refactor.nvim, and not in refactor-nrepl.
I don't know why it's broken however, and I'm not sure why it works for some and not you. I imagine it could be node version, but I'm not certain.
I tried the shortcut now, and I get "Error: Error during fireplace#message: Can't find src dir prefix for path /home/hukka/repos/reititin/src/reititin/foo.clj"
So similar to https://github.com/clojure-vim/clj-refactor.nvim/issues/24 but with absolute path too
So I guess earlier there was a problem with mismatched cider-nrepl and refactor-nrepl versions
And now I'm getting an AST error with another file, when I rename a symbol. So that's probably what you were talking earlier, and perhaps the file renames borked all the files 🙂
I think refactor-nrepl can be a little difficult tbh. refactor.nvim should try and ease more of that, but contributions are needed upstream really.
So what does needing a repl even mean. I thought that fireplace always launches a nrepl behind the scenes
@tomi.hukkalainen_slac salve might do that, fireplace doesn't.
"Oh, and if you don't have an nREPL connection, installing salve.vim lets it fall back to using java clojure.main for some of the basics, using a class path based on your Leiningen config. It's a bit slow, but a two-second delay is vastly preferable to being forced out of my flow for a single command, in my book."
So I guess what happened, is that when I had my screen repl thingy running, it wasn't as much that it wasn't interfering with fireplace, it was making it work in the first place
I don't think your screen repl did anything. vim-salve was doing java -cp ~/.m2/repository/org/clojure/clojure.jar -e '(+ 1 1)'
in the background
I turned it off after the refactor rename file fell on its face, when it had extra buffers open (the :terminal buffer)
Ok. Things are now working, somewhat. Thanks! There are still gaps, though, like renaming a function doesn't rename spec/fdef calls
Seems a bit too tall order for now, when I'm still struggling to understand how to even use these tools
I think I would start from implementing some missing refactorings. I'd like to have promote-fn-literal
I just fixed vim-jack-in's dispatch.vim integration, which I hadn't realised was broken due to the hidden fallback behaviour I added. Some have mentioned that they don't like starting a repl inside neovim, perfectly understandable. If you set g:dispatch_terminal_exec
to something like xterm -e
, it will open in a new terminal. I believe it has native tmux tab integration too.
Oh, apparently I have to use the non-backgrounding version to have tmux integration work. I might add a bang flag to the commands for foreground/background, to help with that.
" Clojure {{{
" Update the static files for clojure from it's upstream,
" this includes fixes like indenting #() properly.
Plug 'guns/vim-clojure-static'
" This plugin allows you to manipulate sexp (clojure
" parens) in magical ways.
Plug 'guns/vim-sexp'
" By default == has a maximum number of lines to prevent
" hanging. Disable that, because I'm happy to wait when I
" want this.
let g:clojure_maxlines = 0
" Unfortunately the default mappings for vim-sexp are hard
" to press (lots of ctrl & alt), but tpope has us covered:
Plug 'tpope/vim-sexp-mappings-for-regular-people'
" FiREPLace is a plugin for integrating with a Clojure
" nREPL.
Plug 'tpope/vim-fireplace'
" REPLant is a plugin for enhancing your REPL experience
" with vim I develop this, so I've selected my src dir.
Plug '~/src/github.com/SevereOverfl0w/replant'
" A plugin for managing nREPL middleware and starting the
" nREPL.
Plug '~/src/github.com/clojure-vim/vim-jack-in'
" }}}
^ My clojure configurationHeavier perhaps than most language-specific setups, but when you have such power in integration it's really valuable.
They have all sorts of weird things, like having to do the equivalent of )a
before being able to evaluate with some ctrl-x-a-eg-b-a combo. This is because there's only an eval-last-sexpr
instead of being able to do cp
followed by whatever text object you like (`af`)
Just thinking whether to open a tab for later processing, or process now before slack loses it 😉
https://gist.github.com/SevereOverfl0w/121b163cedada964e6a04eea61ff973d already out of date version of my new config
Hi. Is there a way to list what connections vim-fireplace has established? Or turn on some debugging?
I have this situation with cljs where there are two cljs repls started by the app and I have to call a function in the clojure repl that would switch to the appropriate cljs repl (the emacs users have to do this as well and can't rely on the automagic of cider).
I am very unknowledgeable to all this btw, sorry if I assume weird stuff.
The function just does (figwheel-sidecar.repl-api.cljs-repl "blah") it seems.
From the perspective of nrepl, there's only one repl connection. You use your underlying driver to switch, figwheel has a way of switching for example.
Ok, cool. Progress in undestanding at least.
Ok, so the first situation is that when in a clj file, when I eval the switch, it works and I get the figwheel doc output. However, when trying to eval (js/alert "blah") in the same file. it appears fireplace attempts to eval the current buffer as cljs.
This is vim, btw. Not neovim.
The js alert works just fine (shows up in the browser) when I connect to the repl with lein on the cli and switch there.
It appears that there is some magic in fireplace that assumes something about the connection and maybe reconnects instead of reusing the existing switched one?
The second and main problem is that I can't eval anything in a cljs file, that's why I tried to eval the switch in a clj file in the first place.
I get this error
clojure.lang.ExceptionInfo: No such namespace: react-portal, could not locate react_portal.cljs, react_portal.cljc, or JavaScript source providing "react-portal" (Please check that namespaces with dashes use underscores in the Cloju
reScript file name) in file
which kinda makes it seem it didn't load all the necessary cljs stuff.There are several files with dashes and this works for the emacs people, so renaming as it says is probably not the answer.
I have no beef with adding debugging statements like a maniac to fireplace, but I'm not really sure where or what to look for.
Is there a way I could reload it without restarting vim after every change?
I've had some success and actually one output of js/console.log in the browser after doing :Piggieback (the-repl-switcher-fn)
. Can't consistently reproduce the incantation tho :face_with_rolling_eyes:
After outputing twice just moved to printing things to the cli log instead of the browser.
(╯°□°)╯︵ ┻━┻