I made an extension for VS Code that lets you test your lava right within the editor. This has been a huge productivity boost in writing and testing Lava over the last few months.

To add it, search for "Lava Runner" in VS Code.

This works alongside Magnus and the Lava Language extension to make writing and testing Lava much easier, in my experience. 

See Lava code results


Settings


Entity Tree

Just a easy reference to entity names for your entity commands.


Shortcodes and Bootstrap CSS


Click the Lava Logo to Run the Lava and Preview the results


Features:

  • Remote Execution: Send the current Lava file as the body of an API call to a RockRMS server for execution.
  • Real-time Results: View execution results in a dedicated preview window within VSCode.
  • Streamlined Workflow: Eliminates the need for manual file transfers or separate testing environments, making your development process faster and more efficient.
  • Secure Connection: Utilizes secure API calls to ensure your code and data remain protected.
  • Use With Magnus: Lava Runner can run lava in files seamlessly with the [Magnus](https://github.com/Triumph-Tech/magnus-vscode) extension for VSCode, enabling you to run Lava code locally or remotely with a single click.
  • Use Your CSS: Lava Runner uses the CSS from your RockRMS site to style the preview window. This means you can see how your Lava code will look on your site.
Caveats:
  1. Your API Key that you will use is tied to a 'Person' record in Rock, not you, so
    {{ CurrentPerson }}
    will be that 'person' by default, not you, as it is in the Lava Tester.
    Workaround: Assign your person to a variable like
    {% assign CurrentPerson = 100386 | PersonById %}
    and then `{{ CurrentPerson }}` variable is that person.

  2. You can use this same idea to assign other variables like Workflow, Event Registration, etc.
  3. There are a few Lava commands that are restricted for this endpoint, like {% sql %}, and I havent dug enough to tell you where to go to enable that. Maybe someone here knows.
  4. Scripts (javascript) that are normally loaded on your site are not included within the vscode html comtainer, so things requiring javascript dont work fully correct. (examples: chartjs, accordians, etc.)
Tips:
  1. Check the security settings of your Rest Key by going to the 'Person profile' page of the rest key and checking the security tab to set the security role and ensure the User Account is 'confirmed'. Do this by looking at the url /admin/security/rest-keys/{id} and then replace '/admin/security/rest-keys/{id}' with '/person/{id}' to get to the "person profile" of that Rest Key.