From c362bfab0e4e4e53f4ba13e67c9caf8af358bb12 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 4 Mar 2019 12:38:58 +0100 Subject: [PATCH] Fixes Microsoft/monaco-editor#1278 --- src/fsharp/fsharp.test.ts | 15 +++++++++++++++ src/fsharp/fsharp.ts | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/fsharp/fsharp.test.ts b/src/fsharp/fsharp.test.ts index 2fe82857..c542c833 100644 --- a/src/fsharp/fsharp.test.ts +++ b/src/fsharp/fsharp.test.ts @@ -442,5 +442,20 @@ testTokenization('fsharp', [ tokens: [ { startIndex: 0, type: 'number.float.fs' } ] + }], + + [{ + line: '(* This operator -> (*) should be ignored *) let i = 0', + tokens: [ + { startIndex: 0, type: 'comment.fs' }, + { startIndex: 44, type: '' }, + { startIndex: 45, type: 'keyword.let.fs' }, + { startIndex: 48, type: '' }, + { startIndex: 49, type: 'identifier.fs' }, + { startIndex: 50, type: '' }, + { startIndex: 51, type: 'delimiter.fs' }, + { startIndex: 52, type: '' }, + { startIndex: 53, type: 'number.fs' } + ] }] ]); diff --git a/src/fsharp/fsharp.ts b/src/fsharp/fsharp.ts index 42fce872..7e08d720 100644 --- a/src/fsharp/fsharp.ts +++ b/src/fsharp/fsharp.ts @@ -132,9 +132,11 @@ export const language = { ], comment: [ - [/[^\*]+/, 'comment'], + [/[^*(]+/, 'comment'], [/\*\)/, 'comment', '@pop'], - [/\*/, 'comment'] + [/\*/, 'comment'], + [/\(\*\)/, 'comment'], + [/\(/, 'comment'] ], string: [