Fork me on GitHub
#calva
<
2021-12-19
>
Lukas Domagala23:12:42

I’ve started playing with custom commands and love it! Two things I’d like to do, that I’m not sure are possible: Overwrite the substition in the editor instead of evaling it. This might work and be more general with “eval and replace” but I don’t know if i can access that from custom snippets. Add custom snippets through code or a special file in a lib, similar to the new clj-kondo auto include config. This would make it easier for tooling libraries to provide commands for ease of use. Currently to use something like debux, scope capture, omni-trace or even zprint I have to require it during every repl session. If the tools could provide custom snippets this would make them a lot easier to use, especially for beginners.

bringe01:12:34

Please create issues with these feature requests and explain them in detail. If you could add examples for each of what is desired, that would be great. I can’t say that these would be implemented any time soon, but we can at least track them and discuss them there, and if they seem like good feature additions, a PR would be welcome, too.

Lukas Domagala02:12:47

sure, thank you!

👍 1
pez10:12:21

Thanks for starting this conversation, @U02EMBDU2JU! There are a lot of things we could do to leverage the power of custom commands. Some things I have been thinking about are: • An option to evaluate them in the regular inline manner (in contrast to “send to output window”) • More variables. Maybe a way to select things at different depths. Such as “the current ancestor form, X levels up”. If we do this in a smart way, many current variables could get this ability. • Commands taking arguments from user input. • Configure snippets in EDN files.

1
Lukas Domagala10:12:30

Those sound like nice ideas! I would prioritize snippets from edn or something similar, mostly because it opens up wide range of interop scenarios and allows people to import them. Plus once the snippets get a little larger they don’t really fit into a json string very well. It seems to me that very few people are using snippet’s since you can’t just install them. I’ve started an issues for that: https://github.com/BetterThanTomorrow/calva/issues/1442 I also really like your your idea for extra user input. I’ve got a snippet for tools.deps/add-libs which would be even more useful if I could add extra user inputs that aren’t in a file.