Fork me on GitHub
Yuner Bekir09:01:44

Hello guys! I have the following issue in the main project. When I try to evaluate anything in the repl it gets stuck, for example see image. But if I create a new project the repl runs without any problems. I can still evaluate the page and any function calls will not get stuck.


Hi! Do things get stuck even if you don't use the output window for evaluating things? Like if you close the output window and evaluate things in the files. Trying to see if we can isolate the problem some. Also please check the nREPL log (there is a command for enabling this).

Yuner Bekir09:01:33

tried closing the window and evaluating single line calls got stuck. I opened the nREPL log, nothing useful there

Yuner Bekir09:01:18

Would it be possible for it to fail silently? Because of a broken dependency in the project or something similar. It was working fine till a reset catch up


So, the messages are sent, but no answer is received... Something can definitely be failing silently. Does it work if you check out the code before you did the catch-up?

Yuner Bekir10:01:30

I checked out the code before the failing, it wasn't working. Then I restarted vs code, it started working, after that I caught up with the latest changes and it started working. So the issue was with vs code


This has started to happen a lot lately... Thanks for updating!

Yuner Bekir10:01:16

You are welcome 🙂


Is it possible to wrap a list with extra space in between? For example

(| (some-list) ), 
instead of
The reason is that, by leaving extra space, things like auto-suggestion won’t interfere with the adjacent (. E.g.,
(some-text| (some-list))
instead of


Not sure I understand the full problem. But here is a maybe way:

Type (some
Paredit Slurp forward
(some| (some-list))


(Edited with the actual suggestion now 😄)


Thanks. That somehow solves the problem. Yet, just to confirm, we cannot wrap with extra space for the moment right?


Another use case which the above example fails to solve is

1. (some-java-instance)
2. (.method)(some-java-instance)
3. (.method some-java-instance)
When typing .method, there is no way to auto-complete it.


It should. But there is some issue with the Java interop support.


> It should. But there is some issue with the Java interop support. When youa are in step2 typing the .method part, why does the java completion work? the some-java-instance is in another s expression though.


I'm confused now. I though you said there was no way to auto-complete it.


Hmmm, maybe if you post some screen shots this will be easier to follow.


> I’m confused now. I though you said there was no way to auto-complete it. Yeah. I was saying there was no way to auto complete it.


Actually, how do you write in this case to get the auto completion?


You also say: > When youa are in step2 typing the .method part, why does the java completion work? Which is why I am confused. 😃


> It should. But there is some issue with the Java interop support. Aha. I was referring to your reply it should. Thought it should be it shouldn't indeed.


Or, related... that is the current issue we have where you can add datapoints and questions around java completion.


But back to my input issue, I am interested to know how you type java methods.


What's different with them from any other call, for you? (Except completions not working.)


> What’s different with them from any other call, for you? (Except completions not working.) No difference other than completion. I ask this question because I want to find out a proper way of inputing the s expression so that I can have auto completion (provided the nrepl / calva backed for java interop is functioning).


There is some issue with Java completion. I don’t quite understand what it is.


Hi, I'm just giving Calva a spin, and I'm on Windows. 1. When I tried to run the recommended Getting Started REPL, I got an error. I get the impression that it is a known bug on Windows, correct? 2. I couldn't find any way to create a project from within Calva. It looks like you need to create a project using an external tool, and then you can open the file in Calva. Is that correct? 3. When I first created a REPL and jacked-in, the namespace was displayed with odd boxes around the colon and space characters in the ns. I had to hover over the boxes and disable them in the settings (it was boxing them , it said, because they were non-standard unicode characters). Is it normal for these boxes to be present by default? If so, why? 4. I tried to disable paredit in the settings by disabling the paredit keymap, and unchecking the box to have paredit commands override the VS Code commands. Despite making those changes, when I type ( a corresponding ) appears. How can I turn that off? 5. I called a function that returned a long list. The output window displayed it on one long line that scrolled way off to the side, rather than inserting linebreaks to display the list vertically. I checked the user guide and it claims that the default printer is pprint with a line-width of 40, but this is definitely not the behavior I'm seeing. What is the actual default? 6. Any other "These are the first settings you should change..." suggestions? Thanks.


Hello! 1. A bug in some Java installs on Windows. Should work with Java 16 and up (maybe 17, i don't remember). 2. Correct. 3. 4. It's not paredit. It is a VS Code setting. (And you are not disabling paredit, just making it hard to use it, FYI.) 5. Something is broken with the defaults. Set calva.prettyPrintingOptions -> printEngine to pprint (or any option you fancy) 6. Not from me. I created most of the defaults. 😃

Lukas Domagala13:01:32

@U0ETXRFEW 2. Is this something we want to address at some point? I think its pretty hard for a beginner to go from the “getting started repl” to a working project, especially if they choose deps.edn


What do you mean when you say that you're not disabling paredit, just making it hard to use it? So it's always active and you just won't have any keys to manipulate the forms?


@U02EMBDU2JU I think it is reasonable to expect of programmers that they will be able to follow the instructions on about how to create a project. That said, I have been thinking a bit about smoothing the path for the beginner while they are mainly exploring.: • With some rather small tweaks, we can make the getting started REPLs do a bit of this. Today they create small starter projects in the temp directory of the computer. We could tweak that so that the user can create them in some location of their choice. Things are a bit prepared for this by these repls being defined in a separate repository. Though, I haven't found a configuration format I want to start scaling it yet. • I also have been looking into making a Gitpod prepared template repository that has babashka, deps-new, clj-new, shadow-cljs, etcetera and a combination of Calva support and instructions to easily get your first projects going. A combination of those might also work, and there are possibly other tools to consider. It is a matter of priorities and that someone has enough time to focus on this for a while, because it really needs hammocking a lot.


I think I found the setting for auto-close brackets. It is currently set to "languageDefined", which suggests to me that it is getting the setting from Calva, but I gather that's not the case from what you said. So if I turn off the auto-close bracket, is it going to wreak havoc with the built-in paredit?


Calva is providing defaults for that setting in the "[clojure]" scope of VS Code settings. Depending on wether you want autoclosing brackets in other languages or not, you might want to tweak just that clojure-scoped setting. (Type clojure in settings.json and accept the completion/snippet suggestion and you will get all defaults inserted and can tweak this.) No, won't wreak havoc with paredit. Paredit is mostly an on-demand feature so as long as you don't use the Paredit commands you are not using it.


That page doesn't say what the possible settings are for auto closing brackets and quotes other than "always". Is the opposite "never"? Is there any other setting between those extremes? Thanks.


I tried disabling it for all languages in the settings, but it didn't seem to make any difference.


There are some other notches, but I don't recall which ones right now. They probably are the same as for the general setting. VS Code will help you with the options in the json editor.


Might be that the clojure scope overrides the general setting. You can test that by seeing how it behaves in some other language. Removing it from the clojure scope should let you control it with the general setting. (Or tweak the clojure scope one).


In case you're interested, enrich-classpath finally has an answer for tools.deps compatibility it boils down to a .sh wrapper around clojure . Could be a babashka script as well for Windows compat, I left it out of mvp for now. Full release within a few days, it also will need some QAing between Emacs users. LMK if it's something you'd keep on the radar, there's Go to definition sometimes works for Java sources #1436 but perhaps not an issue specific to this possible integration

🙏 1
🎉 3

Oh, yes, I want to follow this. I created an issue for it now. P

🍻 1

Is it possible to re-trigger lsp/`clj-kondo` initialization to read latest config.edn and update linting — specifically related to clj-kondo hooks? I observe it happens only at window launch time. I am not able to trigger an update when starting/restarting a repl. Details: • my app deps.edn refers to local filesystem library my/lib {:local/root "…."} • I have a .clj-kondo/config.edn in my app, which refers to my lib: {:config-paths ["my/lib"]}my/lib defines a clj_kondo/.../config.edn which includes hooks • I open my app open VSCode, and clj-kondo reads current hooks info as defined in my/lib. • I switch over to a separate VSCode window containing my/lib , and I update the definition of the hook. • I switch back to my app window, and would like to re-trigger the lsp/`clj-kondo` initialization without reloading the window. Is this possible?


clojure-lsp/kondo has nothing related with repl, if you re-load the window it should retrigger project scan


also, both changes on clj-kondo config and clojure-lsp config don't need restarts


unless you made a change in a hook that affect multiple file lints, then you need to restart clojure-lsp with window reload to lint the project again


Okay, that answers the question then. Only a window reload will refresh clj-kondo definitions from dependencies, right?


> would like to re-trigger the `lsp`/`clj-kondo` initialization without reloading the window. Is this possible? Sounds possible to me, since your config-path point to a local path which clj-kondo will check when liniting again


> Only a window reload will refresh clj-kondo definitions from dependencies, right? yes, for dependencies you need to restart indeed


I wonder if it would be possible to add some sort of command which could retrigger it manually. If I add a new dependency, or change a dependency version, I’d like to have the linting updated without reloading my VSCode window. Does that seem like a reasonable idea?


FWIW, @U08TWB99B. You can take advantage of that VS Code keeps the state of its terminal process between reloads. It doesn't work with the jack-in process, because reasons, but if you start the REPL yourself in a VS Code terminal and then connect to it, then you can reload the window and pay only the work of connecting. Not sure if this makes sense, please let me know wether it does.


We could have a command on calva to restart LSP, I don't see a issue with that as well


I wasn’t as concerned about restarting the repl, just trying to avoid window reloads, especially when developing a clj-kondo hook

👍 1

Indeed. @U9A1RLFNV and I have discussed a restart-lsp command.


BTW @U08TWB99B, AFAIK clj-kondo copy the configs to a local dir, so your config should be avaialbel at .clj-kondo/my/lib/config.edn which changing that should not require a restart


For me the highest price payed for reloading a window is restarting the REPL. But I haven't been developing clj-kondo hooks...

👍 1

yeah, i guess when I look at where the time is spent: 1. reloading the window 2. lsp re-running 3. reconnecting to repl I’m probably not saving much by avoiding 1, and 2 is what I want to happen anyway, and takes a lot longer than the UI reload. So, maybe this isn’t worth the work.


I guess just knowing what I need to do to get the lsp/clj-kondo refreshed is enough. I was trying repl restarts, deps.edn file updates, etc.


yes, I need to confess that usually when I develop a hook I run clj-kondo manually from the CLI since it's faster than reload whole project

👍 1

Does anyone happen to know which of the Calva pretty-printers show record tags and which don't?


Not sure what is meant by record tags, but I can tell you about that a difference between server side and client side pretty printing is that on the client side it is fully static and no tags will be expanded.


What I mean is if you say (defrecord P [x y]) and then enter (P. 1 2) into the REPL, will it print like an ordinary map: {:x 1, :y 2} or will it print in a way that shows it is clearly a record #mynamespace.core.P{:x 1, :y 2} ? pprint prints it just as a map, which is more compact but can be very confusing if you have a bunch of different records with similar fields. My personal preference would be something that prints as #P{:x 1, :y 2} and then you hover over the P to see the full name of the namespace, giving you the benefits of both compactness and clearly identifying the extra info that it's a record and what kind, but I don't think there's any printer that works like that. So I'd just like to know all the options.


There are only a few options since you can't tweak things like this on the printer through Calva. I would try all printers if I were you. I think that if you want to use the zprint option, you'll need to have it as a dependency in your project. I also recall that the calva option, which is client side, uses zprint, but I could remember that wrong. In theory you should be able to provide your own printer function, but I don't think anyone has tried that yet so it is unclear if it really works.

Lukas Domagala12:01:45

@U0518RMLD my options are:

"calva.prettyPrintingOptions": {
        "enabled": true,
        "width": 80,
        "maxLength": 100,
        "printEngine": "calva"
and i get what you want:
(defrecord P [x y])
(P. 1 2)
=> #user.P {:x 1, :y 2}

🙏 1

With pretty printing disabled:

#sieve.P{:x 1, :y 2}
About the calva option: It will make Calva disable nrepl pretty printing. This nrepl sends the raw/non-prettified text to Calva and Calva uses zprint on the client side to prettify it. Like so:
(defn pretty-print
  "Parses the string `s` as EDN and returns it pretty printed as a string.
   Accepts that s is an EDN form already, and skips the parsing, if so.
   Formats the result to fit the width `w`."
  [s opts]
  (let [result (try
                  (zprint-str s (assoc opts :parse-string? (string? s)))}
                 (catch js/Error e
                   {:value s
                    :error (str "Plain printing, b/c pprint failed. (" (.-message e) ")")}))]