Fork me on GitHub
#calva
<
2024-02-01
>
Max16:02:46

Something I’ve missed after returning to clojure after a stint in Python is the extra popup their LSP does while you’re typing. Here’s what’s happening in this recording: • I’m typing out a fn call, as I type it brings up a small popup containing only the fn name, its args, and its docstring • When I call a fn in the original fn’s arguments, it switches the popup to that fn, and when I complete it and close the parens, it switches back to the parent args • After completing the call, I go to both fns and hit ⌘K-I, bringing up the hover. The hover that shows up is different than the popup that appeared as I typed, it contains more complete type info and some quick actions When I’m writing Clojure, I find I tend to write out the fn name, hit ⌘K-I, read the args, write one or two fo the args, then go back to the fn name, hit ⌘K-I, go back to the end of the form, write the next arg, etc. That back-and-forth feels much less comfortable than the Python version where the arg list just stays with me the whole time and even highlights the arg I’m on as I go. Would it be possible for Calva to do this sort of thing? For example, to have the “type-as-you-go” hover just contain arg names and the docstring, and have the clojuredocs available at the longer ⌘K-I/hover popup when you request them

ericdallo16:02:12

That's expected to happen and the logic should come from clojure-lsp, the problem we may face is that on Lisp it may not be entirely equal to python

pez16:02:37

That’s called Parameter Hints in VS Code. I think Calva is disabling it for Clojure (I’ve forgotten why, but anyway.) Search for @id:editor.parameterHints.enabled @lang:clojure in the settings window to toggle it on. And a search for parameter will show you some more configuration options.

pez16:02:48

The logic comes from Calva itself if the REPL is connected.

pez16:02:21

Disabling it as default seems to have been a requests from enough users: https://github.com/BetterThanTomorrow/calva/issues/574

pez16:02:30

Without a REPL connection clojure-lsp provides it. It then also contains the docstring. The REPL version enables this too on a separate setting.

Max16:02:11

Ah, that makes sense

Max16:02:27

Is there a way to have the hint show all the arities rather than making the user click through them? So many clojure fns have multiple arities, and the other arities don’t show up until you add enough arguments

pez16:02:06

I don’t think so. You can check the other arities with up/down arrows, though.