This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-23
Channels
- # announcements (5)
- # babashka (22)
- # beginners (240)
- # calva (51)
- # clj-commons (1)
- # cljsrn (9)
- # clojars (12)
- # clojure (81)
- # clojure-australia (2)
- # clojure-europe (40)
- # clojure-france (10)
- # clojure-italy (1)
- # clojure-nl (2)
- # clojure-uk (37)
- # clojurescript (59)
- # clojureverse-ops (2)
- # copenhagen-clojurians (1)
- # cursive (9)
- # datomic (18)
- # emacs (12)
- # fulcro (24)
- # graalvm (48)
- # hyperfiddle (5)
- # introduce-yourself (1)
- # jackdaw (1)
- # jobs (2)
- # juxt (8)
- # lsp (25)
- # malli (8)
- # missionary (1)
- # music (3)
- # off-topic (32)
- # polylith (16)
- # quil (4)
- # re-frame (52)
- # reitit (5)
- # reveal (3)
- # rewrite-clj (26)
- # rum (1)
- # sci (1)
- # shadow-cljs (14)
- # sql (2)
- # tools-build (40)
- # tools-deps (14)
- # vrac (2)
- # xtdb (63)
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?
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]}
(ui-card
{: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"})
nil)
(ui-cardcontent
{}
(ui-cityselector {:label "Origin" :value origin})
(ui-cityselector {:label "Destination" :value destination})
)
(ui-cardactions
{}
(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
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: https://github.com/BetterThanTomorrow/calva/blob/021efe8925adc49585184c5bc0d381394d416a55/src/lsp/main.ts#L74
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.
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
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: https://calva.io/getting-started/
Load current file is similar to eval buffer. There's a command for it. Cmd+Shift+P is your friend. 😀
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 anytingIt's probably something with the shadow-cljs file that Calva can't handle. Is this a fresh clone/copy of the project?
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.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"
"src/test"]
:dependencies [[reagent "1.0.0-alpha2"]
[re-frame "1.1.2"]]
:builds {:app {:target :react-native
:init-fn
:output-dir "app"
:compiler-options {:infer-externs :auto}
:devtools {:autoload true
:preloads [shadow.expo.keep-awake]}}}}
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?