Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 1.38 KB

CONTRIBUTING.md

File metadata and controls

57 lines (39 loc) · 1.38 KB

Building

The grammars for each diagram type reside in syntaxes/diagrams in separate files.

To test changes locally:

  1. Build the theme and create the vsix package by running:
npm install
npx @vscode/vsce package
  1. Install the theme locally by using the Install from VSIX command. This may require reloading VS Code to see the changes.

Testing

There are tests validating the grammar that can be triggered by running:

npm test

The tests will validate the grammar for all diagrams. Note this does not build the grammar, this will need to be done if changes have been made to the yaml. To test and build, run:

npm run convertYaml && npm test

Developing

The grammar includes a custom yaml type regex. This should be used for all but the simplest regex expressions. It was created to allow the regex to be multiline (with no whitespace between lines) and in-line comments that are stripped from the json. To use it, prepend !regex as seen below:

reg: !regex |-
  # Comment
  \s*(class)\s+ # explanation
  (\b[-,\w]+)\s+ # comment

Becomes:

{
  "reg": "\\s*(class)\\s+(\\b[-,\\w]+)\\s+"
}

Instead of:

{
  "reg": "# Comment\n\\s*(class)\\s+ # explanation\n(\\b[-,\\w]+)\\s+ # comment"
}

This is useful for splitting out sections of the regex (such as capture groups) and commenting on what each group should be matching.