diff --git a/src/services/services.ts b/src/services/services.ts index 70022cfe0bf..18510b9a178 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -6300,6 +6300,10 @@ namespace ts { } function classifyToken(token: Node): void { + if (nodeIsMissing(token)) { + return; + } + let tokenStart = classifyLeadingTriviaAndGetTokenStart(token); let tokenWidth = token.end - tokenStart; diff --git a/tests/cases/fourslash/syntacticClassificationWithErrors.ts b/tests/cases/fourslash/syntacticClassificationWithErrors.ts new file mode 100644 index 00000000000..b4572d3e620 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationWithErrors.ts @@ -0,0 +1,14 @@ +/// + +////class A { +//// a: +////} +////c = + +let c = classification +verify.syntacticClassificationsAre( + c.keyword("class"), c.className("A"), c.punctuation("{"), + c.text("a"), c.punctuation(":"), + c.punctuation("}"), + c.text("c"), c.operator("=") + ); \ No newline at end of file