-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] Custom REPL commands with editor shortcut #281
Comments
Hello. Thanks for this feedback! As mentioned in #259, this has been work in progress for quite long. Now there is a somewhat up-to-date branch here: wip/custom-commands. I think the answer is that this is feasible, at least in some form. It will be in the form of a setting where the user can add custom code snippets and then a command to get a list of the commands to choose from. Choosing one will invoke it. The settings currently looks like this: "calva.customCodeSnippets": [
{
"snippet": "(println \"foo\")",
"name": "Foo",
"repl": "clj",
"ns": "user"
}
], I haven't really worked out a good way to run the command in the right namespace, even if it actually works like it is... We will need to work out the details so that it gets to be as useful as possible. If you feel like helping, please try that branch out (see How to Contribute for a guide on how to run Calva in development mode) and we can discuss from there. I'm not sure when we would fit in work on this feature, but I think it isn't all that much work left on it and it does seem to be a valuable feature. I vote for doing this soon. What say you, @kstehn ? |
I mean it doesnt seem to be that complicated. |
I don't think that binding works in ClojureScript. I think I have asked about that somewhere, but I don't remember where... But if I remember incorrectly, then that's awesome. |
Here's a pre-release of Calva that supports executing custom command snippets in either the https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.44-custom-repl-commands Please install it and give it a try. And please provide feedback on how it works, and what you would want to work differently. The documentation for this would look something like so: Custom REPL CommandsCalva supports configuration of custom command snippets that you can execute in the REPL at will. If your workflow has you repeatedly evaluate a particular piece of code, you can use the setting The
E.g. with these settings:
You will get this menu. The items are numbered for you so that you can choose them in predictable way. The default keyboard shortcut for the command is ctrl+alt+c, .. Which means that to execute the Refresh command, ctrl+alt+c, ., 3, ENTER. |
Since currently, I don't have a cljs project on hand, I am testing clj project now. The snippet feature is awesome! I am certainly satisfied for clj part. Thanks for this new feature and Calva! Of course, if the snippet could be binded to a normal shortcut, it would be even better! But I think it is out of scope? |
Thanks for helping with testing this! I don't think VS Code allows for the user binding each snippet to a shortcut. But with the numbering of the snippets it gets pretty close. Also, which is not mentioned in my test above, Calva remembers the choice between usages, so if you have mainly one snippet you use, you can rerun it using ctrl+alt+c, ., ENTER. |
In Cursive, I found that "REPL Commands" is particularly useful feature. I can set a form like
(refresh) (test)
and ns'user
and bind a editor shortcut likeCMD + R
to execute it. It is very convenient , when combining with Component/Mount/Integrant.Is it feasible to be implemented in VS Code?
The text was updated successfully, but these errors were encountered: