Skip to main content

Code Snippets

This extension for Visual Studio Code adds snippets for HerbsJS.

Installation

  1. Install Visual Studio Code
  2. Launch VS Code
  3. From the command palette Ctrl+Shift+P (Windows, Linux) or Cmd+Shift+P (OSX)
  4. Type ext install or just simply select Install Extension
  5. Choose the extension - Herbs Snippets
  6. Relaunch VS Code

Usage

Type the keywords in snippet e.g., "step" and press enter. Alternatively, one can also just press Ctrl+Space (Windows, Linux) or Cmd+Space (OSX) to access the available snippets in the editor.

Snippets

Use Case

TriggerContent
uc→Generates Buchu entire use case ... usecase("My use case definition", { ...
step→Creates a Buchu step "Description of step": step( (ctx) => { return Ok() } )
ifstep→Creates a Buchu conditional Step "Description of conditional rule": ifElse( {
usec→Generates instantiation of Buchu use case with all available functions

Entity

TriggerContent
ent→Generates entire Gotu entity entity('user', { prop: field(type) } )
fie→Creates a Gotu entity field name: field(type)
fiev→Creates a Gotu entity field with Suma validation params name: field(type, { validation: { presence: true } } } )
fjs→Generates instantiation Gotu Entity Entity.fromJSON(params)