Fork me on GitHub
#calva
<
2024-03-25
>
Thierry12:03:02

Recently something has changed that's causing most evaluation output results in the repl window in VScode being preceded by a semicolon. I've been trying to find where this is set (including reading back in this channel) but have been unsuccessful in finding a solution. Does anyone have quick pointer for me before I pull my hair out?:rolling_on_the_floor_laughing:

pez12:03:49

It’s that way because output was breaking the structure of the Clojure document of the REPL Window. There are now two additional output options that you can consider that do not print output prepended by semicolons. See https://calva.io/output/

Thierry12:03:13

So it's no longer possible to have it print to the repl window without a semicolon?

Thierry13:03:16

I'm kinda used to having the evaluation output in the Repl window being in color and never use the output tab. The jack-in terminal shows my projects automatic evaluations.

pez13:03:22

It’s no longer possible.

Thierry13:03:32

oh noo 😞

Thierry13:03:58

How was it breaking the structure ?

pez13:03:36

It caused too much trouble. See if you can use the terminal output option or a combination of the repl window for result and the terminal for output.

Thierry13:03:18

No I can't, the project I work on has constant processes running in the background that print to the terminal window

pez13:03:27

It breaks structure if the output contains unbalanced brackets, or unmatched quotes. Or some backslash and probably some other situations.

Thierry13:03:34

The output Window is something I never use

Thierry13:03:18

Mhh I clean my repl window most of the time when it goes over +/- 500 ~ 1k lines

pez13:03:29

Not sure how the constant process prevents you from using the terminal output destination?

Thierry13:03:44

Let me make a screenshot

pez13:03:52

We are probably going to retire the repl window as an output destination entirely at some point. It has performance problems that are a bit too involved to fix.

Thierry13:03:24

Mhh, imho that kinda sucks

pez13:03:24

Well, we will not retire it until we have some alternative that doesn’t suffer the performance problems.

Thierry13:03:09

The terminal window below contains process logging from the project

Thierry13:03:15

this is semi continous

Thierry13:03:32

not an option for me to see my repl evals

pez13:03:33

Well, the terminal output destination does not print into the Jack-in terminal. It’s a separate terminal. You can display it in split view or drag it into the editor area.

Thierry13:03:14

you mean the one on the left here?

Thierry13:03:26

just pulled it into view

Thierry13:03:14

Doesn't really feel intuitive to have the result of a repl evaluation print in a window other then the actual repl to me.

Thierry13:03:23

Doesn't that defeat the actual use of a repl in the same window?

pez13:03:37

Not following.

Thierry13:03:42

Read Eval Print, to me means type something, evaluate it and print the outcome? If the print isn't in the same window you can easily overlook it? Plus adding another window/tab means having more to monitor? Sorry if I sound like an ass, just very used to the way it was

Thierry13:03:07

Will try the way you have it, my output window is not in color nor does it autoscroll, is that a setting?

Thierry13:03:41

oh my.. this is really confusing. the repl doesn't always give a new input prompt after evaluation

pez13:03:09

That’s a bug if so.

pez13:03:22

I didn’t even know there was a log file for the Output channel.

Thierry13:03:23

If you reevaluate something above your current cursor location you do not get a new prompt. It does when sing repl-window as output

Thierry13:03:45

sing = using

pez13:03:02

I’ll have a look at that.

pez13:03:44

Or, actually. If the new prompt would look the same as the current prompt, we skip printing it on purpose.

jussi13:03:49

Auto Scrolling is afaik controlled bu VS Code button, see image.

jussi13:03:25

Mine was off by default..

pez13:03:27

I recommend trying with the terminal as the destination instead. It autoscrolls more intuitively.

Thierry13:03:48

how do you get the output window in the editor area, I can only seem to get the log file there?

pez13:03:53

The output channels lock scrolling when you click somewhere in them.

pez13:03:29

You can’t get the output channel in the editor area. But the with the terminal output, you can.

Thierry13:03:40

terminal window is not an option. for me still it is counter intuitive to have your repl eval output not below the code you evaluate (unless you ofcourse evaluate it from some other file then the repl window)

jussi13:03:42

Same image as above ... menu shows 'Open Output in Editor'

👀 1
👍 1
jussi13:03:03

(read-only tho)

Thierry13:03:30

Thats what I used

Thierry13:03:39

it doesnt auto scroll for me tho

pez13:03:53

Ah, so that’s where the log came from. TIL.

pez13:03:21

So, why is the terminal destination not an option. That is totally unclear to me.

chromalchemy13:03:35

I’m curious and optimistic to try the new setup. One think I like about the repl output being in the editor window is that I can use regular vscode commands to navigate, select, and copy text/data from output. I use Cursorless, so I can say “bring” and target a specific data structure, token, or keyword from the output to fluently splice it back in to my working code. That being said I also clear the repl results regularly. (One reason is to see the top of the data, not auto-scroll). Cursive has scrolling setttings and a clear-results command for the repl that I was used to when coming into Calva

pez13:03:11

I miss that too from the other output options, @U09D96P9B.

Thierry13:03:30

So how do I set this to be printed to a terminal?

pez13:03:17

You can copy the last evaluation result to the clipboard with a command, @U09D96P9B. You probably knew.

pez13:03:19

Replace output-channel with terminal , @U02CX2V8PJN.

Thierry13:03:28

alright, will try that

Thierry13:03:40

Ahh now I see what you mean with terminal. I tried opening the Calva Output window before but got this error

Thierry13:03:05

And got confused because of this hover

jussi13:03:13

I kinda agree with @U02CX2V8PJN’s points wrt REPL flow, trying the new combo now, since I miss the coloured output.

pez13:03:42

Which version of Calva are you using, @U02CX2V8PJN?

jussi13:03:51

I've got the same error regarding focusing on terminal, I just wrote a new message on #calva My Calva version is v2.0.430

Thierry13:03:08

So, this is what it amounts to. Still, having a second output window next to a repl window is counter intuitive to me. But, I will try using it at I am missing the coloured output

Thierry13:03:32

My version is:

Calva version used: v2.0.430
clojure-lsp version used: 2024.03.13-13.11.00
clj-kondo version used: 2024.03.13

pez13:03:33

Very strange that it warns about terminal. I don’t understand why that happens. Will need to tale a closer look. But very confusing, I agree.

Thierry13:03:56

Could it be an option to have the output be printed in the repl window without the semi-colon? Disabled by default?

pez13:03:30

Could be, but I try to avoid settings in general, and if the setting means “Do not complain if the REPL window stops working” I hesitate even more.

Thierry13:03:00

Fair point 😉

jussi13:03:03

When my REPL window stopped formatting due to some lingering extra characters I just killed the repl and jacked in again. Not optimal but worked for me.

pez13:03:05

As maintainers we at some point have spent enough time helping users with certain problems, and with trying to mitigate the problems.

jussi13:03:47

I fully understand and agree, I'm usually quite adaptive!

pez13:03:17

We are planning to introduce a dedicated Output Window. Hopefully we can create an experience that suits most devs. Even if we will not be able to do the rope trick with making something that suits all.

Thierry13:03:20

Same here, understand and agree

pez14:03:30

Thanks. I think you are being very reasonable. 😃

Thierry14:03:05

Isn't that what being colleagues in Clojure is all about?

Thierry14:03:21

This is not Python

pez14:03:32

Yeah, I think it is. Very happy to be part of this particular community!

🙌 1
Thierry14:03:47

I created a discussion in the Calva repo to continue https://github.com/BetterThanTomorrow/calva/discussions/2462

🙏 1
Karel Miarka10:03:03

hashp #p outputs are destroyed by this

pez10:03:34

@U04M0JEU88Z you mean by the semi-colon? Have you tried the terminal output destination?

Thierry14:03:27

I have been trying the terminal output since yesterday and even though I like the terminal like output I have now been frustrated more then once due to me questioning why my evaluated code in the repl gave no output...doh:melting_face:

Thierry14:03:57

This will need getting used to 😉

pez14:03:39

Same here @U02CX2V8PJN. I’ve learnt to expect the result being printed there. Maybe we could print something like “Results printed to <wherever>“…

Thierry14:03:25

or move the repl input to the same window?

jussi14:03:36

I now print the result into the REPL, everything else into output. It is not as good as colourful everything in REPL but as I also suffered from REPL losing formatting due to rogue characters this is a compromise.

pez14:03:02

Regarding the option you suggested to allow to opt-in on stdout being printed raw, I am starting to lean towards doing something like that. It will be opt-in and be on your own with it , but I think that while we do not have an alternative that is similar enough, we could allow it and be clear about that it is temporary. Or something.

jussi14:03:06

My thinking goes along the lines that result is crucial and in REPL, everything else is details and can be in the output.

pez14:03:51

I would maybe do that too right now, if I weren’t dog fooding, @U0267SNCPEY.

1
pez14:03:40

Regarding REPL in same window, @U02CX2V8PJN, the coming output window will probably not have that. We are too scarred from having tried to provide that in different ways for 6 years now.

Thierry14:03:48

Isnt it weird that Exceptions get printed in both windows but ytou can only open (click on) the stacktrace in the repl window.

pez14:03:28

That is why the exception is printed to the repl window regardless. It’s the only place we have clickable stacktraces.

Thierry14:03:32

Hmm... imho a repl should have input and output in the same window. If I start clj or bb from command line I get the same

pez14:03:09

I have obviously been of the same opinion, and still am partly, for six years.

pez14:03:02

You could actually do it like that with Calva too. Start clj and the repl from the command line and connect calva to to that repl.

Thierry14:03:20

It's pity VSCode doesnt support having a split window for just 2 tabs. If I do that all other tabs suffer the same fate hehe. Kinda hard to explain, ill make a screenshot.

pez14:03:04

VS Code window/tab/panel management is a mess. It is strange that they allow it to be like that.

Thierry14:03:27

I usually split my workspace over 2 or 3 main tabs with files on those tabs. If I put the output and repl window on the left split like it is now the other files on those tabs cant be the full tab and are split too. Thats annoying like poop coming to quickly

Thierry14:03:58

I'd be happy with an option to remove the semi-colon from the repl-window and live with potential issues. but thats just me

Thierry15:03:18

Is it possible to get it to output to both the output window and the repl-window?

pez15:03:49

Is output window here the output terminal?

Thierry15:03:47

The Calva Output fake terminal and the repl.calva-repl output

Thierry15:03:06

should have been more specific, exqueeze me

Thierry15:03:10

That would provide feedback on repl info (even if preceded by a semi-colon) and if I would want colored output I can look in the terminal output

pez15:03:59

It’s not particularly colored in either, though?

Thierry15:03:07

It is for me?

pez15:03:27

Interesting. 😃

Thierry15:03:42

top is output window, bottom is repl window

Thierry15:03:54

dont mind the errors lol

Thierry15:03:30

I see colors here 😛

pez15:03:33

The results are colored in both. Though I don’t think that was what you referred to as it? Because results are not prepended as line comments.

Thierry15:03:18

true, thats only when everything goes to the calva-repl

pez15:03:47

You can print colored output to the terminal, but you will have to use ANSI escapes, which you can get from a library. The REPL window can’t handle that though, so we strip ANSI escapes there.

Thierry15:03:48

My question was if the results can be sent to both windows at the same time

pez15:03:00

We could consider.

Thierry15:03:26

That way you can have result to your repl entry

Thierry15:03:43

and if you need to see the colored output you can have a look in the pseudo terminal

pez15:03:04

Now you’re back at the colored output…

Thierry15:03:19

let me refrase

Thierry15:03:15

Here's an example. If I type and evaluate (= 1 1) in the calva-repl and have all calva.outputDestinations set to repl-window the result would be like the bottom tab in the screenshot correct? If I set the calva.outputDestinations to terminal I wouldn't get the result in the bottom window and it would print like the top window, correct? Can it be both? Result in the repl-window and terminal.

pez15:03:45

I’m hesitant of that, but I’ll consider.

Thierry15:03:42

I understand, don't do this only because I asked.

Thierry15:03:58

It might cause performance issues?

pez15:03:04

What’s funny with your first screenshot is that it looks like the result of (= 1 1) is printed to the repl window as a line comment.

Thierry15:03:15

thats my fault

Thierry15:03:33

Hence the second sreenshot

pez15:03:38

I rather think it’s confusing.

Thierry15:03:30

Removed the screenshot to not cause confusion

pez15:03:09

I thought a while that we had a bug. 😃

Thierry15:03:43

my bad

😂 1
pez15:03:26

I’m just happy it wasn’t so. Haha.

🙌 1
jussi13:03:11

https://calva.io/output/ describes ctrl+alt-o t as a shortcut to open output terminal but I just get this error (`ctrl+shift+´` works tho)? Is this a bug? Using Emacs keybindings FWIW.

Cannot read properties of undefined (reading 'show')
My Calva version is v2.0.430

pez13:03:34

Looks like a bug. Are you connected to the repl with the terminal set as an output destination?

jussi13:03:33

No

"calva.outputDestinations": {
        "evalResults": "output-channel",
        "evalOutput": "output-channel",
        "otherOutput": "output-channel"
    }

Thierry13:03:48

the moment you set that to terminal a wild terminal output appears

jussi13:03:49

I did change the output destinations while REPL was running. Started it with the default settings

pez13:03:33

Could be that the terminal was not created when you used the command. Still a bug. Just trying to understand.

pez13:03:51

> the moment you set that to terminal a wild terminal output appears ?

Thierry13:03:16

As soon as I changed output-channel or repl-window to terminal a new terminal spawned

Thierry13:03:26

after saving the json

pez13:03:57

I think it needs that something is printed to it. Which probably happened for you @U02CX2V8PJN

jussi13:03:28

Ah, so the pseudo terminal started when jacking in is not the terminal. Shortcut works only if I have at least one output destination defined as terminal.

pez13:03:37

Please report the bug to the repo, @U0267SNCPEY, as far as you understand it.

1
pez13:03:11

@U02CX2V8PJN, for your views on the repl input and output being in the same window. You are welcome to start a discussion on the Calva repo about it. If we have those discussions here we will have them over and over again. Better to have a URL to point at.

Thierry13:03:55

Sure, will start one. Am curious how other devs use the repl window

jussi13:03:09

When configuring at least one terminal destination shortcut works. Issue created ➡️ https://github.com/BetterThanTomorrow/calva/issues/2461

🙏 1
chromalchemy14:03:31

Another nice thing in output window is that you can follow links easily. Seems like you can do this in output panel too. With terminal you can follow a link, but it pops up a security confirmation prompt… just observations

pez14:03:54

You mean URL:s?

pez14:03:10

I.e. this?

chromalchemy14:03:08

I moved the Output terminal to a “window” tab, to try it out. Then I instinctively closed the tab, like I would with the results window tab, when I wanted to “hide” the results view temporarily. With the results window I could bring the results view back with a command. But closing the output terminal seems to have killed the view, and I cannot get back to it. Even after re-jack in?

pez14:03:53

Ah, that’s true. I don’t think we can prevent it, but I think we can at least catch that it happens and say something about it to the user.

pez14:03:22

I never close anything so I guess that’s why I haven’t noticed.

pez14:03:04

And we should be able to re-create it. Please report as an issue. @U09D96P9B.

pez14:03:36

^ Something to keep in mind with the new Output Window, @U9A1RLFNV ^

👍 1
Thierry14:03:15

As a workaround you can Pin the window, this makes closing it have a second action

👍 1
chromalchemy14:03:51

Ok thanks. What is best way to re-create it atm?

chromalchemy14:03:23

I guess reload window. I’ll try that.

Thierry14:03:03

This doesnt work? Calva: Show/Open the Calva Output Terminal

pez14:03:13

Reload is probably the only thing that works for now. I missed that this could happen. But I think I know how to make it auto-recreate. Issue please. 😃 🙏

chromalchemy14:03:31

Ok will create issue later on. Yes reload works. (now show/open.. once dead)

chromalchemy15:03:56

Nice to have a proper “clear repl output” command with the terminal version! ❤️

metal 3
pez15:03:50

You need to focus the terminal first, right? I was thinking we could add commands for clearing the configured destinations.

chromalchemy15:03:29

workbench.action.terminal.clear Seems to work, even when I am in the editor window.

chromalchemy15:03:53

But specific clearing commands as needed are appreciated.

chromalchemy15:03:25

Wouldnt mind a setting to auto-clear before each evaluation. (but could wire that up myself if really needed)

👂 1
pez15:03:52

workbench.action.terminal.clear may probably clear any terminal that was last active.

hkjels08:03:34

This and a stably positioned REPL prompt are my top wishes for Calva. I mostly use regular editor buffers for evaluations, so it's not a big problem though.

🙏 1
chromalchemy15:03:49

Is there a way to have the calva terminal start out as a tab on window reload?

pez15:03:36

If it was a tab (editor) when the window was reloaded, I think it will be recreated there. I don’t think we can make it be created there otherwise, but I may be wrong about that.

chromalchemy22:03:09

Maybe a command to move it? Might need to look to Joyride for this.