Fork me on GitHub
#calva
<
2021-04-25
>
jeffmcompsci01:04:20

@pez Thanks - that’s not happening. I’ll try deleting extensions and see if I can figure out which one it is.

Sajjad04:04:58

Hi @brandon.ringe I'm struggling with this debugger and REPL and metabse for days OK I got it, There is no need to launch.json in vscode Also I tried your Calva: Fire up the "Getting started" REPL and everything over there works fine, I did lots of alt+enter and ctrl+enter and it was working perfectly. But I really need an example that covers metabase situation that is: In the project there is a log that I know where it is placed so I put a #break over there Then I run the application with lein run and I browse the metabase from my browser do the thing that triggers that log line now I need the debugger to pause the running lein application then I can check the call stack

Sajjad04:04:47

Just give a more realistic example of how to assemble the lein run and REPL and calva debugger

Sajjad04:04:58

Thanks in advance!

Sajjad04:04:32

Also metabase is https://github.com/metabase/metabase and you can check anything you need to know about it

pez05:04:18

@kalantar98 Did you follow the instructions here? https://calva.io/connect/

Sajjad05:04:13

Of course I did, But I get this:

pez06:04:39

Not good. Please file an issue about it. I’ll see if I can figure out a workaround for now.

👍 3
pez06:04:33

Here’s is what you can do: Start the repl like this:

lein update-in :dependencies conj '[nrepl,"0.8.3"]' -- update-in :plugins conj '[cider/cider-nrepl,"0.26.0"]' -- update-in '[:repl-options,:nrepl-middleware]' conj '["cider.nrepl/cider-middleware"]' -- with-profile +repl repl :headless
Then when the message nREPL server started on port … you can use the Connect command instad of Jack-in. Choose Leinigen as project type.

👍 3
Sajjad12:04:10

Ok, I created new issue in github

Sajjad12:04:52

but seems like combination of these commands doesn't run metabase application after all, right?

Sajjad12:04:14

I still need something like lein run, how to do it?

pez12:04:41

Combination of which commands?

Sajjad12:04:14

lein update-in :dependencies conj '[nrepl,"0.8.3"]' -- update-in :plugins conj '[cider/cider-nrepl,"0.26.0"]' -- update-in '[:repl-options,:nrepl-middleware]' conj '["cider.nrepl/cider-middleware"]' -- with-profile +repl repl :headless and then connect to running REPL

pez12:04:15

The app should be running if you issue the command I pasted above. Is it not?

Sajjad12:04:41

No, lein run, runs the application, it sets up database and listens to port 3000, but this command does just some of driver builds and thats it, nothing more, You can see yourself if you have anydesk

Sajjad12:04:54

Or you can clone metabase and try yourself

pez12:04:27

Try replacing the +repl in the command with +run-with-repl

Sajjad12:04:37

Ok, I will try it

pez13:04:13

What is anydesk, btw?

Sajjad13:04:54

Anydesk is a free software for remote control You can access my system and do whatever I granted permission to you! You can see my monitor, and use your mouse and keyboard to do anything

Sajjad13:04:48

Yeeeeeeeeeeeees @pez, You did it, Now debugger works +run-with-repl worked Thank you very very much But still I have an issue, call stack doesn't show whole call stack, it just shows current function:

pez13:04:06

I’m not completely in the know with what you can expect here, but the lack of a call stack might be a limitation. I think it is within reach to implement, though. You are welcome to file an issue, and of course also welcome to provide a PR.

pez13:04:30

Glad you got it running! I will have to look into how we make jack-in work with this project.

Sajjad13:04:34

All solutions were yours, thank you again!

Sajjad13:04:37

There is at least more than 3 files that gets involved before reaching the running code to here, it's not possible this specific line of code get's running firstly just by itself, of course it is called from somewhere else, I wanted to know whose the caller

pez13:04:14

Yeah, for that use case the call stack is super. Please file an issue about it.

pez13:04:06

And we should probably mention that there is no call stack yet in the docs, right, @brandon.ringe?

Sajjad13:04:17

OK, But is there any solution for me right now?

Sajjad13:04:09

project is really big, I need to know who calls that specific part so I can understand that part and debug the bug

pez13:04:04

Well, outside of Calva there is CIDER, which does implement the call stack for this debugger. And then there is Cursive which has the most sophisticated Clojure debugger I know of. Sticking with Calva you can instrument more functions that you suspect are called, or hook in Reveal and tap> things in the suspected paths. Or try the flow-storm debugger (which is a trace debugger, I don’t know how useful for this use case). https://github.com/jpmonettas/flow-storm-debugger

pez13:04:00

You can of course also sprinkle (println …) around and see what gets printed. I often do that.

Sajjad13:04:40

Thank you, I will try them, but no println won't help me in my case

bringe23:04:16

I'll look into the call stack thing. @kalantar98 I'm glad you got debugging working. You can also look at tools.trace for trace debugging, which may be helpful to you. https://github.com/clojure/tools.trace

👍 3
bringe23:04:11

I haven't really used it myself, so I'm not sure if it can do what you need.

👍 3
🙏 3
Sajjad01:04:05

OK, thank you

Sajjad05:04:35

I tried all the options it had

pez06:04:29

@jeffmcompsci, did you have any luck finding out if something was hogging the ctrl+alt+enter binding? Another thing you can try to just check that the basic functionality is working, is to run the command from the command palette.

jeffmcompsci04:04:11

Not yet. My day job is interfering with my fun. I’ll be investing more time in Clojure this weekend and let you know which one it is. ;)

jeffmcompsci17:04:59

Found it! I use a utility called Magnet to place my windows. It had a key binding (ctrl-alt-enter) to maximizing a window. I changed it & all is well with Calava! 🙂 Thanks!

pez17:04:20

Awesome. I also use Magnet, actually. Should have thought about that clash.

👍 2
paulbutcher09:04:42

This is a VSCode question, not a Calva question, but I thought I’d try my luck here first as I imagine there’s a better chance someone here will have experienced this particular issue: I’m developing on Windows via WSL. So I’ve got a Git repository checked out within the WSL file system, and I’m editing it using VSCode via the network share that’s automatically created by WSL. This all works fine, except… I have one particular file within my repository called bin/build , a shell script that’s used during the Heroku build process. Whenever I open the project within VSCode that one file (and only that one file: none of my Clojure source code or anything else is affected) shows as modified within VSCode’s Source Control tab. It’s modified because it’s had its line endings changed to Windows CRLF style endings. This is all without me opening or editing the file in any way. Does anyone have any idea what might be going on here? Any clue what I could do to fix it? Thanks in advance!

pez09:04:35

Does it help to save it in that state? Not suggesting it as a solution, just curious.

paulbutcher09:04:55

Interesting! No, it doesn’t. It still shows up as modified.

paulbutcher09:04:36

I just tried getting rid of the executable flag too in case that was the cause (it’s the only executable file in my repo)

paulbutcher09:04:47

And still the same behaviour

pez09:04:12

Super odd. I think making a tiny repro of this and filing as an issue on the VS Code repository is the way to go.

paulbutcher10:04:19

Will do. Thanks for your help.

pez10:04:48

“help” 😃

3
pez09:04:27

@qythium (at least I think it was you), you posted about comment styling the other day/week. Seemed you had found a solution using a gutter icon. Is it something you did using the comment styling setting that Calva provides, or did it involve something more? Asking because I just realized that I can style (comment …) forms such that they show up with a special color in the overview ruler. Like so:

"calva.highlight.commentFormStyle": {
        "overviewRulerColor": "green",
        "overviewRulerLane": 1
    },
Where the lane is taken from this enum in the vscode type defintion file:
export enum OverviewRulerLane {
        Left = 1,
        Center = 2,
        Right = 4,
        Full = 7
    }
Was it something similar you did for the gutter?

yuhan09:04:01

Yup, I looked up the textDecoration API and found the key. Here's what I had set it to, where the png is just a 1x1 coloured pixel:

"calva.highlight.commentFormStyle": {
        "gutterIconSize": "cover",
        "gutterIconPath": "/Users/yuhan/Desktop/010.png",
}

yuhan09:04:17

I did try the overviewRuler too, but found that once you scrolled offscreen it would disappear

pez09:04:30

Yes, Calva only decorates forms in view.

yuhan09:04:39

The overview ruler seems like an exception though, it's supposed to be for scanning the entire buffer - although specifying that via text decorations is probably not right

pez09:04:54

I think Calva Highlight might be worth a documentation page of its own. Then we could host these ^ tricks on that page.

pez09:04:21

That the overview ruler can be hit with styling is more of an internal “accident”. But it could be good to know about that it can be done, I think.

yuhan09:04:06

oh, one more weird thing I found - the "Print Stacktrace" button is repeated many many times for any error message, stretching far off the screen. Not sure if this is intended?

pez09:04:33

Not intended. It’s an ugly glitch. Don’t know if it has been reported, but it should. I imagine it should be easy to fix.

yuhan09:04:14

Coming from Cider, the error reporting in general isn't great, and I imagine that's one of the things which might be offputting to beginners

yuhan09:04:55

• most of the error message is hidden offscreen in the repl window which doesn't word-wrap, and I have to resize the window to see the full message, then resize it back again to see my main window

yuhan09:04:45

• 90% of the stack trace is irrelevant cider-nrepl.middleware or clojure.repl wrappers - there is orchard/cider-nrepl functionality to filter these things out interactively

pez09:04:09

Make it word wrap?

pez09:04:45

We had filtering in the old implementation, but it hasn’t fond its way back since. A start could be that there are several buttons for printing the trace. Or maybe two. Full + some sanely filtered one.

pez10:04:50

Personally I almost never look at the stack traces, so am not feeling this pain properly.

yuhan10:04:25

That would be quite a welcome change 🙂 I think a nice default would be for "Project" stacktraces to be printed by default, and a "Show More" button to see the full trace

pez10:04:20

The lowest hanging fruit is to just have two buttons. “Stack trace (project)“, “Stack trace (full)“.

pez10:04:16

PR welcome. 😃

yuhan10:04:12

heh, I know very little about VS code's extensions, just been test-evaluating Calva because new members on our team are using it

pez10:04:29

At a minimum you can file an issue. 😃

👌 3
pez14:04:24

Btw, I think you would fix this within one hour. Knowing nothing about VS Code extensions, getting the dev env up, finding where to apply the change, and change it. Hacking on Calva is most often very easy. Just FYI.

bringe02:04:05

I've seen this before too but haven't been able to repro consistently. If you can repro consistently it may be much easier for you to fix if you did find the time. No worries if not though. simple_smile

pez04:04:54

For the record, my assessment was about adding the filtering. 😃

👍 2
bringe15:04:39

I wasn't sure, myself, lol. Thanks. But, @qythium, if you can provide a consistent repro for the duplicate code lenses, that alone would be awesome as well.

yuhan16:04:06

It only seems to happen in our full codebase with lots of dependencies, I'll see if it can be reproduced at a smaller scale

pez16:04:25

I haven’t seen a pattern to it. But I’ve seen it quite often.