Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/services/navigationBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ namespace ts.NavigationBar {
case SyntaxKind.IndexSignature:
return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement);

case SyntaxKind.EnumDeclaration:
return createItem(node, getTextOfNode((<EnumDeclaration>node).name), ts.ScriptElementKind.enumElement);

case SyntaxKind.EnumMember:
return createItem(node, getTextOfNode((<EnumMember>node).name), ts.ScriptElementKind.memberVariableElement);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//// {| "itemName": "LocalInterfaceInConstrcutor", "kind": "interface", "parentName": ""|}interface LocalInterfaceInConstrcutor {
//// }
////
//// enum LocalEnumInConstructor {
//// {| "itemName": "LocalEnumInConstructor", "kind": "enum", "parentName": "constructor"|}enum LocalEnumInConstructor {
//// {| "itemName": "LocalEnumMemberInConstructor", "kind": "property", "parentName": "LocalEnumInConstructor"|}LocalEnumMemberInConstructor,
//// }
//// }
Expand All @@ -24,7 +24,7 @@
//// {| "itemName": "LocalInterfaceInMethod", "kind": "interface", "parentName": ""|}interface LocalInterfaceInMethod {
//// }
////
//// {| "itemName": "LocalEnumInMethod", "kind": "enum", "parentName": ""|}enum LocalEnumInMethod {
//// {| "itemName": "LocalEnumInMethod", "kind": "enum", "parentName": "method"|}enum LocalEnumInMethod {
//// {| "itemName": "LocalEnumMemberInMethod", "kind": "property", "parentName": "LocalEnumInMethod"|}LocalEnumMemberInMethod,
//// }
//// }
Expand All @@ -39,4 +39,4 @@ test.markers().forEach((marker) => {
});

// no other items
verify.navigationBarCount(17);
verify.navigationBarCount(19);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so what are the new 2 entries here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One for each enum.

4 changes: 2 additions & 2 deletions tests/cases/fourslash/navigationBarItemsItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Point" |}private static getOrigin() { return Point.origin;}
//// }
////
//// {| "itemName": "Values", "kind": "enum", "parentName": "" |}enum Values {
//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values {
//// value1,
//// {| "itemName": "value2", "kind": "property", "parentName": "Values" |}value2,
//// value3,
Expand All @@ -49,4 +49,4 @@ test.markers().forEach((marker) => {
}
});

verify.navigationBarCount(23);
verify.navigationBarCount(24);
4 changes: 2 additions & 2 deletions tests/cases/fourslash/navigationBarItemsSymbols3.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path="fourslash.ts"/>

////{| "itemName": "E", "kind": "enum", "parentName": "" |}
////{| "itemName": "E", "kind": "enum", "parentName": "<global>" |}
////enum E {
//// // No nav bar entry for this
//// [Symbol.isRegExp] = 0
Expand All @@ -10,4 +10,4 @@ test.markers().forEach(marker => {
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
});

verify.navigationBarCount(test.markers().length);
verify.navigationBarCount(3); // <global> and E appearing both toplevel and under <global>
4 changes: 2 additions & 2 deletions tests/cases/fourslash/server/navbar01.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Point" |}private static getOrigin() { return Point.origin;}
//// }
////
//// {| "itemName": "Values", "kind": "enum", "parentName": "" |}enum Values {
//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values {
//// value1,
//// {| "itemName": "value2", "kind": "property", "parentName": "Values" |}value2,
//// value3,
Expand All @@ -49,4 +49,4 @@ test.markers().forEach((marker) => {
}
});

verify.navigationBarCount(23);
verify.navigationBarCount(24);