Fork me on GitHub
#calva
<
2020-01-24
>
jacquesdpz07:01:44

Hi guys. Has anyone maybe seen this error:

Running the contributed command: 'calva.replWindow.newLine' failed.
I'm on Ubuntu 18.04.3 LTS running Calva Jack-In. The annoying thing is the only way to make it go away is by closing & opening VS Code again.

pez08:01:44

Not seen that. When does it happen? Can you describe some repro?

jacquesdpz12:01:12

@pez at this stage it just starts happening by itself. i'll be working & then all of a sudden the next time i press enter it pops up this error message. from there on new-lines/enter key presses pops up this error every time, until i reopen VSCode. it also happens with my directional keys. is there maybe a way to get more detail on the error? maybe i can get some exception info somewhere in "VSCode diagnostics mode" or something

jacquesdpz12:01:05

oh, i'm also using Calva on another machine, and i haven't seen the error on that Windows 10 one

slack103812:01:21

@jacquesdpz Did you try to Close the repl Window and open it again?

pez12:01:53

Does it happen in the REPL window or also in the editor?

jacquesdpz12:01:54

@slack1038 no, i haven't tried closing the REPL window. i'll try this next time it pops up. i have disconnected from the REPL server & reconnected though & that didn't make a difference...

jacquesdpz12:01:30

@pez it only happens in the editor

jacquesdpz12:01:03

just to make sure, when you guys say the REPL window, are you referring to this one?

pez12:01:15

Yes, that one.

pez12:01:00

Very bad error to happen in the editor. Is this something you can repro, @brandon.ringe?

jacquesdpz12:01:35

i'll double check, but the REPL window's fine. it's the editor that freaks out

pez12:01:06

The problem seems to be that Calva thinks the REPL window is active. Why this would be so is strange and probably a vscode bug with Linux. Hard to fix unless we can reproduce it. It would be great if you had some time to look at it, @jacquesdpz. Do you? I have some time right now to zoom.

jacquesdpz14:01:10

@pez ya, it's hard to reproduce, because thus far i haven't been able to establish a pattern or relate it with something specific that i'm doing - it just happens. also, it's not happening right now. but i won't have time today to zoom. let's see if we can do it next week sometime

pez14:01:43

Cool. Let me know when you have some time.

brandon.ringe15:01:39

I've seen this issue too on Linux @pez, more than once. But it seems very random and I haven't been able to repro, but haven't tried much either. Yeah, it does seem like Calva thinks the REPL window is active while the cursor is in the editor at that point, somehow. I think I've "fixed" it by clicking in the repl window and hitting enter then clicking back in the editor.

brandon.ringe15:01:16

@jacquesdpz if you could create an issue (if you haven't yet) that would be much appreciated.

jacquesdpz11:01:58

sure, will create an issue @brandon.ringe. yes, you are right, it's super random. i will give your workaround a try. anything's better than having to close & open VSCode 🙂

grounded_sage18:01:27

I’ve recently started using the Meander library and clj-kondo is highlighting the ?logic-variables. How do I tell it to ignore them? Or better yet when one is declared and not used?

grounded_sage18:01:47

Damn that was fast haha

grounded_sage18:01:25

@borkdude thank you. I see.. it is treated outside of VScode/Calva.

borkdude18:01:02

yeah, it's just some configuration that applies to clj-kondo independent of editor

grounded_sage18:01:25

I’m curious if there is a way to have it tell me when I declare one of these logic variables and don’t use if within the macro. Don’t expect that to be possible but if it is I will definitely apply it :p

borkdude18:01:47

depends. can you show a code snippet? I don't know meander

borkdude18:01:05

it depends = if it's very much like an existing macro

grounded_sage18:01:13

Oh hang on... I remember why I asked now. I did look at this documentation.

grounded_sage18:01:40

The thing is the logic variables are made up on the fly. It’s not something refer’d in..

borkdude18:01:46

There's also an issue about core.match. Maybe it's the same? Again, don't know the lib

grounded_sage18:01:50

I’m on phone so it’s difficult to copy paste in a code block. This is the library link. https://github.com/noprompt/meander/blob/epsilon/README.md

grounded_sage18:01:30

Sorry. I know it’s not what you asked... I can only link to it at the moment

grounded_sage18:01:17

I’m guessing it would be a similar issue. As it is pattern matching libraries

borkdude18:01:28

so the first map introduces bindings and the last map is the where the bindings are used? I don't know a supported macro that is like this right now.

borkdude18:01:04

if this becomes a popular enough library, adding support for it is possible, but there isn't an issue for this right now, so people haven't asked for it yet

borkdude18:01:32

I'll wait for that. If enough people show interest, it might be added in the future.

borkdude18:01:46

For now you can use the config to disable the unresolved symbols

borkdude18:01:59

if meander also accepts quoted maps, then you could try to use that. I guess the match thing could just be a normal function instead of a macro then

borkdude18:01:41

if it doesn't you could try to ask the lib maintainer to add support for it

borkdude18:01:22

I mean:

(defn favorite-food-info [foods-by-name user]
  (m/match {:user user
            :foods-by-name foods-by-name}
    '{:user
     {:name ?name
      :favorite-food {:name ?food}}
     :foods-by-name {?food {:popularity ?popularity
                            :calories ?calories}}}
    '{:name ?name
     :favorite {:food ?food
                :popularity ?popularity
                :calories ?calories}}))

borkdude19:01:23

doesn't seem to work:

user=> (m/match {:food :a :price {:a 1 :b 2}} {:food ?food :price {?food ?price}} {:food ?food :price ?price})
{:food :a, :price 1}
user=> (m/match {:food :a :price {:a 1 :b 2}} '{:food ?food :price {?food ?price}} '{:food ?food :price ?price})
Execution error (ExceptionInfo) at user/eval6338 (REPL:1).

grounded_sage19:01:15

Yea I’ve only just started using it as of 2 days ago and only became aware of it around then aside from a little earlier in Defn podcast. It’s a minor inconvenience. So how do I ignore unresolved symbols that start with a ?

borkdude19:01:51

@grounded_sage clj-kondo doesn't support that (yet), it's either a fixed set of names in a specific call, or all names in a specific call

grounded_sage19:01:56

All good. Thanks for the insights and quick feedback @borkdude