Include classes as childItems in navigation bar

This commit is contained in:
Andy Hanson 2016-05-25 07:16:23 -07:00
parent 7173fa8d02
commit dbd30542a6
14 changed files with 27 additions and 23 deletions

View file

@ -330,6 +330,9 @@ namespace ts.NavigationBar {
case SyntaxKind.PropertySignature:
return createItem(node, getTextOfNode((<PropertyDeclaration>node).name), ts.ScriptElementKind.memberVariableElement);
case SyntaxKind.ClassDeclaration:
return createItem(node, getTextOfNode((<ClassDeclaration>node).name), ts.ScriptElementKind.classElement);
case SyntaxKind.FunctionDeclaration:
return createItem(node, getTextOfNode((<FunctionLikeDeclaration>node).name), ts.ScriptElementKind.functionElement);

View file

@ -2,7 +2,7 @@
//// {| "itemName": "Windows", "kind": "module", "parentName": "" |}declare module Windows {
//// {| "itemName": "Foundation", "kind": "module", "parentName": "" |}export module Foundation {
//// export var {| "itemName": "A", "kind": "var" |}A;
//// {| "itemName": "Test", "kind": "class" |}export class Test {
//// {| "itemName": "Test", "kind": "class", "parentName": "Foundation" |}export class Test {
//// {| "itemName": "wow", "kind": "method" |}public wow();
//// }
//// }
@ -38,4 +38,4 @@ test.markers().forEach(marker => {
marker.position);
}
});
verify.navigationBarCount(12);
verify.navigationBarCount(15);

View file

@ -11,4 +11,4 @@
//// }
////}
verify.navigationBarCount(6); // 2x(class + field + constructor)
verify.navigationBarCount(9); // global + 2 children + 2x(class + field + constructor)

View file

@ -9,4 +9,4 @@ verify.navigationBarContains("Test", "class");
verify.navigationBarContains("constructor", "constructor");
// no other items
verify.navigationBarCount(2);
verify.navigationBarCount(4); // global + 1 child, Test + 1 child

View file

@ -39,4 +39,4 @@ test.markers().forEach((marker) => {
});
// no other items
verify.navigationBarCount(19);
verify.navigationBarCount(21);

View file

@ -13,7 +13,7 @@
////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes {
////
//// // Class
//// {| "itemName": "Point", "kind": "class", "parentName": "" |}export class Point implements IPoint {
//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint {
//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Point" |}constructor (public x: number, public y: number) { }
////
//// // Instance member
@ -49,4 +49,4 @@ test.markers().forEach((marker) => {
}
});
verify.navigationBarCount(24);
verify.navigationBarCount(25);

View file

@ -1,6 +1,6 @@
/// <reference path="fourslash.ts"/>
////{| "itemName": "Bar", "kind": "class" |}export class Bar {
////{| "itemName": "Bar", "kind": "class", "parentName": "\"navigationBarItemsItemsExternalModules\"" |}export class Bar {
//// {| "itemName": "s", "kind": "property", "parentName": "Bar" |}public s: string;
////}
@ -8,4 +8,4 @@ test.markers().forEach((marker) => {
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
});
verify.navigationBarCount(2); // external module node + class + property
verify.navigationBarCount(4); // external module node + class + property

View file

@ -1,7 +1,7 @@
/// <reference path="fourslash.ts"/>
// @Filename: test/file.ts
////{| "itemName": "Bar", "kind": "class" |}export class Bar {
////{| "itemName": "Bar", "kind": "class", "parentName": "\"file\"" |}export class Bar {
//// {| "itemName": "s", "kind": "property", "parentName": "Bar" |}public s: string;
////}
////{| "itemName": "\"file\"", "kind": "module" |}
@ -12,4 +12,4 @@ test.markers().forEach((marker) => {
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
});
verify.navigationBarCount(4); // external module node + variable in module + class + property
verify.navigationBarCount(5); // external module node + variable in module + class + property

View file

@ -1,7 +1,7 @@
/// <reference path="fourslash.ts"/>
// @Filename: test/my fil"e.ts
////{| "itemName": "Bar", "kind": "class" |}export class Bar {
////{| "itemName": "Bar", "kind": "class", "parentName": "\"my fil\\\"e\"" |}export class Bar {
//// {| "itemName": "s", "kind": "property", "parentName": "Bar" |}public s: string;
////}
////{| "itemName": "\"my fil\\\"e\"", "kind": "module" |}
@ -12,4 +12,4 @@ test.markers().forEach((marker) => {
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
});
verify.navigationBarCount(4); // external module node + variable in module + class + property
verify.navigationBarCount(5); // external module node + 2 children + class + property

View file

@ -2,7 +2,7 @@
/////**
//// * This is a class.
//// */
////{| "itemName": "C", "kind": "class" |} class C {
////{| "itemName": "C", "kind": "class", "parentName": "\"navigationBarItemsMissingName1\"" |} class C {
//// {| "itemName": "foo", "kind": "method" |} foo() {
//// }
////}
@ -12,5 +12,5 @@ test.markers().forEach((marker) => {
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
});
/// Only have two named elements.
verify.navigationBarCount(2);
/// Root + 1 child, class + 1 child
verify.navigationBarCount(4);

View file

@ -20,7 +20,7 @@
//// b"(): Foo;
////}
////
////{| "itemName": "Bar", "kind": "class" |}
////{| "itemName": "Bar", "kind": "class", "parentName": "<global>" |}
////class Bar implements Foo {
//// {| "itemName": "'a1\\\\\\r\\nb'", "kind": "property", "parentName": "Bar" |}
//// 'a1\\\r\nb': Foo;
@ -38,4 +38,4 @@ test.markers().forEach((marker) => {
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
});
verify.navigationBarCount(9); // interface w/ 2 properties, class w/ 2 properties, 3 modules
verify.navigationBarCount(11); // global + 1 child, interface w/ 2 properties, class w/ 2 properties, 3 modules

View file

@ -12,4 +12,4 @@ verify.navigationBarContains("a", "property");
verify.navigationBarContains("b", "property");
// no other items
verify.navigationBarCount(4);
verify.navigationBarCount(6);

View file

@ -1,6 +1,6 @@
/// <reference path="fourslash.ts"/>
////{| "itemName": "C", "kind": "class", "parentName": "" |}
////{| "itemName": "C", "kind": "class", "parentName": "<global>" |}
////class C {
//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "C" |}
//// [Symbol.isRegExp] = 0;
@ -14,4 +14,5 @@ test.markers().forEach(marker => {
verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
});
verify.navigationBarCount(test.markers().length);
// 2 lack markers: <global> and its child
verify.navigationBarCount(2 + test.markers().length);

View file

@ -13,7 +13,7 @@
////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes {
////
//// // Class
//// {| "itemName": "Point", "kind": "class", "parentName": "" |}export class Point implements IPoint {
//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint {
//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Point" |}constructor (public x: number, public y: number) { }
////
//// // Instance member
@ -49,4 +49,4 @@ test.markers().forEach((marker) => {
}
});
verify.navigationBarCount(24);
verify.navigationBarCount(25);