Fork me on GitHub
#calva
<
2021-09-24
>
Alexis Schad09:09:53

Hi there, I am on a shadowcljs project with multiples source paths, and I was wondering if the REPL launched by Calva can handle them. It seems that the REPL only knows default src/ source path. Do I need to use a custom REPL connection?

bringe15:09:58

> It seems that the REPL only knows default src/ source path What trouble are you having? Is the repl unable to evaluate things in other paths, or are you not getting some other specific feature to work?

Alexis Schad15:09:43

> Is the repl unable to evaluate things in other paths, yes, it can't find namespaces in a source path other than src/ (the require fails)

Alexis Schad15:09:50

To be more precise, I want to use the debugger in a cljc file and the evaluation of the (ns (:require ...)) fails with ̀Could not locate ...`. It's a web app and in the browser it works well with the sources paths set in shadow-cljs.edn.

bringe16:09:56

The debugger only works with Clojure, so I’m not sure it will/should work with .cljc files. I haven’t tried it, though. Regarding the require failing, it’s hard to say what the problem may be without some project for reproducing that I could look at. Feel free to create an issue and link to a repo in which you can reproduce the issue.

Alexis Schad16:09:47

The debugger works, I'm using it all the time (the default REPL for cljc files is the clojure REPL). Yes I will create a minimalist project to reproduce the issue.

👍 1
Alexis Schad17:09:06

hmm ok, I found why with the minimalist project. I have to evaluate the required files first and then it works. Source paths tricked me that wasn't the point. Thanks for the help!

bringe03:09:42

Glad you got it working! No problem.

bringe03:09:55

It does seem though that evaluating the required files first should not be required, as evaluating the file that requires them should in turn evaluate those files. The fact that that doesn’t happen may be related to source paths, though. If you still feel something isn’t happening that should be, please file an issue.

Alexis Schad12:09:54

I think you got the point, that's why I was in troubled this time and not usually. I'll try to reproduce this again in the minimalist project I've made and create an issue.

👍 1
cjsauer17:09:27

👋 hey all, my editor is suddenly not placing the cursor at the proper indentation level after starting a new line. I’m sure this is something simple, but I can’t find the proper setting that would have caused this. Has anyone encountered this before?

pez18:09:34

Du you use the VIM extension maybe?

cjsauer17:09:09

Oddly it seems to place the closing paren in the correct place, it’s just the cursor itself that is incorrectly placed at the beginning of the line

cjsauer17:09:17

Ah! Turning off this New Indent Engine setting seems to have fixed that problem. Not sure what I’ve opted out of tho…

seancorfield18:09:12

I was seeing strange indentation behavior on new lines recently and wasn't sure why. I'll try turning this off and see if it improves. Thanks.

pez21:09:27

Interesting find. Very strange though. In theory (made from my understanding of how I have wired these things) it shouldn’t matter which indent engine you use in relation to the problem reported. I’ll need to tale a good look at it…

cjsauer01:09:24

I do use the vim extension, like you said in the other thread. Maybe something with the new indent engine is conflicting with that plug-in.

pez07:09:29

It's a recently introduced conflict. https://github.com/VSCodeVim/Vim/issues/6992 You could add that finding to the issue, @U6GFE9HS7 , that the old indent engine works for you. Though I think it might be a matter of timing. The old engine is much slower so “wins“ over the VIM extension by getting later to the party.

colinkahn21:09:26

Hello, is there a way to get the quoted form for use in a custom repl command? https://calva.io/custom-commands/ Going from the examples I tried something like: "snippet": "(quote $current-form)" but it resulted in just $current-form as a symbol, not the expression itself quoted.

pez21:09:16

Hmm, very interesting question. It’s late here and my brain is not working, but anyway, all that is happening with these snippets is that Calva will replace $current-form and send it to the repl. Can you elaborate a bit more on what happens when you try it and what you want to happen?

colinkahn21:09:27

Lets say I evaluate that custom command with (do :foo) as $current-form, i would expect it to result in '(do :foo) (the quoted version), instead I get, literally, '$current-form

pez21:09:08

Let me try that…

pez21:09:08

With this snippet definition:

"calva.customREPLCommandSnippets": [
        {
            "name": "foo",
            "snippet": "(quote $current-form)"
        }
    ]
I get (do :foo) as the result.

colinkahn23:09:25

@U0ETXRFEW sorry, my minimal reproduction was too minimal 🙂 , it is an issue if you use $current-form twice in the snippet, like so:

"calva.customREPLCommandSnippets": [
    {
        "name": "foo",
        "snippet": "(vector $current-form (quote $current-form))"
    }
    ]
This will output for the expression (do {:foo :bar}):
(vector (do {:foo :bar}) (quote $current-form))
[{:foo :bar} $current-form]

pez05:09:51

Gothcha. Please file an issue. Should be easy to fix.