From 48f1178cc142a917a3b0ab1b1f7b768807116271 Mon Sep 17 00:00:00 2001 From: shaischaudhry Date: Wed, 28 May 2025 10:55:39 +0500 Subject: [PATCH] Fix missing ClassificationType.regularExpressionLiteral cases in classifier - Add missing case for ClassificationType.regularExpressionLiteral in convertClassification function - Add missing case for ClassificationType.regularExpressionLiteral in getClassificationTypeName function - Maps regularExpressionLiteral to stringLiteral classification to match existing behavior - Fixes compilation errors and makes switch statements exhaustive --- src/services/classifier.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/classifier.ts b/src/services/classifier.ts index cf2b087aeb85f..d28e3299810f5 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -394,6 +394,8 @@ function convertClassification(type: ClassificationType): TokenClass { case ClassificationType.text: case ClassificationType.parameterName: return TokenClass.Identifier; + case ClassificationType.regularExpressionLiteral: + return TokenClass.StringLiteral; default: return undefined!; // TODO: GH#18217 Debug.assertNever(type); } @@ -692,6 +694,8 @@ function getClassificationTypeName(type: ClassificationType): ClassificationType return ClassificationTypeNames.jsxText; case ClassificationType.jsxAttributeStringLiteralValue: return ClassificationTypeNames.jsxAttributeStringLiteralValue; + case ClassificationType.regularExpressionLiteral: + return ClassificationTypeNames.stringLiteral; default: return undefined!; // TODO: GH#18217 Debug.assertNever(type); }