calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
jeffmcompsci 2021-04-25T01:40:20.188700Z

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

jeffmcompsci 2021-04-25T01:40:28.188900Z

@qmstuart Yes

Sajjad 2021-04-25T04:10:51.189200Z

@brandon.ringe Note was useful, Thanks

👍 1
Sajjad 2021-04-25T04:25:58.199Z

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

Sajjad 2021-04-25T04:26:47.200Z

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

Sajjad 2021-04-25T04:26:58.200300Z

Thanks in advance!

Sajjad 2021-04-25T04:40:32.201100Z

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

pez 2021-04-25T05:01:18.202200Z

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

Sajjad 2021-04-25T12:37:10.223Z

Ok, I created new issue in github

Sajjad 2021-04-25T12:38:52.223200Z

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

Sajjad 2021-04-25T12:51:14.223400Z

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

pez 2021-04-25T12:55:41.223600Z

Combination of which commands?

Sajjad 2021-04-25T12:56:14.223800Z

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

pez 2021-04-25T12:56:15.224Z

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

Sajjad 2021-04-25T12:57:41.224200Z

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

Sajjad 2021-04-25T12:57:54.224400Z

Or you can clone metabase and try yourself

pez 2021-04-25T12:58:27.224700Z

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

Sajjad 2021-04-25T12:58:37.224900Z

Ok, I will try it

pez 2021-04-25T13:02:13.225100Z

What is anydesk, btw?

Sajjad 2021-04-25T13:08:54.225300Z

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

Sajjad 2021-04-25T13:11:48.225500Z

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:

Sajjad 2021-04-25T13:12:23.225900Z

pez 2021-04-25T13:21:06.226400Z

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.

pez 2021-04-25T13:22:30.226600Z

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

Sajjad 2021-04-25T13:26:34.226800Z

All solutions were yours, thank you again!

Sajjad 2021-04-25T13:26:37.227Z

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

pez 2021-04-25T13:28:14.227200Z

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

pez 2021-04-25T13:29:06.227400Z

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

Sajjad 2021-04-25T13:29:17.227600Z

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

Sajjad 2021-04-25T13:30:09.227800Z

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

pez 2021-04-25T13:36:04.228Z

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

pez 2021-04-25T13:38:00.228300Z

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

Sajjad 2021-04-25T13:40:40.228500Z

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

bringe 2021-04-25T23:42:16.229Z

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

👍 1
bringe 2021-04-25T23:43:11.229300Z

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

👍 1
🙏 1
Sajjad 2021-04-26T01:56:05.229800Z

OK, thank you

Sajjad 2021-04-25T05:19:35.203Z

I tried all the options it had

pez 2021-04-25T06:36:39.203100Z

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

👍 1
pez 2021-04-25T06:48:33.203300Z

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.

👍 1
pez 2021-04-25T06:57:29.204900Z

@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.

jeffmcompsci 2021-04-28T04:27:11.263300Z

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. ;)

jeffmcompsci 2021-04-28T17:11:59.276500Z

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!

pez 2021-04-28T17:50:20.276800Z

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

👍 1
paulbutcher 2021-04-25T09:00:42.209700Z

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!

pez 2021-04-25T09:04:35.210500Z

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

paulbutcher 2021-04-25T09:10:55.210600Z

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

paulbutcher 2021-04-25T09:12:36.211100Z

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)

paulbutcher 2021-04-25T09:12:47.211400Z

And still the same behaviour

pez 2021-04-25T09:17:12.212100Z

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.

pez 2021-04-25T09:23:27.216200Z

@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?

yuhan 2021-04-25T09:31:01.216300Z

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",
}

yuhan 2021-04-25T09:32:17.216500Z

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

pez 2021-04-25T09:36:30.216700Z

Yes, Calva only decorates forms in view.

yuhan 2021-04-25T09:42:39.216900Z

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

pez 2021-04-25T09:43:54.217500Z

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

yuhan 2021-04-25T09:45:06.218700Z

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?

bringe 2021-04-26T15:52:39.255400Z

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.

yuhan 2021-04-26T16:01:06.255600Z

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

pez 2021-04-26T16:11:25.255800Z

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

pez 2021-04-25T09:45:21.218800Z

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.

yuhan 2021-04-25T09:45:41.219200Z

pez 2021-04-25T09:46:33.219600Z

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.

yuhan 2021-04-25T09:48:14.219800Z

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

yuhan 2021-04-25T09:50:55.220Z

• 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

yuhan 2021-04-25T09:52:45.220200Z

• 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

pez 2021-04-25T09:57:09.220400Z

Make it word wrap?

pez 2021-04-25T09:59:45.220600Z

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.

pez 2021-04-25T10:01:50.220800Z

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

yuhan 2021-04-25T10:16:25.221Z

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

pez 2021-04-25T10:28:20.221200Z

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

pez 2021-04-25T10:37:16.221400Z

PR welcome. 😃

yuhan 2021-04-25T10:43:12.221600Z

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

paulbutcher 2021-04-25T10:46:19.222Z

Will do. Thanks for your help.

pez 2021-04-25T10:49:29.222200Z

At a minimum you can file an issue. 😃

👌 1
pez 2021-04-25T10:49:48.222400Z

“help” 😃

1
pez 2021-04-25T14:02:24.228700Z

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.