mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 15:25:54 -06:00
Add type aliases to navigation bar
This commit is contained in:
parent
f93077f0ae
commit
eabafc4b09
@ -176,6 +176,7 @@ namespace ts.NavigationBar {
|
||||
break;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
topLevelNodes.push(node);
|
||||
break;
|
||||
|
||||
@ -422,6 +423,9 @@ namespace ts.NavigationBar {
|
||||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
return createFunctionItem(<FunctionDeclaration>node);
|
||||
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return createTypeAliasItem(<TypeAliasDeclaration>node);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@ -474,6 +478,15 @@ namespace ts.NavigationBar {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function createTypeAliasItem(node: TypeAliasDeclaration): ts.NavigationBarItem {
|
||||
return getNavigationBarItem(node.name.text,
|
||||
ts.ScriptElementKind.typeElement,
|
||||
getNodeModifiers(node),
|
||||
[getNodeSpan(node)],
|
||||
[],
|
||||
getIndent(node));
|
||||
}
|
||||
|
||||
function createMemberFunctionLikeItem(node: MethodDeclaration | ConstructorDeclaration): ts.NavigationBarItem {
|
||||
if (node.body && node.body.kind === SyntaxKind.Block) {
|
||||
let childItems = getItemsWorker(sortNodes((<Block>node.body).statements), createChildItem);
|
||||
|
||||
6
tests/cases/fourslash/navigationBarItemsTypeAlias.ts
Normal file
6
tests/cases/fourslash/navigationBarItemsTypeAlias.ts
Normal file
@ -0,0 +1,6 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////type T = number | string;
|
||||
|
||||
verify.navigationBarCount(1);
|
||||
verify.navigationBarContains("T", "type");
|
||||
Loading…
x
Reference in New Issue
Block a user