diff --git a/src/basic-languages/yaml/yaml.test.ts b/src/basic-languages/yaml/yaml.test.ts index 938d010a..76845651 100644 --- a/src/basic-languages/yaml/yaml.test.ts +++ b/src/basic-languages/yaml/yaml.test.ts @@ -602,7 +602,7 @@ testTokenization('yaml', [ } ], - // Comment following Value + // Comment following Value [ { line: 'key: value #comment', @@ -633,5 +633,38 @@ testTokenization('yaml', [ } ] } + ], + + // ': ' in Comment following Value + [ + { + line: 'key: value #comment: also comment', + tokens: [ + { + startIndex: 0, + type: 'type.yaml' + }, + { + startIndex: 3, + type: 'operators.yaml' + }, + { + startIndex: 4, + type: 'white.yaml' + }, + { + startIndex: 5, + type: 'string.yaml' + }, + { + startIndex: 10, + type: 'white.yaml' + }, + { + startIndex: 11, + type: 'comment.yaml' + } + ] + } ] ]); diff --git a/src/basic-languages/yaml/yaml.ts b/src/basic-languages/yaml/yaml.ts index fd2b6bba..5d187d14 100644 --- a/src/basic-languages/yaml/yaml.ts +++ b/src/basic-languages/yaml/yaml.ts @@ -86,7 +86,7 @@ export const language = { [/@numberDate(?![ \t]*\S+)/, 'number.date'], // Key:Value pair - [/(".*?"|'.*?'|[^'"]*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']], + [/(".*?"|'.*?'|[^#'"]*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']], { include: '@flowScalars' },