Merge pull request #1 from nrayburn-tech/master

Dart syntax highlighting improvements
This commit is contained in:
Sabolch Varha 2020-02-15 00:20:49 +02:00 committed by GitHub
commit 9dfddf5bdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 25 deletions

View file

@ -178,14 +178,14 @@ export const language = <IMonarchLanguage>{
/[a-z_$][\w$]*/, /[a-z_$][\w$]*/,
{ {
cases: { cases: {
"@typeKeywords": "keyword", "@typeKeywords": "type.identifier",
"@keywords": "keyword", "@keywords": "keyword",
"@default": "identifier" "@default": "identifier"
} }
} }
], ],
[ [
/(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*|bool\\b|num\\b|int\\b|double\\b|dynamic\\b)/, /(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*)/,
"type.identifier" "type.identifier"
], // to show class names nicely ], // to show class names nicely
// [/[A-Z][\w\$]*/, 'identifier'], // [/[A-Z][\w\$]*/, 'identifier'],
@ -232,8 +232,7 @@ export const language = <IMonarchLanguage>{
[/"([^"\\]|\\.)*$/, "string.invalid"], // non-teminated string [/"([^"\\]|\\.)*$/, "string.invalid"], // non-teminated string
[/'([^'\\]|\\.)*$/, "string.invalid"], // non-teminated string [/'([^'\\]|\\.)*$/, "string.invalid"], // non-teminated string
[/"/, "string", "@string_double"], [/"/, "string", "@string_double"],
[/'/, "string", "@string_single"], [/'/, "string", "@string_single"]
[/`/, "string", "@string_backtick"]
// [/[a-zA-Z]+/, "variable"] // [/[a-zA-Z]+/, "variable"]
], ],
@ -242,6 +241,7 @@ export const language = <IMonarchLanguage>{
[/[ \t\r\n]+/, ""], [/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"], [/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"],
[/\/\*/, "comment", "@comment"], [/\/\*/, "comment", "@comment"],
[/\/\/\/.*$/, "comment.doc"],
[/\/\/.*$/, "comment"] [/\/\/.*$/, "comment"]
], ],
@ -308,32 +308,19 @@ export const language = <IMonarchLanguage>{
], ],
string_double: [ string_double: [
[/\$\{/, { token: "delimiter.bracket", next: "@bracketCounting" }], [/[^\\"\$]+/, "string"], [/[^\\"]+/, "string"],
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"], [/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"], [/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"] [/"/, "string", "@pop"],
[/\$\w+/, 'identifier']
], ],
string_single: [ string_single: [
[/[^\\']+/, "string"], [/[^\\'\$]+/, "string"],
[/@escapes/, "string.escape"], [/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"], [/\\./, "string.escape.invalid"],
[/'/, "string", "@pop"] [/'/, "string", "@pop"],
[/\$\w+/, 'identifier']
], ],
string_backtick: [
[/\$\{/, { token: "delimiter.bracket", next: "@bracketCounting" }],
[/[^\\`$]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/`/, "string", "@pop"]
],
bracketCounting: [
[/\{/, "delimiter.bracket", "@bracketCounting"],
[/\}/, "delimiter.bracket", "@pop"],
{ include: "common" }
]
} }
}; };

View file

@ -202,8 +202,8 @@ export const language = <ILanguage>{
[/[,:;]/, 'delimiter'], [/[,:;]/, 'delimiter'],
[/[{}\[\]()]/, '@brackets'], [/[{}\[\]()]/, '@brackets'],
[/@[a-zA-Z]\w*/, 'tag'], [/@[a-zA-Z_]\w*/, 'tag'],
[/[a-zA-Z]\w*/, { [/[a-zA-Z_]\w*/, {
cases: { cases: {
'@keywords': 'keyword', '@keywords': 'keyword',
'@default': 'identifier' '@default': 'identifier'