Skip to content

Commit 2db0d7b

Browse files
jablkosandersn
authored andcommitted
Either clone or pull, don't do both (microsoft#35230)
Co-authored-by: Nathan Shively-Sanders <[email protected]>
1 parent 9096724 commit 2db0d7b

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

src/services/outliningElementsCollector.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace ts.OutliningElementsCollector {
44
const res: OutliningSpan[] = [];
55
addNodeOutliningSpans(sourceFile, cancellationToken, res);
66
addRegionOutliningSpans(sourceFile, res);
7+
addTopLevelUnattachedCommentSpans(sourceFile, res);
78
return res.sort((span1, span2) => span1.textSpan.start - span2.textSpan.start);
89
}
910

@@ -75,6 +76,23 @@ namespace ts.OutliningElementsCollector {
7576
}
7677
}
7778

79+
function addTopLevelUnattachedCommentSpans(sourceFile: SourceFile, out: Push<OutliningSpan>): void {
80+
// Comments which are attached to statements would be included in addNodeOutliningSpans
81+
if (sourceFile.statements.length > 0) return;
82+
83+
// This will instead set up spans for the missing ones
84+
forEach(getLeadingCommentRangesOfNode(sourceFile, sourceFile), (range) => {
85+
// To not mess with // #region support
86+
const isMultiline = sourceFile.text.substring(range.pos, 2) === "/*"
87+
if (!isMultiline) return;
88+
89+
const span = createTextSpanFromBounds(range.pos, range.end);
90+
const comment = sourceFile.text.substring(range.pos, range.end)
91+
const outline = createOutliningSpan(span, OutliningSpanKind.Comment, span, /*autoCollapse*/ false, comment)
92+
out.push(outline);
93+
});
94+
}
95+
7896
function addRegionOutliningSpans(sourceFile: SourceFile, out: Push<OutliningSpan>): void {
7997
const regions: OutliningSpan[] = [];
8098
const lineStarts = sourceFile.getLineStarts();

src/testRunner/externalCompileRunner.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ namespace Harness {
5858
if (!fs.existsSync(submoduleDir)) {
5959
exec("git", ["clone", config.cloneUrl, directoryName], { cwd });
6060
}
61-
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
62-
exec("git", ["clean", "-f"], { cwd: submoduleDir });
63-
exec("git", ["pull", "-f"], { cwd: submoduleDir });
61+
else {
62+
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
63+
exec("git", ["clean", "-f"], { cwd: submoduleDir });
64+
exec("git", ["pull", "-f"], { cwd: submoduleDir });
65+
}
6466

6567
types = config.types;
6668

@@ -337,4 +339,4 @@ ${stderr.replace(/\r\n/g, "\n")}`;
337339
}
338340
return result;
339341
}
340-
}
342+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
// #22732
4+
5+
////[|/*
6+
///// * Some text
7+
//// */|]
8+
9+
verify.outliningHintSpansInCurrentFile(test.ranges());

0 commit comments

Comments
 (0)