Skip to content

Commit 05dacd2

Browse files
authored
Upgrade syntax highlighting (#55)
1 parent de914f7 commit 05dacd2

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/lib/editor/Luau.tmLanguage.json

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
],
77
"name": "Luau",
88
"scopeName": "source.luau",
9-
"fileTypes": [
10-
"luau"
11-
],
9+
"fileTypes": ["luau"],
1210
"patterns": [
1311
{
1412
"include": "#function-definition"
@@ -506,24 +504,28 @@
506504
"patterns": [
507505
{
508506
"name": "keyword.operator.other.luau",
509-
"begin": "(```luau?)\\s+",
510-
"end": "(```)",
507+
"begin": "(```luau?)\\s*$",
508+
"while": "^(?!\\s*```)",
511509
"beginCaptures": {
512510
"1": {
513511
"name": "comment.luau"
514512
}
515513
},
516-
"endCaptures": {
517-
"1": {
518-
"name": "comment.luau"
519-
}
520-
},
521514
"patterns": [
522515
{
523516
"include": "source.luau"
524517
}
525518
]
526519
},
520+
{
521+
"match": "(```)",
522+
"name": "keyword.operator.other.luau",
523+
"captures": {
524+
"1": {
525+
"name": "comment.luau"
526+
}
527+
}
528+
},
527529
{
528530
"include": "#doc_comment_tags"
529531
}
@@ -605,7 +607,7 @@
605607
]
606608
},
607609
"type-function": {
608-
"begin": "^\\b(?:(export)\\s+)?(type)\\s+(function)\\b",
610+
"begin": "(?<![^.]\\.|:)\\b(?:(export)\\s+)?(type)\\s+(function)\\b",
609611
"beginCaptures": {
610612
"1": {
611613
"name": "storage.modifier.visibility.luau"
@@ -679,8 +681,8 @@
679681
]
680682
},
681683
"type-alias-declaration": {
682-
"begin": "^\\b(?:(export)\\s+)?(type)\\b",
683-
"end": "(?=\\s*$)|(?=\\s*;)",
684+
"begin": "(?<![^.]\\.|:)\\b(?:(export)\\s+)?(type)\\b(?=\\s+(?!function\\b)[a-zA-Z_][a-zA-Z0-9_]*)",
685+
"end": "(?=[),}\\]](?!\\s*[&|]))|(?=\\s*;)|(?=\\s*\\b(?:break|continue|do|else|elseif|end|for|function|if|in|local|repeat|return|then|until|while)\\b)|(?=^\\s*$)|(?=^\\s*(?:@|\\b(?:export\\s+)?type\\b))|(?=^\\s*[a-zA-Z_][a-zA-Z0-9_]*(?:\\.[a-zA-Z_][a-zA-Z0-9_]*)*\\s*(?:(?:[+\\-*/%^]|\\.\\.)?=(?!=)|\\(|\\[|:))",
684686
"beginCaptures": {
685687
"1": {
686688
"name": "storage.modifier.visibility.luau"
@@ -718,7 +720,7 @@
718720
"name": "keyword.operator.typecast.luau"
719721
}
720722
},
721-
"end": "(?=^|[;),}\\]:?\\-\\+\\>](?!\\s*[&\\|])|$|\\b(break|do|else|for|if|elseif|return|then|repeat|while|until|end|in|continue)\\b)",
723+
"end": "(?=[),}\\]](?!\\s*[&|]))|(?=\\s*;)|(?=\\s*\\b(?:break|continue|do|else|elseif|end|for|function|if|in|local|repeat|return|then|until|while)\\b)|(?=^\\s*$)|(?=^\\s*(?:@|\\b(?:export\\s+)?type\\b))|(?=^\\s*[a-zA-Z_][a-zA-Z0-9_]*(?:\\.[a-zA-Z_][a-zA-Z0-9_]*)*\\s*(?:(?:[+\\-*/%^]|\\.\\.)?=(?!=)|\\(|\\[|:))",
722724
"patterns": [
723725
{
724726
"include": "#type_literal"

0 commit comments

Comments
 (0)