diff --git a/src/services/classifier.ts b/src/services/classifier.ts index a18f861db2dcf..443555c2bbd21 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -985,8 +985,7 @@ namespace ts { return ClassificationType.bigintLiteral; } else if (tokenKind === SyntaxKind.StringLiteral) { - // TODO: GH#18217 - return token!.parent.kind === SyntaxKind.JsxAttribute ? ClassificationType.jsxAttributeStringLiteralValue : ClassificationType.stringLiteral; + return token && token.parent.kind === SyntaxKind.JsxAttribute ? ClassificationType.jsxAttributeStringLiteralValue : ClassificationType.stringLiteral; } else if (tokenKind === SyntaxKind.RegularExpressionLiteral) { // TODO: we should get another classification type for these literals. diff --git a/tests/cases/fourslash/syntacticClassificationsMergeConflictMarker1.ts b/tests/cases/fourslash/syntacticClassificationsMergeConflictMarker1.ts new file mode 100644 index 0000000000000..b78a6f35982a6 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsMergeConflictMarker1.ts @@ -0,0 +1,16 @@ +/// + +//// <<<<<<< HEAD +//// "AAAA" +//// ======= +//// "BBBB" +//// >>>>>>> Feature + + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("<<<<<<< HEAD"), + c.stringLiteral("\"AAAA\""), + c.comment("======="), + c.stringLiteral("\"BBBB\""), + c.comment(">>>>>>> Feature")); \ No newline at end of file