clojure-vim/clj-refactor.nvim

`crrf` and `crrd` (rename file/directory) result in a Fireplace error

Opened this issue · 3 comments

I can't seem to get crrf or crrd to work at all. When I try, I get errors from Fireplace. One wrinkle is that I'm not exactly sure what I need to enter -- is it acceptable to just enter foo.clj, or do I need to specify the entire path to the new filename?

I tried both of those, resulting in the error messages below. The first two are from crrf, the latter two from crrd.

Error: Error during fireplace#message: Can't find src dir prefix for path foo.clj
"src/workflow/pitch.clj" 31L, 1104C written
Error: Error during fireplace#message: Can't find src dir prefix for path src/workflow/foo.clj
"src/workflow/pitch.clj" 31L, 1104C written
Error: Error during fireplace#message: Can't find src dir prefix for path foo/pitch.clj
"src/workflow/pitch.clj" 31L, 1104C written
Error: Error during fireplace#message: Can't find src dir prefix for path src/foo/pitch.clj
1 change; before #200  1 seconds ago

I think this has to be the absolute path, but there's no reason nvim-refactor shouldn't be expanding this on your behalf.

I can confirm that crrf works when I use an absolute path. One weird thing I noticed, though, is that it did not respect my preference let g:clj_refactor_prefix_rewriting = 0 in my vimrc:

(ns workflow.pitch-test
  (:require [clojure.test :refer [deftest is testing]]
            [workflow
             [foo :as pitch]
             [test-helpers :refer [=ish round]]]))

When I do crcn immediately afterward, it does respect my preference:

(ns workflow.pitch-test
  (:require [clojure.test :refer [deftest is testing]]
            [workflow.foo :as pitch]
            [workflow.test-helpers :refer [=ish]]))

It looks like crrd has the same behavior of not honoring that preference.

hukka commented

After getting a hint I need to have a repl running, I'm now getting
Error: Error during fireplace#message: Can't find src dir prefix for path /home/hukka/repos/reititin/src/reititin/foo.clj
with absolute paths.