From 0ef5498de3aff69da3a7e56574f98e0b4e6b5e10 Mon Sep 17 00:00:00 2001 From: uniqueiniquity Date: Wed, 9 Aug 2017 09:13:18 -0700 Subject: [PATCH] Clean up unused functions --- src/services/outliningElementsCollector.ts | 64 ++-------------------- 1 file changed, 4 insertions(+), 60 deletions(-) diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 255e7c9aad6..cad56fe1ced 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -106,61 +106,7 @@ namespace ts.OutliningElementsCollector { return isFunctionBlock(node) && node.parent.kind !== SyntaxKind.ArrowFunction; } - function isRegionStart(range: CommentRange) { - const comment = sourceFile.text.substring(range.pos, range.end); - const result = comment.match(regionStart); - - if (result && result.length > 0) { - const name = result[0].substring(10).trim(); - if (name) { - return name; - } - else { - return regionText; - } - } - return ""; - } - - function isRegionEnd(range: CommentRange) { - const comment = sourceFile.text.substring(range.pos, range.end); - return comment.match(regionEnd); - } - - function addRegionsNearNode(n: Node) { - const precedingToken = ts.findPrecedingToken(n.pos, sourceFile); - const trailingComments = precedingToken && ts.getTrailingCommentRanges(sourceFile.text, precedingToken.end); - const leadingComments = ts.getLeadingCommentRangesOfNode(n, sourceFile); - const comments = concatenate(trailingComments, leadingComments); - - if (n.kind !== SyntaxKind.SourceFile && comments) { - for (const currentComment of comments) { - cancellationToken.throwIfCancellationRequested(); - - if (currentComment.kind === SyntaxKind.SingleLineCommentTrivia) { - const name = isRegionStart(currentComment); - if (name) { - const region: RegionRange = { - pos: currentComment.pos, - end: currentComment.end, - name, - }; - regions.push(region); - } - else if (isRegionEnd(currentComment)) { - const region = regions.pop(); - - if (region) { - region.end = currentComment.end; - // addOutliningSpanRegions(region); - } - } - } - } - } - } - - function isRegionStartBoundaries(start: number, end: number) { + function isRegionStart(start: number, end: number) { const comment = sourceFile.text.substring(start, end); const result = comment.match(regionStart); @@ -187,7 +133,7 @@ namespace ts.OutliningElementsCollector { return ""; } - function isRegionEndBoundaries(start: number, end: number) { + function isRegionEnd(start: number, end: number) { const comment = sourceFile.text.substring(start, end); return comment.match(regionEnd); } @@ -198,7 +144,7 @@ namespace ts.OutliningElementsCollector { for (const currentLineStart of lineStarts) { const lineEnd = sourceFile.getLineEndOfPosition(currentLineStart); - const name = isRegionStartBoundaries(currentLineStart, lineEnd); + const name = isRegionStart(currentLineStart, lineEnd); if (name) { const region: RegionRange = { pos: currentLineStart, @@ -207,7 +153,7 @@ namespace ts.OutliningElementsCollector { }; regions.push(region); } - else if (isRegionEndBoundaries(currentLineStart, lineEnd)) { + else if (isRegionEnd(currentLineStart, lineEnd)) { const region = regions.pop(); if (region) { @@ -224,8 +170,6 @@ namespace ts.OutliningElementsCollector { return; } - addRegionsNearNode(n); - if (isDeclaration(n)) { addOutliningForLeadingCommentsForNode(n); }