From 4fca1e1fcd6006150a0060d1016b430c1a818af1 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Thu, 4 Nov 2021 21:43:01 +0200 Subject: [PATCH] fix(46666): add outlining spans for comments preceding call expressions (#46682) --- src/services/outliningElementsCollector.ts | 2 +- .../cases/fourslash/getOutliningForBlockComments.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index be6755e880..c071fb145c 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -34,7 +34,7 @@ namespace ts.OutliningElementsCollector { if (depthRemaining === 0) return; cancellationToken.throwIfCancellationRequested(); - if (isDeclaration(n) || isVariableStatement(n) || isReturnStatement(n) || n.kind === SyntaxKind.EndOfFileToken) { + if (isDeclaration(n) || isVariableStatement(n) || isReturnStatement(n) || isCallOrNewExpression(n) || n.kind === SyntaxKind.EndOfFileToken) { addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out); } diff --git a/tests/cases/fourslash/getOutliningForBlockComments.ts b/tests/cases/fourslash/getOutliningForBlockComments.ts index 59e11451b3..93d7ed8818 100644 --- a/tests/cases/fourslash/getOutliningForBlockComments.ts +++ b/tests/cases/fourslash/getOutliningForBlockComments.ts @@ -192,6 +192,13 @@ //// */|] //// const x = 1; ////}|] +//// +////[|/* +////comment +////*/|] +//// +////f6(); +//// ////class C1[| { //// [|/** //// * comment @@ -231,6 +238,12 @@ //// */|] //// private prop = 1; ////}|] +//// +////[|/* +////comment +////*/|] +////new C4(); +//// ////module M1[| { //// [|/** //// * comment