From 63000d6a23a6e24e845b03888e9550b5e410e242 Mon Sep 17 00:00:00 2001 From: Michael Camilleri Date: Sun, 31 May 2020 04:51:15 +0900 Subject: [PATCH 1/2] Add support for nullish coalescing operator --- lib/rouge/lexers/typescript/common.rb | 1 + spec/visual/samples/typescript | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/rouge/lexers/typescript/common.rb b/lib/rouge/lexers/typescript/common.rb index 5ff1695b10..6611d155cc 100644 --- a/lib/rouge/lexers/typescript/common.rb +++ b/lib/rouge/lexers/typescript/common.rb @@ -33,6 +33,7 @@ def builtins def self.extended(base) base.prepend :root do rule %r/[?][.]/, base::Punctuation + rule %r/[?]{2}/, base::Operator end base.prepend :statement do diff --git a/spec/visual/samples/typescript b/spec/visual/samples/typescript index be3897b743..46f700637c 100644 --- a/spec/visual/samples/typescript +++ b/spec/visual/samples/typescript @@ -203,3 +203,7 @@ declare module "foo" { const x = `Hello world ${a.b}`; const y = `Hello world ${a?.b}`; const z = `Hello world`; + +// Nullish coalescing in template strings +const content = `Value is ${value ?? 'not set'}`; +const description = "Highlighting is broken now"; From 437bcb71a5039ffae95fe0a07620a307f161852b Mon Sep 17 00:00:00 2001 From: Michael Camilleri Date: Wed, 3 Jun 2020 05:10:29 +0900 Subject: [PATCH 2/2] Change wording in visual sample --- spec/visual/samples/typescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/visual/samples/typescript b/spec/visual/samples/typescript index 46f700637c..d72d2b8e43 100644 --- a/spec/visual/samples/typescript +++ b/spec/visual/samples/typescript @@ -206,4 +206,4 @@ const z = `Hello world`; // Nullish coalescing in template strings const content = `Value is ${value ?? 'not set'}`; -const description = "Highlighting is broken now"; +const description = "Highlighting is not broken now";