Skip to content

Commit 4fca1e1

Browse files
authored
fix(46666): add outlining spans for comments preceding call expressions (microsoft#46682)
1 parent ae582a2 commit 4fca1e1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/services/outliningElementsCollector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace ts.OutliningElementsCollector {
3434
if (depthRemaining === 0) return;
3535
cancellationToken.throwIfCancellationRequested();
3636

37-
if (isDeclaration(n) || isVariableStatement(n) || isReturnStatement(n) || n.kind === SyntaxKind.EndOfFileToken) {
37+
if (isDeclaration(n) || isVariableStatement(n) || isReturnStatement(n) || isCallOrNewExpression(n) || n.kind === SyntaxKind.EndOfFileToken) {
3838
addOutliningForLeadingCommentsForNode(n, sourceFile, cancellationToken, out);
3939
}
4040

tests/cases/fourslash/getOutliningForBlockComments.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@
192192
//// */|]
193193
//// const x = 1;
194194
////}|]
195+
////
196+
////[|/*
197+
////comment
198+
////*/|]
199+
////
200+
////f6();
201+
////
195202
////class C1[| {
196203
//// [|/**
197204
//// * comment
@@ -231,6 +238,12 @@
231238
//// */|]
232239
//// private prop = 1;
233240
////}|]
241+
////
242+
////[|/*
243+
////comment
244+
////*/|]
245+
////new C4();
246+
////
234247
////module M1[| {
235248
//// [|/**
236249
//// * comment

0 commit comments

Comments
 (0)