Skip to content

Commit

Permalink
Syntax highlighting 0.0.2 - variables and function names. (eth-sri#246)
Browse files Browse the repository at this point in the history
Co-authored-by: TomExMachina <[email protected]>
  • Loading branch information
TomExMachina and bitnom authored Oct 20, 2023
1 parent bdcbcf1 commit 2ff5a5b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/lmql/ui/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Language Model Query Language (LMQL) Syntax Highlighting",
"description": "Syntax highlighting for .lmql and Python files with embedded LMQL.",
"publisher": "lmql-team",
"version": "0.0.1",
"version": "0.0.2",
"engines": {
"vscode": "^1.76.0"
},
Expand Down
17 changes: 15 additions & 2 deletions src/lmql/ui/vscode/syntaxes/lmql.qstring.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,31 @@
"patterns": [
{
"include": "source.python#expression"
},
{
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b(?=\\])",
"name": "entity.name.function.lmql"
}
]
},
{
"begin": "\\{",
"end": "\\}",
"contentName": "keyword.control.lmql",
"name": "keyword.control.lmql",
"patterns": [
{
"include": "source.python#f-expression"
},
{
"match": "\\{",
"name": "punctuation.section.block.begin.lmql"
},
{
"match": "\\}",
"name": "punctuation.section.block.end.lmql"
}
]
}
]
}
}

13 changes: 7 additions & 6 deletions src/lmql/ui/vscode/syntaxes/lmql.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
{
"include": "#keywords"
},
{
"include": "#template_variables"
},
{
"include": "source.python#statement"
},
Expand All @@ -17,12 +20,10 @@
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.control.lmql",
"match": "\\b(BEAM|beam|ARGMAX|argmax|SAMPLE|incontext|BEST_K|best_k|BEAM_VAR|beam_var|VAR|var|sample|FROM|from|WHERE|where|DISTRIBUTION|distribution)\\b"
}
]
"patterns": [{
"name": "keyword.control.lmql",
"match": "\\b(BEAM|beam|ARGMAX|argmax|SAMPLE|BEST_K|best_k|BEAM_VAR|beam_var|VAR|var|sample|FROM|from|WHERE|where|DISTRIBUTION|distribution)\\b"
}]
}
},
"scopeName": "source.lmql"
Expand Down

0 comments on commit 2ff5a5b

Please sign in to comment.