diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index 0cb7654459c..644f0a12565 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -69,7 +69,6 @@ import { modifierToFlag, ModuleBlock, Node, - ObjectLiteralExpression, ObjectTypeDeclaration, Program, ReturnStatement, @@ -294,7 +293,7 @@ export namespace DocumentHighlights { function getNodesToSearchForModifier(declaration: Node, modifierFlag: ModifierFlags): readonly Node[] | undefined { // Types of node whose children might have modifiers. - const container = declaration.parent as ModuleBlock | SourceFile | Block | CaseClause | DefaultClause | ConstructorDeclaration | MethodDeclaration | FunctionDeclaration | ObjectTypeDeclaration | ObjectLiteralExpression; + const container = declaration.parent as ModuleBlock | SourceFile | Block | CaseClause | DefaultClause | ConstructorDeclaration | MethodDeclaration | FunctionDeclaration | ObjectTypeDeclaration; switch (container.kind) { case SyntaxKind.ModuleBlock: case SyntaxKind.SourceFile: @@ -332,11 +331,8 @@ export namespace DocumentHighlights { return nodes; // Syntactically invalid positions that the parser might produce anyway - case SyntaxKind.ObjectLiteralExpression: - return undefined; - default: - Debug.assertNever(container, "Invalid container kind."); + return undefined; } } diff --git a/tests/baselines/reference/exportInLabeledStatement.baseline.jsonc b/tests/baselines/reference/exportInLabeledStatement.baseline.jsonc new file mode 100644 index 00000000000..1d354ce77c8 --- /dev/null +++ b/tests/baselines/reference/exportInLabeledStatement.baseline.jsonc @@ -0,0 +1,7 @@ +// === documentHighlights === +// filesToSearch: +// /tests/cases/fourslash/a.ts + +// === /tests/cases/fourslash/a.ts === +// subTitle: +// /*HIGHLIGHTS*/export const title: string \ No newline at end of file diff --git a/tests/cases/fourslash/exportInLabeledStatement.ts b/tests/cases/fourslash/exportInLabeledStatement.ts new file mode 100644 index 00000000000..f9bde8c4922 --- /dev/null +++ b/tests/cases/fourslash/exportInLabeledStatement.ts @@ -0,0 +1,8 @@ +/// + +// @Filename: a.ts +//// subTitle: +//// [|export|] const title: string + +verify.baselineDocumentHighlights(test.ranges()[0], { filesToSearch: [test.ranges()[0].fileName] }); +