Fork me on GitHub
#calva
<
2023-07-26
>
08:07:47

Hi. Is there a way to get Calva to reload local dependencies, specified in deps.edn using :local/root, without restarting the repl?

08:07:29

Nothing built in. You can create a custom command that does it. As long as you have tools.deps that supports it.

09:07:31

I see. What approach would be suitable to make it automatic? I.e. I want to watch the classpath (excluding the project files) for changes, and if any dependency changes I want to reload it (using e.g. pomegranate). I hacked together something similar for the test runner in bash using entr. I use kaocha --watch, but if deps.edn changes, or if any classpath changes (or a deps.edn in the classpath), it kills kaocha and restarts it. It gives me a reasonable setup for working with multiple projects in an integrated way and is nice when doing TDD, but some kind of support in Calva would make exploration much nicer. Any pointers or ideas on how to implement something along these lines would be much appreciated.

10:07:41

For something with a file watcher, #C03DPCLCV9N is the way to go, I think. But I don’t know how much leverage that will give over a simple command that you use when you want to add a dependency, regardless if it is :local/root or some other type of coordinates. I use a snippet like this:

"calva.customREPLCommandSnippets": [
    {
      "key": "a",
      "name": "Add selected dependency",
      "repl": "clj",
      "snippet": "(do (require '[clojure.tools.deps.alpha.repl :refer [add-libs]])\\n(add-libs '{$selection}))"
    },
    ...
  ],
When I want to add a dependency I select it and type ctrl+alt+space a.

👍 2
20:07:39

Is there a way to disable tooltip-based documentation and easily pull documentation up in a dedicated window (like cider-doc?) I prefer persistent views rather than overlays, especially if the docs are long.

2
21:07:56

No way to disable it. But you can use #C03DPCLCV9N to pull the docs up in a separate window. I think there’s an example in the repo, doing that.

2
22:07:50

The "tooltip" pop-up documentation often hides a large portion of the editor window, especially the bits of my code that are relevant to what I'm looking at. There seems to be hardly anyplace "safe" to put the pointer that will not excite a box of copious information from the reference manual or other sources. But 99.99% of the time the information is of no interest. I have found some delays or timeouts that I can increase in Settings, but, even so, it is rather strenuous and I too would like the pop-up documentation to pop someplace where I could refer to it in a very rare emergency but would normally not be distracted by it.

22:07:55

do you have some pointers to the settings to increase the delay? I find those popups annoying, too. Also the automatic code completion popups. I really prefer the ctrl+space way of eclipse in this regard.

23:07:44

I am not quite sure which Setting controls what, but I increased "hover delay" and "quick suggestions delay". Unfortunately, those delays also affect lint hints, which I like to see. I would like to configure it to "never pop up documentation" -- because I already know what doseq does, and I can go-to-definition of my own functions, and I don't mind visiting the API-docs pages of 3rd-party libraries.

06:07:53

Thanks for the pointers. I will try them and see, if the matter get's better or worse. The thing that annoys me most with the popups is the position. They are too close to the mouse position and often hide the line I clicked. If they would not hide the immediate context, they would be far less annoying.

17:07:45

With a longer hover delay, I have evaluated the expression most of the time before the popup comes up. Much better.