Skip to content

Calva Commands#

Calva's commands are part of the Calva API. They often accept arguments of some type, which you can use from keybindings and from Joyride (or another VS Code extension). Well behaved commands return a Promise, if it is async. You can utilize this with Joyride too, or with keybindings involving runCommands.

Example shortcut bindings#

To illustrate how to provide arguments to the Calva commands, here's a keyboard shortcut binding for calva.refresh:

  {
    "key": "ctrl+alt+c f1",
    "command": "calva.refresh",
    "args": {
      "after": "component.repl/reset"
    }
  },

It sends along the :after argument for the cider-nrepl/refresh op. (The actual argument only makes sense with Component)

Here's another way to achieve something similar.

  {
    "key": "ctrl+alt+c f1",
    "command": "runCommands",
    "args": {
      "commands": [
        "calva.refresh",
        {
          "command": "calva.runCustomREPLCommand",
          "args": "(component.repl/reset)"
        }
      ]
    }
  }

Commands with arguments#

Command Title Arguments Notes
calva.refresh Refreshes changed namespaces A JSON object with stuff from cider-nrepl ops/refresh Mostly meant for sending :dirs, :after, and :before. The print options may or may not work.
calva.refreshAll Refreshes changed namespaces A JSON object with stuff from cider-nrepl ops/refresh-aa Mostly meant for sending :dirs, :after, and :before. The print options may or may not work.

Unfortunatley the arguments are not well documented, so you may need to poke around in the code to discover them. If you search for the command, you should find it in package.json, and be able to navigate to the function definition to see the arguments.

See Commands Reference for the complete list of commands available.