Fork me on GitHub

Quite often after I have deffed a new var, the autocomplete won't kick in until I have written several characters of the new symbol. Is there something I'm doing wrong?


So, you def it and then later want to reference it?


In general autocomplete after first char gives only builtins, two chards gives nothing (if it doesn't match builtins) and only third char ever starts autocompleting to local vars. But sometimes just deffed new var needs so much input that nothing older would match, and I think usually one more (so there's always one point where nothing older matches, so no results are given)


Interesting. I’ll test this myself a bit and see if we have a general glitch or if there is something with your config.


I think the problem is larger than just defs. For example if I destructure a new key in function props, the autocomplete won't pick it up at all if it's a subword of already existing autocomplete/suggest target


This is a far cry from a smallest possible replication, but just as an example I just now am working with this kind of fulcro component

(defsc Leg [_ {:keys [type origin destination]}]
  {:query [:type :origin :destination]}
   {:sx {:margin "2rem" :maxWidth 575}}
   (case type
     ; TODO Looks different for comparison. Needs to be refactored into a helper component.
     :flight (ui-cardheader {:avatar ((interop/react-factory Flight)) :title "Flight" :subheader "Helsinki–Stockholm"})
     :train (ui-cardheader {:avatar ((interop/react-factory Train)) :title "Helsinki–Turku" :subheader "Train"})
     :ferry (ui-cardheader {:title "Turku–Stockholm" :subheader "Ferry"})
    (ui-cityselector {:label "Origin" :value origin})
    (ui-cityselector {:label "Destination" :value destination})
    (ui-iconbutton {:aria-label "delete" :color :warning} ((interop/react-factory Delete))))))
I just added the destination param. I already have a function named destinations-from , and the suggestion flat out refuses to complete the shorter destination


origin will show in suggestions after inputting orig but not before


(so or will suggest the builtin, and ori will give empty list of suggestions)


I think this is a question for #lsp. It is what provides completions for local vars.


Ok, thanks


I tried to run the lsp with tracing on, but I have to say that I don't really see any of the suggestions going over the wire. It seems that it does get all the time all the symbols in global scope, but none of the buildins or function parameters.


What do the symbols before the suggestions mean? Seems like the global symbols are always something like a box in brackets, and parameters have "abc"


builtins have kind of two sheets. Do they all come from lsp or are there several suggestion mechanisms in play?


I found the relevant page for vscode itself, but the intellisense types don't seem to match how calva uses them


To be honest I don’t know what the symbols indicate, but if you do find info on that please point us there. I haven’t looked it up. If the repl is not connected, all suggestions come from either vs code itself or clojure-lsp, otherwise, some come from the repl, depending on what it is.


Actually, to correct what I just said, if the repl is connected, none of the suggestions come from clojure-lsp:


What I said previously applies to hovers, I believe.


That means there’s a chance we can fix this by doing something similar that we do with hovers and definition jumps, right? If clojure-lsp helps with it, of course, but I think it does.

👍 1

In any case, the dynamic lookups never work with locals, never had.


Something is suggesting those too, though. Some vscode generic thing? The "abc" symbol kinda feels like just arbitary completion to any words in the open file. Just haven't figured out why it needs so much input to trigger.


Yeah, it seems that is correct, @U8ZQ1J1RR.


any one seen calva return syntax error when evaling forms, doing the same in cider works I am less familiar with calva and what might cause this


Could it be that you haven't loaded the file?


I have jacked in to the main file, it could be is that the equivalent of eval buffer in cider


To familiarize yourself with Calva you can try the Getting Started REPL:


Load current file is similar to eval buffer. There's a command for it. Cmd+Shift+P is your friend. 😀


I was searching for eval not load file thanks for that I will give it a try


I am having a problem to connect repl of RN with jack-in; Creating cljs repl session

; Connecting cljs repl: Hello RN Shadow...
;   The Calva Connection Log might have more connection progress information.
; Error while connecting cljs REPL: TypeError: Cannot read property 'search' of undefined
; Jack-in done.
clj꞉shadow.user꞉> (+ 2 2)
Is this "search" of undefined related to my code because I don't have this word anywhere in my repo. It looks like it's connected but I can't evaluate anyting


It's probably something with the shadow-cljs file that Calva can't handle. Is this a fresh clone/copy of the project?


no it's not but my friend tried on her mac it worked there but doesn't work on linux


Now I run application wtih this npx shadow-cljs watch app when I run in other terminal shadow-cljs cljs-repl app I was able to connect to the repl and execute (js/console.warn "test") but I can't execute stuff from vs code


is it possible to run shadow-cljs cljs-repl app from calva @U0ETXRFEW


Not really, but you can probably run it from the command line in a way that Calva can connect and things work. Try with this command:

npx shadow-cljs -d cider/cider-nrepl:0.26.0 watch app
Then connect from Calva.


it's connected with this way but can't evaluate (+ 2 2)


clj꞉shadow.user꞉>  ; Use `alt+enter` to evaluate
; Creating cljs repl session...
; Connecting cljs repl: shadow-cljs...
;   The Calva Connection Log might have more connection progress information.
; Error while connecting cljs REPL: TypeError: Cannot read property 'search' of undefined
(+  2 2)


Ah, so connect also tries to parse the shadow-cljs.edn file of course… And it works on Mac but not on Linux… Hmmm, can you paste the file content here?


{;:deps {:aliases [:dev]} ; In a real app consider using `deps.edn` instead.
 ; If you use deps, remove `:source-paths` and `:dependencies` from this file
 :source-paths ["src/main"
 :dependencies [[reagent "1.0.0-alpha2"]
                [re-frame "1.1.2"]]
 :builds       {:app {:target           :react-native
                      :output-dir       "app"
                      :compiler-options {:infer-externs :auto}
                      :devtools         {:autoload true
                                         :preloads [shadow.expo.keep-awake]}}}}


That looks totally fine…


I will try with a fresh project


I just tried a fresh project on Gitpod (which uses Ubuntu). That worked.


But so did your shadow-cljs.edn file, How strange…


Which versions of VS Code and Calva are you using?


vscode 1.60.2 and calva v2.0.211


now I am testing with a fresh project


OK. I am using 1.60.1 on my mac. Maybe something has happened there…


No, still works on 1.60.2. I guess that is good…


now I have another issue I couldn't test on fresh project yet 🙂


Which issue? 😃

Jacob Rosenzweig21:09:43

I get an error like Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'cider.nrepl.middleware.debug/breakpoint-reader when trying to use the #break feature in calva with vscode. Any ideas?


How do you start the repl?