Fork me on GitHub
#calva
<
2024-05-22
>
Karol Wójcik08:05:51

Dear Calva maintainers, I got some feedback regarding outputDestinations💡 When setting all outputDestinations to terminal. 1. I’m finding REPL window not very useful. I would appreciate toggle in settings to not pop the window up. 2. Visual presentation of output and result is obscure, it’s hard to differentiate the output from the result. I would love to be able to hook into printing process and format values to my liking. I’m also confused why output nil is printed to terminal, couldn’t we filter this surplus information out? 3. Error representation lacks stacktrace thus I have to use pst to once again see the full error. Would love to at least have an option to automatically print the full error out. Thank you for considering my input and your hard work in making Calva such a lovely tool it’s now! All the best! Karol

pez09:05:45

Hi! Thanks for providing feedback! 1. There’s a setting for not automatically opening the REPL window when the REPL is connected. Is that what you need? 2. a. This will somewhat depend on your theme. We could provide some configurability for it, but I’m a bit hesitant with settings in general. Issue welcome, and we can discuss it there. b. Not sure what you mean with the nil. It’s the result of evaluating some forms. There is no reliable way for Calva to know if it is to be considered surplus or not. But maybe I am not understanding the concern… 3. Again, I’m weary about adding settings. You could make keyboard shortcut for quickly calling pst.

{
    "key": "ctrl+alt+c -",
    "command": "calva.runCustomREPLCommand",
    "args": {
      "snippet": "(clojure.repl/pst)"
    }
  },

Karol Wójcik09:05:12

1. Oh, very sorry! Indeed I overlooked this option 😍 2. a & b I expressed myself poorly, let me correct it. What I mean is when evaluating a form like (println ”hello”) I’m getting „hello” in terminal and nil for result. Since there is no preamble of ——-RESULT——- and ——OUTPUT——- it’s sometimes hard to differentiate between those two. 3. Okay, that’s also an option! Thanks 🙏

pez09:05:53

Thanks for clarifying about ouput vs results. It’s by design we don’t label them. We could consider an option letting you do this, and an issue is welcome. Again, I prefer not adding options, but maybe I can be convinced. With the theme I am using (GitHub Dark Default) the difference is pretty striking, just saying. I find myself mostly using the Calva Inspector for results, btw.

seancorfield16:05:20

I'll add that I mostly use Portal for results and that makes it very easy to view output and results separately -- but since the switch to the terminal-based output destination, I've actually started using that window much more than I used to use the old REPL window -- not sure why... guess I find the new output style more pleasant to read?

Bailey Kocin18:05:14

When I hit tab with Calva what controls the indentation level? I have a macro that I have defined in my clj-kondo config to be a normal function defn but when I hit tab it takes the indentation to a whole new level for all the lines and I am not sure where that setting is coming from.... It does not do it on normal functions so I am assuming something is not reading this macro which looks like a normal function body correctly

Sam Ferrell18:05:41

I think there was a field name change a while ago regarding .cljfmt.edn

Sam Ferrell18:05:46

But that might not be your issue... just for reference I use this in my .clj-kondo/config.edn

{:lint-as {uix.core/defui clojure.core/defn}}

Bailey Kocin18:05:15

Yea I have my macro in the clj-kondo under lint-as the same way. Looks like its just a cljfmt issue. Does anyone know how to fmt a macro as a function with cljfmt?

Bailey Kocin18:05:38

Looks like I can use the .lsp/config.edn and use the :cljfmt key for my settings too

Sam Ferrell18:05:13

{:extra-indents
 {use-subscribe      [[:inner 0]]
  use-event-listener [[:inner 0]]
  use-shortcut       [[:inner 0]]
  $                  [[:inner 0]]}}
Example of what my .cljfmt.edn looks like to get the defn -like indentation

Bailey Kocin19:05:17

Hmm does not seem to do it with my symbols.... I will look into the settings more. Thanks for the help!

pez06:05:00

Where did you find that link, @U05NZDGDYG3?

pez06:05:00

If you use .lsp/config.edn for the formatting setting, you need to give Calva a special cljfmt config path of CLOJURE-LSP. You also lose hot reloading of the formatting config, so I suggest that at least while figuring the right config out you just use .cljfrmt.edn in your project/window root.

Nim Sadeh19:05:38

I'm an Emacs user who decided to try out VSCode + Calva today as I am preparing to onboard a new dev who doesn't use Emacs. Is there a way to view the documentation of a function without using the mouse to hover over? In Emacs there's an lsp command that brings up a small interface showing the docstring and function signature, which is helpful when I forget the order of arguments

Sam Ferrell19:05:02

if you're in a REPL you can just call (doc map)

wevrem19:05:19

I’ve turned off all hovering (because it drives me crazy) but when I want to see the popups I use the key combo CMD+K, CMD+I.

🙌 1
Nim Sadeh19:05:26

Exactly what I was looking for, thank you! I may end up switching entirely to Calva

seancorfield20:05:59

Yeah, I liked the hover docs for a long time but a month or two ago I turned that off and I'm using ctrl+k ctrl+i (Windows) now when I need docs -- which is probably more often than I ought to admit 🙂

pez06:05:16

I have set the hover delay to 1300. Calms things down considerably.