calva icon indicating copy to clipboard operation
calva copied to clipboard

Add vscode command that can take string to evaluate in the repl.

Open chromalchemy opened this issue 1 year ago • 1 comments

Instead of necessarily inferring code from a selection or or cursor position in the current editor. I would like to pass a string directly to a calva vscode command. So the command should be able to take at least one (string) argument.

This would allow me to use calva repl evaluation from a vscode api level, without the ceremony of declaring a naming Calva repl snippets (which are awesome btw!)

It would be great if it could also optionally take a namespace to evaluate the string in. And would be cool if the string could still use the snippet substitution vars!

chromalchemy avatar Mar 06 '24 14:03 chromalchemy

Hi! I think i lied to you about that we don't have this. Reading the issue text, and you mentioning you want to be able to include a namespace and also the snippet variables, reminded med. I have things like this in my keybindings.json file:

    {
        "key": "ctrl+alt+m ctrl+enter",
        "command": "calva.runCustomREPLCommand",
        "args": {
            "repl": "clj",
            "snippet": "(require '[malli.provider :as mp]) (mp/provide $current-form)",
        }
    },

Meaning that we have the command, and that it actually is custom repl snippets being used for it. Saying this without fully understanding your use case, so please let me know if this is not what you're looking for.

PEZ avatar Mar 06 '24 19:03 PEZ