From d6197d6e148ee82d4020c76f5d3e5cee397bcf81 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 10 May 2021 16:45:17 +0200 Subject: [PATCH] Fixes microsoft/monaco-editor#2398 --- src/yaml/yaml.test.ts | 25 +++++++++++++++++++++++++ src/yaml/yaml.ts | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/yaml/yaml.test.ts b/src/yaml/yaml.test.ts index f66b1fd9..c2e5484e 100644 --- a/src/yaml/yaml.test.ts +++ b/src/yaml/yaml.test.ts @@ -449,5 +449,30 @@ testTokenization('yaml', [ } ] } + ], + [ + { + line: + "text: Pretty vector drawing. #this is comment doesn't have proper syntax higlighting", + tokens: [ + { startIndex: 0, type: 'type.yaml' }, + { startIndex: 4, type: 'operators.yaml' }, + { startIndex: 5, type: 'white.yaml' }, + { startIndex: 6, type: 'string.yaml' }, + { startIndex: 29, type: 'comment.yaml' } + ] + } + ], + [ + { + line: "number: 3 #this comment also doesn't have proper syntax highlighting", + tokens: [ + { startIndex: 0, type: 'type.yaml' }, + { startIndex: 6, type: 'operators.yaml' }, + { startIndex: 7, type: 'white.yaml' }, + { startIndex: 8, type: 'string.yaml' }, + { startIndex: 10, type: 'comment.yaml' } + ] + } ] ]); diff --git a/src/yaml/yaml.ts b/src/yaml/yaml.ts index 2862588c..27cee7d3 100644 --- a/src/yaml/yaml.ts +++ b/src/yaml/yaml.ts @@ -84,7 +84,7 @@ export const language = { // String nodes [ - /.+$/, + /[^#]+/, { cases: { '@keywords': 'keyword',