Skip to content

Commit

Permalink
syntax highlight vscode (#1105)
Browse files Browse the repository at this point in the history
<!-- ELLIPSIS_HIDDEN -->



> [!IMPORTANT]
> Add syntax highlighting for `@check` and `@assert` attributes in BAML
files for VSCode.
> 
>   - **Syntax Highlighting**:
> - Add new patterns for `@check` and `@assert` attributes in
`baml.tmLanguage.json`.
>     - Handles both single and double `@` prefixes.
>     - Captures function names and parameters for these attributes.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for 962c428. It will automatically
update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
aaronvg authored Oct 26, 2024
1 parent 83ddb1c commit 8887757
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions typescript/vscode-ext/packages/syntaxes/baml.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,33 @@
},
"block_attribute": {
"patterns": [
{
"begin": "(@{1,2}(?:check|assert))\\(([^,]+)?\\s*,\\s*()",
"beginCaptures": {
"1": { "name": "entity.name.function.attribute" },
"2": { "name": "variable.parameter.checkName" },
"3": { "name": "punctuation.definition.template-expression.begin" }
},
"end": "()\\)",
"endCaptures": {
"1": { "name": "punctuation.definition.template-expression.end" }
},
"contentName": "string.quoted.block.thing",
"patterns": [{ "include": "source.baml-jinja" }]
},
{
"begin": "(@{1,2}assert)\\(",
"beginCaptures": {
"1": { "name": "entity.name.function.attribute.assert" },
"2": { "name": "punctuation.definition.template-expression.begin" }
},
"end": "()\\)",
"endCaptures": {
"1": { "name": "punctuation.definition.template-expression.end" }
},
"contentName": "string.quoted.block.thing",
"patterns": [{ "include": "source.baml-jinja" }]
},
{
"begin": "(@{1,2}\\w+)\\(#\"",
"beginCaptures": {
Expand Down

0 comments on commit 8887757

Please sign in to comment.