Fork me on GitHub
#calva
<
2022-04-04
>
Cora (she/her)02:04:47

bumping this again! we'd love if you could test this out with us if you can!!

Max18:04:54

So here’s a weird issue I’m seeing: the “Toggle between implementation and test” command is always asking me if I want to create the file, even if it already exists. Clicking “create” then takes me to the existing file.

1
pez19:04:12

That's weird indeed. Can you reproduce it in a small project that we can have a look at?

Max19:04:44

It seems to work in other projects than the one I’m seeing the issue in. I’ll dig a little more and try to isolate the problem

🙏 1
Max19:04:06

I’ve finally gotten back to looking into this! The issue appears consistently when using a multi-root workspace. You can replicate it with the following steps: • open a clojure project in vscode • run “Workspaces: Add folder to project” with any folder outside the project that contains at least one file • Open a clojure file that has a matching test file in the expected directory • Run “Calva: toggle between implementation and test” Expected behavior; the test file is opened Actual behavior: Calva asks “Create <path to file?” If you click “Create”, it switches to the existing file. If you click “Cancel”, nothing happens (as expected)

seancorfield19:04:41

I reported this a long time ago -- I believe there's still an open GH issue about it...

seancorfield19:04:35

Ah, I closed it because no one seemed to be able to repro: https://github.com/BetterThanTomorrow/calva/issues/1219 (and I didn't care about the feature 🙂 )

pez19:04:53

Do you also have several Workspace folders in your workspace, @U04V70XH6?

seancorfield19:04:51

I did have when I reported that bug, yes. I do not now. And that toggle feature seems to work now. Which points to multiple folders in the workspace as the contributing factor.

pez19:04:30

I can reproduce it with your steps, @U01EB0V3H39. Can you add them to the issue? I reopened it. Let's smash this bug!

seancorfield19:04:45

binds toggle between source and test to cmd-k cmd-t and gets on with his life 🙂

metal 2
Max19:04:54

done!

❤️ 1
rayat20:04:54

I didn't even know this feature existed whoa

pez21:04:53

You were just recruited to review the fix, @U037TPXKBGS 😃 https://github.com/BetterThanTomorrow/calva/pull/1672

😮 1
fabrao19:04:58

Hello, I'm using calva with lacinia and lacinia-pedestal with integrant and I configure the resolvers dynamicaly. But when I start repl I have to require all the namespaces before starting attach resolvers. Is that correct that I have load by hand to all the namespaces been in memory using repl resource?

pez20:04:13

Things you reference need to be known by the REPL so they need to be loaded/required. I think what people often do is to create a dev user.clj with the requires and setup needed. Then you only need to load this file. You can then also create a custom connect sequence including a code snippet for loading the file upon connect. (I hope I understood your question correct, I'm not very familiar with the libraries you mention. https://calva.io/connect-sequences/

1
fabrao20:04:38

yes, thank you

fabrao00:04:25

(ns user
  (:require [aplicacao.sistema :as sistema]))

(defn get-files-from-folder [folder]
  (let [directory ( folder)
        dir? #(.isDirectory %)]
    (map #(.getPath %)
         (filter (comp not dir?)
                 (tree-seq dir? #(.listFiles %) directory)))))

(defn load-namespaces []
  (->>
   (get-files-from-folder "src")
   (filter (fn [v] (or (.contains v "resolvers") (.contains v "infra"))))
   (reduce #(load-file %2) [])))

(defn go []
  (load-namespaces)
  (sistema/iniciar-sistema :prod))

(defn refresh []
  (sistema/finalizar-sistema)
  (sistema/iniciar-sistema :prod))
I solved reading the files from source and loading it manual. It worked like a charm.

pez05:04:01

Oh, that's beautiful! And saves you from the boilerplate that I was sort of suggesting. 😃

Max19:04:06

I’ve finally gotten back to looking into this! The issue appears consistently when using a multi-root workspace. You can replicate it with the following steps: • open a clojure project in vscode • run “Workspaces: Add folder to project” with any folder outside the project that contains at least one file • Open a clojure file that has a matching test file in the expected directory • Run “Calva: toggle between implementation and test” Expected behavior; the test file is opened Actual behavior: Calva asks “Create <path to file?” If you click “Create”, it switches to the existing file. If you click “Cancel”, nothing happens (as expected)