Skip to content

Commit 7c08226

Browse files
committed
完成luadoc的语法着色
1 parent cee1892 commit 7c08226

File tree

1 file changed

+117
-9
lines changed

1 file changed

+117
-9
lines changed

syntaxes/lua.tmLanguage.json

Lines changed: 117 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,22 +435,130 @@
435435
"include": "#luadoc.type"
436436
}
437437
]
438+
},
439+
{
440+
"begin": "@field",
441+
"beginCaptures": {
442+
"0": {
443+
"name": "storage.type.annotation.lua"
444+
}
445+
},
446+
"end": "(?=\\n)",
447+
"patterns": [
448+
{
449+
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
450+
"beginCaptures": {
451+
"0": {
452+
"name": "entity.name.variable.lua"
453+
}
454+
},
455+
"end": "(?=\\n)",
456+
"patterns": [
457+
{
458+
"include": "#luadoc.type"
459+
}
460+
]
461+
}
462+
]
463+
},
464+
{
465+
"begin": "@generic",
466+
"beginCaptures": {
467+
"0": {
468+
"name": "storage.type.annotation.lua"
469+
}
470+
},
471+
"end": "(?=\\n)",
472+
"patterns": [
473+
{
474+
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
475+
"beginCaptures": {
476+
"0": {
477+
"name": "storage.type.generic.lua"
478+
}
479+
},
480+
"end": "(?=\\n)",
481+
"patterns": [
482+
{
483+
"match": ":",
484+
"name": "keyword.operator.lua"
485+
},
486+
{
487+
"include": "#luadoc.type"
488+
}
489+
]
490+
}
491+
]
492+
},
493+
{
494+
"begin": "@vararg",
495+
"beginCaptures": {
496+
"0": {
497+
"name": "storage.type.annotation.lua"
498+
}
499+
},
500+
"end": "(?=\\n)",
501+
"patterns": [
502+
{
503+
"include": "#luadoc.type"
504+
}
505+
]
506+
},
507+
{
508+
"begin": "@overload",
509+
"beginCaptures": {
510+
"0": {
511+
"name": "storage.type.annotation.lua"
512+
}
513+
},
514+
"end": "(?=\\n)",
515+
"patterns": [
516+
{
517+
"include": "#luadoc.type"
518+
}
519+
]
438520
}
439521
]
440522
},
441523
"luadoc.type": {
442-
"begin": "(?=[a-zA-Z_\\.\"])",
443-
"end": "(?=\\s)",
444524
"patterns": [
445525
{
446-
"match": "(\\b([a-zA-Z_][a-zA-Z0-9_\\.]*)\\b)[ \\t]*",
447-
"name": "support.type.lua"
448-
},
449-
{
450-
"include": "#string"
526+
"begin": "fun",
527+
"beginCaptures": {
528+
"0": {
529+
"name": "keyword.control.lua"
530+
}
531+
},
532+
"end": "(?=\\s)",
533+
"patterns": [
534+
{
535+
"match": "[\\(\\),:][ \\t]*",
536+
"name": "keyword.operator.lua"
537+
},
538+
{
539+
"match": "(\\b([a-zA-Z_][a-zA-Z0-9_\\.]*)\\b)[ \\t]*(?=:)",
540+
"name": "entity.name.variable.lua"
541+
},
542+
{
543+
"include": "#luadoc.type"
544+
}
545+
]
451546
},
452547
{
453-
"include": "#luadoc.type.resume"
548+
"begin": "(?=[a-zA-Z_\\.\"])",
549+
"end": "(?=[\\s\\),])",
550+
"patterns": [
551+
{
552+
"match": "(\\b([a-zA-Z_][a-zA-Z0-9_\\.]*)\\b)[ \\t]*",
553+
"name": "support.type.lua"
554+
},
555+
{
556+
"include": "#string"
557+
},
558+
{
559+
"include": "#luadoc.type.resume"
560+
}
561+
]
454562
}
455563
]
456564
},
@@ -461,7 +569,7 @@
461569
"name": "keyword.operator.lua"
462570
}
463571
},
464-
"end": "(?=\\s)",
572+
"end": "(?=[\\s\\),])",
465573
"patterns": [
466574
{
467575
"match": "(\\b([a-zA-Z_][a-zA-Z0-9_\\.]*)\\b)[ \\t]*",

0 commit comments

Comments
 (0)