Fork me on GitHub
#calva
<
2019-01-30
>
claynon09:01:35

btw, changing the clear all inline display of evaluation results from ctrl+esc to esc was great for me. My sore pinky thank you (I don't know when that changed, but I believe it wasn't long ago)

pez09:01:01

It was with the latest release. Unfortunatelly users of vscodevim are not as happy. But we will fix that too. 😃

vim 15
il-tmfv16:01:27

Hi! I’m using latest (1.3.61) calva for cljs project and some weird error started to appear. For some reason “Evaluate current file” produces this Command 'Calva: Evaluate current file' resulted in an error in a form of popup. I don’t see anything else in other windows. And I think it is reproducible in every file. But I can evaluate forms without problems. And I see docs for core fns. My ~/.lein/profiles.clj:

{:user {:plugins [[lein-kibit "0.1.6"]]}
   :repl {:plugins [[cider/cider-nrepl "0.19.0"]]
          :dependencies [[cider/piggieback "0.3.10"]
                         [figwheel-sidecar "0.5.16"]]
          :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}}
Lein v2.7.1 And this is how I start my figwheel app:
lein repl
(use 'figwheel-sidecar.repl-api)
(start-figwheel! "id1" "id2")
(cljs-repl)
Also I tried to select whole file and eval it with “Evaluate selection or current form”. In this case I actually see meaningful error in “Calva says”:
Error: clojure.lang.ExceptionInfo: No such namespace: hb.front.state, could not locate blah/front/state.cljs, blah/front/state.cljc, or JavaScript source providing "blah.front.state" in file <cljs repl> {:tag :cljs/analysis-error}
In this file ns declaration looks like this:
(ns blah.front.offers-list.checkboxes
  (:require-macros [reagent.ratom :refer [reaction]])
  (:require [clojure.string :as string]
            [blah.common.helper :as h]
            [blah.front.state :refer [state]]
            [reagent.core :as reagent]))
Tried to rollback to 1.3.60: still see docs, “Evaluate current file” produces “No results from file evaluation.” in “Calva says”. But “Go to definition” is not working. For simple app created with figwheel template everything works fine.

claynon16:01:10

Evaluate current file was (I don't know what changed in the latest version) a bit problematic, they are working on improving it in the meantime what I do is select all (cmd+a) and then evaluate current top level form (ctrl+alt+p SPC)

pez16:01:07

@il.tmfv Go to definition works in the simpler project?

claynon16:01:45

what happens when you select all and evaluate the forms?

claynon16:01:26

because go to definition don't work before evaluating the file, so if you try evaluating the whole file and it doesn't work because of some syntax problem the go to definition will most likely not work

il-tmfv16:01:02

@claynon thanks for advice, but it is the same as for “Evaluate selection or current form”:

Error: clojure.lang.ExceptionInfo: No such namespace: blah.front.state, could not locate blah/front/state.cljs, blah/front/state.cljc, or JavaScript source providing "blah.front.state" in file <cljs repl> {:tag :cljs/analysis-error}
Also I noticed that sometimes switch clj -> cljs in status bar doesn’t happen. I need to restart repl and vs code

claynon16:01:18

Oh I'm sorry, I haven't seen your report on the evaluate the current form

il-tmfv17:01:38

also I tried to play with calva.projectRootDirectory setting cljs code in our project located under ./clojure directory, but project.clj in a workspace root but with no results

pez17:01:07

I think that if project.clj is in workspace root, then that is the correct projectRootDirectory.

pez17:01:16

@il.tmfv can you confirm that it doesn’t matter which file you are evaluating? Also, check that you don’t have dashes instead of underscores in the path to the files.

il-tmfv18:01:40

hm, I think I got it. I’ve done some more tests. We have 2 apps (build ids) in our project: “front” & “extranet” I start fighwheel with

(start-figwheel! "extranet" "front") ;; 
But actually order of build-ids doesn’t matter. It feels like they sorted (not sure how) and (cljs-repl) call starts repl for “extranet” anyway (with command from calva.startCLJSREPLCommand setting). So if I start figwheel with 2 builds then I will connect to repl for last completed build (in my case it is “extranet” each time), then I can navigate in shared files and in “extranet” files. If I start figwheel with only “front”, then I can navigate in “front”-related and shared files. But File evaluation still fails with popup. I can trigger file eval with saving file - then everything works fine (in the build scope as I described above). Sorry about this. I’m not so experienced in cljs world 😐 ------- Maybe somebody knows how to switch repl build quickly? Also maybe it can be implemented in calva?

pez19:01:19

^ @mseddon ^ check this

il-tmfv19:01:41

Is it right? - I start repl it a terminal - calva connects to it via lein repl :connect localhost:12345 - basically another process starts (I see extra java process) - then calva sends command from calva.startCLJSREPLCommand - and it starts cljs repl So basically I need to change calva.startCLJSREPLCommand command each time and restart vs code if I want to navigate in files from multiple builds, don’t I?

pez19:01:41

I think that we should have a way to switch between builds. We have that for shadow-cljs. But in waiting for that, what happens if you use the repl you started figwheel from to switch builds?

mseddon20:01:39

@il.tmfv you can always :cljs/quit from the cljs repl, to drop back into clj

mseddon20:01:47

then start figwheel with a different build

il-tmfv20:01:40

I will try tomorrow. I think I don't even need to restart figwheel, cljs-repl takes build id

mseddon20:01:12

I use figwheel main mostly these days, so I'm a bit rusty on figwheel- #figwheel ofc may have the answers you are looking for

mseddon20:01:30

if you do learn anything, please feed back to us so we can make it a little less painful from within calva itself!