Skip to content

Commit

Permalink
Add support for multiline strings (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosshamish committed May 24, 2024
1 parent 46259f3 commit 6e6deea
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 12 deletions.
4 changes: 2 additions & 2 deletions kusto-syntax-highlighting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ The syntax is originally based on [TextmateBundleInstaller's Kusto syntax](https

![Kusto language syntax](https://github.com/rosshamish/kuskus/raw/master/kusto-syntax-highlighting/images/screenshot2.png)

## Changelog
## Contributing

See CHANGELOG.md
See CONTRIBUTING.md

## Bugs

Expand Down
21 changes: 21 additions & 0 deletions kusto-syntax-highlighting/syntaxes/kusto.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,27 @@
],
"name": "string.quoted.single.kusto",
"comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string"
},
{
"begin": "([@h]?```)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.string.kusto"
}
},
"end": "```",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.kusto"
}
},
"patterns": [
{
"include": "#Escapes"
}
],
"name": "string.quoted.multi.kusto",
"comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string#multi-line-string-literals"
}
]
},
Expand Down
12 changes: 12 additions & 0 deletions kusto-syntax-highlighting/syntaxes/kusto.tmLanguage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,18 @@ repository:
- include: '#Escapes'
name: string.quoted.single.kusto
comment: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string

- begin: "([@h]?```)"
beginCaptures:
'1': { name: punctuation.definition.string.kusto }
end: "```"
endCaptures:
'0': { name: punctuation.definition.string.kusto }
patterns:
- include: '#Escapes'
name: string.quoted.multi.kusto
comment: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string#multi-line-string-literals

Escapes:
patterns:
- match: (\\['"]|\\\\)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,19 @@
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.kusto comment.line.kusto
>print program=```
#^^^^^ source.kusto keyword.other.query.kusto
# ^^^^^^^^^^^^^ source.kusto
# ^^^^^^^^^ source.kusto
# ^^^ source.kusto string.quoted.multi.kusto punctuation.definition.string.kusto
> public class Program {
#^^^^^^^^^^^^^^^^^^^^^^^^^ source.kusto
#^^^^^^^^^^^^^^^^^^^^^^^^^ source.kusto string.quoted.multi.kusto
> public static void Main() {
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.kusto
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.kusto string.quoted.multi.kusto
> System.Console.WriteLine("Hello!");
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.kusto
# ^ source.kusto string.quoted.double.kusto punctuation.definition.string.kusto
# ^^^^^^ source.kusto string.quoted.double.kusto
# ^ source.kusto string.quoted.double.kusto punctuation.definition.string.kusto
# ^^^ source.kusto
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.kusto string.quoted.multi.kusto
> }
#^^^^^^ source.kusto
#^^^^^^ source.kusto string.quoted.multi.kusto
> }```
#^^^^^^^ source.kusto
#^^^ source.kusto string.quoted.multi.kusto
# ^^^ source.kusto string.quoted.multi.kusto punctuation.definition.string.kusto
>
>h'hello'
#^^ source.kusto string.quoted.single.kusto punctuation.definition.string.kusto
Expand Down

0 comments on commit 6e6deea

Please sign in to comment.