Fork me on GitHub
#calva
<
2021-10-15
>
Fabricio Cozzarolo01:10:39

Hello everyone! does anybody knows a shortcut of Calva or VSCode to jump with the cursor to the beginning of the current line? i know about cursorLineStart but it doesn't do what i want when the code is formatted and i'm on a line that is tabbed. For example, if i'm in the middle of the third line i want to jump to the begenning of default-style symbol (not the real beginning of the row, only where text starts):

(defn headers []
  (let [default-header-text-class "text-xs leading-4 font-medium tracking-wider text-left text-gray-500 uppercase "
        default-style {:padding-top    "12px"
                       :padding-left   "10px"
                       :padding-bottom "12px"}]))
and in second place, about shortcuts too.... is there any for trimming white spaces between words? i know the tab key solves it most of the time but occurs that when i want to disindent a line below the current one i press the del key and the line goes back up but it stays like this:
(defn headers []
  (let [default-header-text-class "text-xs leading-4 font-medium tracking-wider text-left text-gray-500 uppercase "
        default-style {:padding-top    "12px"                       :padding-left   "10px"
                       :padding-bottom "12px"}]
so i would like to trim whitespaces between "12px" and :padding-left (i don't know why tab key doesn't work here) Any help is welcome... and thanks in advance! :)

bringe04:10:57

Calva uses a fork of https://github.com/weavejester/cljfmt, so you may find some help there. I’m not sure if that is possible with some cljfmt setting or not. @U0ETXRFEW probably knows more about this.

pez06:10:30

cljfmt doesn’t trim whitespace between things on the same line. For that particular case you can try the command Format and Align Current Form, but it also does other things so might not always be what you want.

pez06:10:47

For moving the cursor to where text starts on the line there is a VS Code command cursorHome on mac it is default bound to cmd+left.

Fabricio Cozzarolo13:10:40

cursorHomeworked perfect for me to jump to the beginning of the first word thanks! :), but Format and Align Current Form didn't, instead of trimming white spaces it returned :padding-left to the line below again

pez13:10:09

Ah, I didn’t figure that was not what you wanted. Anyway, that’s for the better. We might be removing that command soon. Maybe you can use Join next line (or whatever the command is named when you want to move :padding-left "10px" up. With the cursor somewhere on the default-style line. That would leave only one space, I think. (I might still be misunderstanding what you want to do of course. 😄)

pez13:10:44

cmd+j on mac, btw.

Fabricio Cozzarolo14:10:45

yes it worked 🙂 thank you very much.... the command is editor.action.joinLines

pez18:10:56

Welcome very much! Happy Friday!

valerauko03:10:17

hey can i get some help setting up calva with a dockerized lein repl?

valerauko03:10:49

i can connect to the nrepl server from within the editor, but it acts... weird?

valerauko03:10:24

it starts in the app.core namespace instead of user, and i can't seem to switch namespaces either

valerauko03:10:57

trying to run (println "hello") throws a syntax error at me saying it's Unable to resolve symbol: hello in this context

pez07:10:09

Have you loaded the file? Or any file?

valerauko09:10:39

what does "load the file" mean in calva?

valerauko09:10:54

i've opened the project's folder in vscode, the remote container thing started lein repl headless for me, and i connected

pez10:10:33

Load the file means to trigger the nrepl op load-file which in turn triggers a Clojure (load-file) (and some more, that I’m not completely sure what it is). It is needed to initialize the REPL to know about even core stuff. It’s mentioned here: https://calva.io/try-first/ and probably should be mentioned elsewhere as well.

pez10:10:32

> the remote container thing started lein repl headless for me, and i connected The REPL needs to be started with some dependencies met for Calva to work. There’s a command for copying out the command line that Calva would use to start the REPL, mentioned here https://calva.io/connect/

valerauko12:10:01

thanks! doing the key chord after connecting to the repl solved my issue.

metal 1
valerauko12:10:20

the syntax error above was different though, it's because for some reason when my repl prompt prints, there's a newline afterwards. unless i move to the line of the prompt, the syntax error above happens

valerauko12:10:44

no actually never mind the above, the syntax error thing with (println "hello") still happens, even if i "jack in" and calva installs the cider middleware and all that

valerauko12:10:01

aaaah never mind, figured it out. i was using ctrl+enter to execute while having the cursor inside the string

pez12:10:25

That makes sense. I think that in the REPL window we lose the decorations showing what has been evaluated.

pez12:10:58

I usually recommend people to not use the REPL window much at all for evaluating stuff. Calva embraces Rich Comments rather: https://calva.io/rich-comments/

valerauko03:10:11

i think i'm missing some necessary step in the setup but can't seem to find what

bringe04:10:39

You have a project with a repl running for it inside of a docker container, and you’re trying to connect Calva to the repl in the container, from outside the container?

bringe04:10:35

I haven’t used a setup like that, but let’s see if someone else here has that can help out.

valerauko04:10:04

yes. the port is exposed and i can connect to it all right, but it acts weird

bringe04:10:57

If you get no movement on this soon, feel free to create an issue with an example project and reproducible steps, including the docker details, and maybe we can help you figure it out.

👍 1
craftybones12:10:02

Hello. I’ve a question around shadow cljs. When I jack in I have the option to pick a build, so I end up picking frontend based on this config

{:source-paths
 ["src"]

 :dependencies
 []

 :builds
 {:frontend {:target :browser
             :asset-path "/js"
             :output-path "/public/js"
             :modules {:main {:entries [main.core]}}}}}

craftybones12:10:34

However, despite doing so, I am unable to connect to a runtime. I have connected to the server by opening localhost:9630 on a browser

craftybones12:10:51

I’m a little unclear as to what needs to be done.

craftybones12:10:00

1. Jack in
2. Select a build
3. Hit localhost:9630
4. ....

pez12:10:18

9630 is shadow’s UI, iirc?

pez12:10:54

You’ll need to open the app you are building.

craftybones12:10:36

that’s open too

pez12:10:58

You might need to reload it.

pez12:10:16

Check its console output for any errors as well.

craftybones12:10:16

I think I’ll try the dev-http option instead of doing it manually

pez12:10:56

What’s the dev-http option?

craftybones12:10:33

Shadow lets you specify an additional option that launches a file server

craftybones13:10:11

reloading worked. Not sure what the problem was

craftybones13:10:20

dev-http works too. Quite convenient as well

pez13:10:41

Ah, that one. 😃 It’s what I usually start with as well.

craftybones12:10:42

If I select a browser-repl build though, it does connect to the runtime