mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Add outlining spans for case clauses (#37374)
* Add outlining spans for case clauses * Update old test * Update other test * Update yet another of the same test
This commit is contained in:
1 parent
ba39113ab9
commit
db44231e38
5 files changed
+48
-4
No files matched your search
@@ -200,6 +200,9 @@ namespace ts.OutliningElementsCollector {
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.CaseBlock:
|
||||
return spanForNode(n);
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.DefaultClause:
|
||||
return spanForNodeArray((n as CaseClause | DefaultClause).statements);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return spanForObjectOrArrayLiteral(n);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
@@ -256,6 +259,10 @@ namespace ts.OutliningElementsCollector {
|
||||
const closeToken = findChildOfKind(n, close, sourceFile);
|
||||
return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart);
|
||||
}
|
||||
|
||||
function spanForNodeArray(nodeArray: NodeArray<Node>): OutliningSpan | undefined {
|
||||
return nodeArray.length ? createOutliningSpan(createTextSpanFromRange(nodeArray), OutliningSpanKind.Code) : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function functionSpan(node: FunctionLike, body: Block, sourceFile: SourceFile): OutliningSpan | undefined {
|
||||
|
||||
Reference in new issue
Block a user