-
-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected newline character in the output #998
Comments
I have tried to fix this before. Not really figured it out. Something with nrepl buffer size... |
I also tried to fix it on Calva side but failed. Probably we need to look how it is arranged in other nrepl clients. Maybe @bbatsov can suggest something. |
I'm assuming that Calva is printing a new line on each chunk of the output or something like this. Generally it's a good idea to have check whether a chunk is just a chunk or the final chunk. Generally if a chunk is smaller than the max chunk size it's fairly certain that this is the final chunk. |
Thanks, @bbatsov . That's probably it. I previously tried to tackle this by changing the chunk size, but failed at getting it to be anything else but 1024. But of course, that is not the right way to go about it anyway. |
There's one more implication of streaming - how to syntax highlight results, while they are being streamed (you can't just apply font-locking to each chunk individually, as those are going to be partial Clojure forms). I'm guessing VS code is more flexible here and can re-highlight everything from the begining on each chunk delivered or something like this, but with Emacs it's very tricky and I've cheated a bit - I syntax-highlight in CIDER's REPL only single-chunk results and apply no syntax highligting otherwise. |
There are two parsers in play in Calva. But both will generally just render broken syntax highlighting while the structure is broken, and it will fix itself when the structure is ok again. 😄 None of them is particularly fond of long lines, so they will throw in the towel when a line exceeds 20K characters (configurable by the user). |
If a string you want to print is more than 1024 characters, Calva adds the newline character at the end of a chunk.
calva/src/evaluate.ts
Lines 67 to 69 in 9185f16
Any idea how it can be fixed?
UPD. Tеsted it in Clover and lein repl, works as expected.
The text was updated successfully, but these errors were encountered: