Fork me on GitHub
#calva
<
2024-04-02
>
Thierry08:04:11

Anyone else notice folding stops working in VSCode after Calva / Clojure-lsp start-up? Am trying to pin down what's the cause here.

Calva version used: v2.0.433
clojure-lsp version used: 2024.03.31-19.10.13
clj-kondo version used: 2024.03.13

Thierry08:04:45

Okay, it seems to be clojure-lsp. When I stop the clojure-lsp server via the bottom toolbar folding works again, when I start it, it stops working. Will post this in #CPABC1H61

zimablue13:04:39

hit same issue

pez13:04:07

This is fixed in the nightly build of clojure-lsp. And will be fixed in latest next time they cut a clojure-lsp release. See my comment on the issue linked in this thread for how to switch over to nightly.

zimablue13:04:43

commented on the issue, not a total fix for me

pez13:04:11

There is a total fix for you in the OP of that issue, I think. 😃

zimablue14:04:30

as in just use indentation?

zimablue14:04:30

as I missed that indentation is what I'm used to I think, it's indistinguishable from semantic once you've autoformatted I guess, thanks

chromalchemy14:04:42

So what do we need to use the non-“boring” one? I switched to lsp nightly. Set mode to “auto” or “indentation”?

chromalchemy14:04:50

Seems like “indentation” allows folding nested forms, where “auto” does not.

pez15:04:36

@U09D96P9B yes. Seems that clojure-lsp only uses top level forms. And not RCFs.

Bailey Kocin17:04:07

Did something change in the Calva REPL to where on errors my entire REPL turns into a big comment? The text turns green and the REPL becomes unusable until I close the connection, delete the REPL output.calva-repl file, and reconnect

Bailey Kocin17:04:21

I have not changed any settings, it was only after I updated

seancorfield18:04:32

This has come up several times recently.

seancorfield18:04:52

Calva changed output to comments so that your REPL window doesn't break syntax related stuff.

seancorfield18:04:32

There's a setting to get the legacy behavior back, but the output window is going away and will switch to a new output terminal that has different behavior for highlighting.

seancorfield18:04:15

(I'm in a meeting otherwise I'd link you to the threads that talk about -- search for legacy in this channel and you should find the threads about the settings)

seancorfield18:04:02

I think if you search for legacy in settings in VS Code, it will find the two(?) legacy setting flags. I've already switched to the new terminal output window (but I've always had Calva's REPL output hidden nearly all the time anyway).

seancorfield18:04:22

My meeting is over now, so if you need more help, LMK...

Bailey Kocin18:04:44

Actually I am a little confused reading this document https://calva.io/output/#about-stdout-in-the-repl-window So now the output is in a comment form but it seems like you are talking about a seperate output window from the input window entirely... I do alot of things like adding prints while I playing in the REPL and having another window to see those as well as things as exceptions would be ideal! What setting do I have to enable to move all my output to a separate window?

pez18:04:30

The changes shouldn’t affect what happens in errors, and unusable wasn’t what we aimed for either. Sounds like something is going very wrong.

Bailey Kocin18:04:30

Starting the repl looks fine

; Connecting ...
; Reading port file: file:///REDACTED_BY_ME ...
; No nrepl port file found.
; Hooking up nREPL sessions ...
; Connected session: clj
; Evaluating code from settings: 'calva.autoEvaluateCode.onConnect.clj'
(when-let [requires (resolve 'clojure.main/repl-requires)] (clojure.core/apply clojure.core/require @requires))
nil
clj꞉user꞉> 
Printing is fine
clj꞉user꞉> 
(println "HELLO")
; HELLO
nil
This is fine
clj꞉user꞉> 
(defn test "" [data] (clojure.pprint/pprint data))
#'user/test
clj꞉user꞉> 
(test {"key" #{"VALUE1" "VALUE2"}})
; {"key" #{"VALUE1" "VALUE2"}}
This breaks it (half of it is commented out and green and the repl no longer accepts input) (Perhaps this is user error but I replicated it)
(test (zipmap (map str (range 1 2000)) (map str (range 1 2000))))

Bailey Kocin18:04:33

So it seems to only be with very large outputs but 2000 lines is not that bad....

pez18:04:52

Not good. Please report.

Bailey Kocin18:04:19

How do I do that? Do I open up an issue on the repository?

pez18:04:11

Yes, sorry, should have been clearer. Please report as an issue on the repo.

Bailey Kocin18:04:25

👍 Sorry yea very new to this kind of stuff still

seancorfield18:04:31

Worth checking whether it works in the new terminal output too -- if it does, maybe you should just switch to that?

Bailey Kocin18:04:43

How do I switch to that?

pez18:04:08

Scroll up on the doc page you looked at before.

seancorfield18:04:08

Turn OFF the legacy REPL output setting.

seancorfield18:04:22

So it switches to the new REPL window.

Bailey Kocin18:04:26

Using the terminal as output the stuff I ran above is fine, using the REPL input and output in the same window without legacy behavior this seems like an issue, I have not tried with legacy behavior

Bailey Kocin18:04:17

I will just switch to the new terminal, I like this alot better but another question while I have you.... If I start a REPL manually and connect to it using Calva how does the output work then with the output still set to terminal (since Calva did not start the REPL I am a little confused)?

seancorfield18:04:58

Dunno. Try it and see...

pez18:04:49

It’s unrelated to the jack-in terminal. There’s no process or anything backing it.

Bailey Kocin18:04:26

Yea I just tested it thanks! Did you still want me to open up that issue for the non legacy output in the same window issue?

pez18:04:19

Yes, even though we are eventually retiring using the REPL Window for output, it is still good to have a record of what issues it has. And also if this is a regression, I need to at least investigate what happened, because the changes really shouldn’t have that effect.

pez19:04:01

I could repro once. But not any longer. Very strange issue, but also we do know that the repl window has issues with processing a lot of output messages in quick succession, so this may be triggering that.

pez19:04:44

The strange part to me here is that it would matter if we prepend the output lines with a semicolon or not.

pez19:04:07

Also taking away from this thread that the documentation for this is a bit lacking.

Bailey Kocin19:04:02

👍 Thanks for the help!

Bailey Kocin13:04:32

Yea its only with the non legacy behavior with the old window, the legacy behavior seems to work fine. And so does the new terminal window

1
pez13:04:07

This is fixed in the nightly build of clojure-lsp. And will be fixed in latest next time they cut a clojure-lsp release. See my comment on the issue linked in this thread for how to switch over to nightly.