Skip to content

Commit 91b4733

Browse files
author
Andy Hanson
committed
Include interfaces as childItems in navigation bar
1 parent 7173fa8 commit 91b4733

6 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/services/navigationBar.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ namespace ts.NavigationBar {
320320
case SyntaxKind.EnumMember:
321321
return createItem(node, getTextOfNode((<EnumMember>node).name), ts.ScriptElementKind.memberVariableElement);
322322

323+
case SyntaxKind.InterfaceDeclaration:
324+
return createItem(node, getTextOfNode((<InterfaceDeclaration>node).name), ts.ScriptElementKind.interfaceElement);
325+
323326
case SyntaxKind.CallSignature:
324327
return createItem(node, "()", ts.ScriptElementKind.callSignatureElement);
325328

tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
////
77
//// }
88
////
9-
//// {| "itemName": "LocalInterfaceInConstrcutor", "kind": "interface", "parentName": ""|}interface LocalInterfaceInConstrcutor {
9+
//// {| "itemName": "LocalInterfaceInConstrcutor", "kind": "interface", "parentName": "constructor"|}interface LocalInterfaceInConstrcutor {
1010
//// }
1111
////
1212
//// {| "itemName": "LocalEnumInConstructor", "kind": "enum", "parentName": "constructor"|}enum LocalEnumInConstructor {
@@ -21,7 +21,7 @@
2121
//// }
2222
//// }
2323
////
24-
//// {| "itemName": "LocalInterfaceInMethod", "kind": "interface", "parentName": ""|}interface LocalInterfaceInMethod {
24+
//// {| "itemName": "LocalInterfaceInMethod", "kind": "interface", "parentName": "method"|}interface LocalInterfaceInMethod {
2525
//// }
2626
////
2727
//// {| "itemName": "LocalEnumInMethod", "kind": "enum", "parentName": "method"|}enum LocalEnumInMethod {
@@ -39,4 +39,4 @@ test.markers().forEach((marker) => {
3939
});
4040

4141
// no other items
42-
verify.navigationBarCount(19);
42+
verify.navigationBarCount(21);

tests/cases/fourslash/navigationBarItemsItems.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path="fourslash.ts"/>
22

33
////// Interface
4-
////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint {
4+
////{| "itemName": "IPoint", "kind": "interface", "parentName": "<global>" |}interface IPoint {
55
//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number;
66
//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint;
77
//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any;
@@ -49,4 +49,4 @@ test.markers().forEach((marker) => {
4949
}
5050
});
5151

52-
verify.navigationBarCount(24);
52+
verify.navigationBarCount(25);

tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
////{| "itemName": "\"MultilineMadness\"", "kind": "module" |}
1111
////declare module "MultilineMadness" {}
1212
////
13-
////{| "itemName": "Foo", "kind": "interface" |}
13+
////{| "itemName": "Foo", "kind": "interface", "parentName": "<global>" |}
1414
////interface Foo {
1515
//// {| "itemName": "\"a1\\\\\\r\\nb\"", "kind": "property", "parentName": "Foo" |}
1616
//// "a1\\\r\nb";
@@ -38,4 +38,4 @@ test.markers().forEach((marker) => {
3838
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
3939
});
4040

41-
verify.navigationBarCount(9); // interface w/ 2 properties, class w/ 2 properties, 3 modules
41+
verify.navigationBarCount(11); // interface w/ 2 properties, class w/ 2 properties, 3 modules

tests/cases/fourslash/navigationBarItemsSymbols2.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference path="fourslash.ts"/>
22

3-
////{| "itemName": "I", "kind": "interface", "parentName": "" |}
3+
////{| "itemName": "I", "kind": "interface", "parentName": "<global>" |}
44
////interface I {
55
//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "I" |}
66
//// [Symbol.isRegExp]: string;
@@ -12,4 +12,5 @@ test.markers().forEach(marker => {
1212
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
1313
});
1414

15-
verify.navigationBarCount(test.markers().length);
15+
// 2 are not marked: <global> and its child.
16+
verify.navigationBarCount(2 + test.markers().length);

tests/cases/fourslash/server/navbar01.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path="../fourslash.ts"/>
22

33
////// Interface
4-
////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint {
4+
////{| "itemName": "IPoint", "kind": "interface", "parentName": "<global>" |}interface IPoint {
55
//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number;
66
//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint;
77
//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any;
@@ -49,4 +49,4 @@ test.markers().forEach((marker) => {
4949
}
5050
});
5151

52-
verify.navigationBarCount(24);
52+
verify.navigationBarCount(25);

0 commit comments

Comments
 (0)