Skip to content

Commit

Permalink
feat: syntax highlighting for prebuilt entity name and multi entity d…
Browse files Browse the repository at this point in the history
…efinition in one line (#1882)

* fix pribuilt entity highlight

* fix multi entity definition in single line

* fix tokens

Co-authored-by: Andy Brown <[email protected]>
  • Loading branch information
cosmicshuai and a-b-r-o-w-n authored Jan 29, 2020
1 parent 1f13b0a commit 12d77a0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Composer/packages/lib/code-editor/src/languages/lu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ export function registerLULanguage(monaco: typeof monacoEditor) {
[/^\s*>\s*[\s\S]*$/, { token: 'comments' }],
[/^\s*-/, { token: 'utterrance-indentifier', next: 'utterrance' }],
[
/(@\s*)(ml|prebuilt|regex|list|composite|patternany|phraselist)(\s*\w*)/,
/(@\s*)(prebuilt\s*)(age|datetimeV2|dimension|email|geographyV2|keyPhrase|money|number|ordinal|ordinalV2|percentage|personName|phonenumber|temperature|url|datetime)(\s*[\w_,\s]+)/,
['intent-indentifier', 'entity-type', 'prebult-type', 'entity-name'],
],
[
// eslint-disable-next-line security/detect-unsafe-regex
/(@\s*)(ml|prebuilt|regex|list|composite|patternany|phraselist)(\s*[\w_]+)/,
['intent-indentifier', 'entity-type', 'entity-name'],
],
[/(@\s*)(\s*\w*)/, ['intent-indentifier', 'entity-name']],
[/(@\s*)(\s*[\w_]+)/, ['intent-indentifier', 'entity-name']],
[/\s*(hasRoles|useFeature)\s*/, 'keywords'],
[/.*$/, 'entity-other', '@pop'],
],
Expand Down Expand Up @@ -71,6 +76,7 @@ export function registerLULanguage(monaco: typeof monacoEditor) {
{ token: 'comments', foreground: '7A7A7A' },
{ token: 'import-desc', foreground: '00A32B' },
{ token: 'entity-type', foreground: 'DF2C2C' },
{ token: 'prebult-type', foreground: 'DF2C2C' },
{ token: 'keywords', foreground: '0078D7' },
],
});
Expand Down

0 comments on commit 12d77a0

Please sign in to comment.