From fe77f541f600492025680e82b58895f3f3ceedd4 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 25 May 2016 07:24:14 -0700 Subject: [PATCH 1/5] Always include a root node in the navigation bar. This lets us change the navigation bar counting algorithm to traverse from the root only, so it never has duplicate nodes. --- src/harness/fourslash.ts | 19 +++++++++---------- src/services/navigationBar.ts | 13 +------------ 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 3bce13820d748..048beb21e09d4 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1961,23 +1961,22 @@ namespace FourSlash { public verifyNavigationBarCount(expected: number) { const items = this.languageService.getNavigationBarItems(this.activeFile.fileName); - const actual = this.getNavigationBarItemsCount(items); + const actual = this.getNavigationBarItemsCount(items[0]); if (expected !== actual) { this.raiseError(`verifyNavigationBarCount failed - found: ${actual} navigation items, expected: ${expected}.`); } } - private getNavigationBarItemsCount(items: ts.NavigationBarItem[]) { - let result = 0; - if (items) { - for (let i = 0, n = items.length; i < n; i++) { - result++; - result += this.getNavigationBarItemsCount(items[i].childItems); - } + private getNavigationBarItemsCount(root: ts.NavigationBarItem) { + ts.Debug.assert(root.kind === ts.ScriptElementKind.moduleElement); + function recur(item: ts.NavigationBarItem) { + let count = 1; + for (const child of item.childItems) + count += recur(child); + return count; } - - return result; + return recur(root); } public verifyNavigationBarContains(name: string, kind: string, fileName?: string, parentName?: string, isAdditionalSpan?: boolean, markerPosition?: number) { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index bcf0726ffd58d..f6f7b741a569e 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -9,16 +9,10 @@ namespace ts.NavigationBar { return getJsNavigationBarItems(sourceFile, compilerOptions); } - // If the source file has any child items, then it included in the tree - // and takes lexical ownership of all other top-level items. - let hasGlobalNode = false; - return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem); function getIndent(node: Node): number { - // If we have a global node in the tree, - // then it adds an extra layer of depth to all subnodes. - let indent = hasGlobalNode ? 1 : 0; + let indent = 1; // Global node is the only one with indent 0. let current = node.parent; while (current) { @@ -508,11 +502,6 @@ namespace ts.NavigationBar { function createSourceFileItem(node: SourceFile): ts.NavigationBarItem { const childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); - if (childItems === undefined || childItems.length === 0) { - return undefined; - } - - hasGlobalNode = true; const rootName = isExternalModule(node) ? "\"" + escapeString(getBaseFileName(removeFileExtension(normalizePath(node.fileName)))) + "\"" : ""; From fe970abc81e04cfc21b01db6138289fccbfbeef8 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 26 May 2016 07:30:31 -0700 Subject: [PATCH 2/5] Change tests to use the full JSON output of the navigation bar. This reduces the confusion of verify.navigationBarCount() counting duplicate items. --- src/harness/fourslash.ts | 119 ++++-------- .../fourslash/deleteClassWithEnumPresent.ts | 33 +++- tests/cases/fourslash/fourslash.ts | 4 +- .../cases/fourslash/getNavigationBarItems.ts | 32 +++- tests/cases/fourslash/navbar_const.ts | 24 ++- .../navbar_contains-no-duplicates.ts | 152 ++++++++++++--- tests/cases/fourslash/navbar_exportDefault.ts | 99 ++++++++-- tests/cases/fourslash/navbar_let.ts | 24 ++- .../navigationBarItemsBindingPatterns.ts | 66 +++++-- ...ionBarItemsBindingPatternsInConstructor.ts | 48 ++++- .../navigationBarItemsEmptyConstructors.ts | 29 ++- .../fourslash/navigationBarItemsExports.ts | 33 +++- .../fourslash/navigationBarItemsFunctions.ts | 60 ++++-- .../navigationBarItemsFunctionsBroken.ts | 25 ++- .../navigationBarItemsFunctionsBroken2.ts | 25 ++- .../fourslash/navigationBarItemsImports.ts | 60 ++++-- ...ionBarItemsInsideMethodsAndConstructors.ts | 159 +++++++++++++--- .../fourslash/navigationBarItemsItems.ts | 174 ++++++++++++++--- .../fourslash/navigationBarItemsItems2.ts | 29 ++- ...rItemsItemsContainsNoAnonymousFunctions.ts | 58 +++++- .../navigationBarItemsItemsExternalModules.ts | 36 +++- ...navigationBarItemsItemsExternalModules2.ts | 43 ++++- ...navigationBarItemsItemsExternalModules3.ts | 43 ++++- .../navigationBarItemsItemsModuleVariables.ts | 56 +++++- .../navigationBarItemsMissingName1.ts | 39 ++-- .../navigationBarItemsMissingName2.ts | 26 ++- .../fourslash/navigationBarItemsModules.ts | 138 +++++++++++--- ...ationBarItemsMultilineStringIdentifiers.ts | 98 ++++++++-- ...BarItemsPropertiesDefinedInConstructors.ts | 41 +++- .../fourslash/navigationBarItemsSymbols1.ts | 42 ++++- .../fourslash/navigationBarItemsSymbols2.ts | 37 +++- .../fourslash/navigationBarItemsSymbols3.ts | 25 ++- .../fourslash/navigationBarItemsTypeAlias.ts | 16 +- tests/cases/fourslash/server/navbar01.ts | 175 +++++++++++++++--- .../shims-pp/getNavigationBarItems.ts | 22 ++- .../fourslash/shims/getNavigationBarItems.ts | 22 ++- 36 files changed, 1660 insertions(+), 452 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 048beb21e09d4..c33c9107ad7dd 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1959,70 +1959,42 @@ namespace FourSlash { } } - public verifyNavigationBarCount(expected: number) { - const items = this.languageService.getNavigationBarItems(this.activeFile.fileName); - const actual = this.getNavigationBarItemsCount(items[0]); - - if (expected !== actual) { - this.raiseError(`verifyNavigationBarCount failed - found: ${actual} navigation items, expected: ${expected}.`); - } - } - - private getNavigationBarItemsCount(root: ts.NavigationBarItem) { - ts.Debug.assert(root.kind === ts.ScriptElementKind.moduleElement); - function recur(item: ts.NavigationBarItem) { - let count = 1; - for (const child of item.childItems) - count += recur(child); - return count; - } - return recur(root); - } - - public verifyNavigationBarContains(name: string, kind: string, fileName?: string, parentName?: string, isAdditionalSpan?: boolean, markerPosition?: number) { - fileName = fileName || this.activeFile.fileName; - const items = this.languageService.getNavigationBarItems(fileName); - - if (!items || items.length === 0) { - this.raiseError("verifyNavigationBarContains failed - found 0 navigation items, expected at least one."); - } - - if (this.navigationBarItemsContains(items, name, kind, parentName)) { - return; - } - - const missingItem = { name, kind, parentName }; - this.raiseError(`verifyNavigationBarContains failed - could not find the item: ${JSON.stringify(missingItem, undefined, 2)} in the returned list: (${JSON.stringify(items, undefined, 2)})`); - } - - private navigationBarItemsContains(items: ts.NavigationBarItem[], name: string, kind: string, parentName?: string) { - function recur(items: ts.NavigationBarItem[], curParentName: string) { - for (let i = 0; i < items.length; i++) { - const item = items[i]; - if (item && item.text === name && item.kind === kind && (!parentName || curParentName === parentName)) { - return true; - } - if (recur(item.childItems, item.text)) { - return true; - } - } - return false; - } - return recur(items, ""); - } - - public verifyNavigationBarChildItem(parent: string, name: string, kind: string) { - const items = this.languageService.getNavigationBarItems(this.activeFile.fileName); - - for (let i = 0; i < items.length; i++) { - const item = items[i]; - if (item.text === parent) { - if (this.navigationBarItemsContains(item.childItems, name, kind)) - return; - const missingItem = { name, kind }; - this.raiseError(`verifyNavigationBarChildItem failed - could not find the item: ${JSON.stringify(missingItem)} in the children list: (${JSON.stringify(item.childItems, undefined, 2)})`); - } - } + public verifyNavigationBar(json: any) { + let items = this.languageService.getNavigationBarItems(this.activeFile.fileName); + items = this.simplifyNavigationBar(items); + if (JSON.stringify(items) !== JSON.stringify(json)) { + this.raiseError(`verifyNavigationBar failed - expected: ${JSON.stringify(json, undefined, 2)}, got: ${JSON.stringify(items, undefined, 2)}`) + } + } + + // Remove any properties that tend to all have the same value so that test data is easier to read. + private simplifyNavigationBar(items: ts.NavigationBarItem[]): any { + return items.map(item => { + item = ts.clone(item); + if (item.kindModifiers === "") + delete item.kindModifiers; + delete item.spans; + item.childItems = item.childItems.map(child => { + child = ts.clone(child); + ts.Debug.assert(child.childItems.length === 0); + ts.Debug.assert(child.indent === 0); + ts.Debug.assert(child.bolded === false); + ts.Debug.assert(child.grayed === false); + delete child.childItems; + delete child.indent; + delete child.bolded; + delete child.grayed; + delete child.spans; + if (child.kindModifiers === "") + delete child.kindModifiers; + return child; + }); + if (item.bolded === false) + delete item.bolded; + if (item.grayed === false) + delete item.grayed; + return item; + }) } public printNavigationItems(searchValue: string) { @@ -3041,23 +3013,8 @@ namespace FourSlashInterface { this.DocCommentTemplate(/*expectedText*/ undefined, /*expectedOffset*/ undefined, /*empty*/ true); } - public navigationBarCount(count: number) { - this.state.verifyNavigationBarCount(count); - } - - // TODO: figure out what to do with the unused arguments. - public navigationBarContains( - name: string, - kind: string, - fileName?: string, - parentName?: string, - isAdditionalSpan?: boolean, - markerPosition?: number) { - this.state.verifyNavigationBarContains(name, kind, fileName, parentName, isAdditionalSpan, markerPosition); - } - - public navigationBarChildItem(parent: string, name: string, kind: string) { - this.state.verifyNavigationBarChildItem(parent, name, kind); + public navigationBar(json: any) { + this.state.verifyNavigationBar(json); } public navigationItemsListCount(count: number, searchValue: string, matchKind?: string) { diff --git a/tests/cases/fourslash/deleteClassWithEnumPresent.ts b/tests/cases/fourslash/deleteClassWithEnumPresent.ts index 29f7c61e25991..d8d4478afe764 100644 --- a/tests/cases/fourslash/deleteClassWithEnumPresent.ts +++ b/tests/cases/fourslash/deleteClassWithEnumPresent.ts @@ -5,4 +5,35 @@ goTo.marker(); edit.deleteAtCaret('class Bar { }'.length); -verify.navigationBarContains('Foo', 'enum', 'tests/cases/fourslash/deleteClassWithEnumPresent.ts', ''); \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "Foo", + "kind": "enum" + } + ], + "indent": 0 + }, + { + "text": "Foo", + "kind": "enum", + "childItems": [ + { + "text": "a", + "kind": "property" + }, + { + "text": "b", + "kind": "property" + }, + { + "text": "c", + "kind": "property" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 08883f163f2c9..8a0d2d36364c2 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -175,9 +175,7 @@ declare namespace FourSlashInterface { DocCommentTemplate(expectedText: string, expectedOffset: number, empty?: boolean): void; noDocCommentTemplate(): void; - navigationBarCount(count: number): void; - navigationBarContains(name: string, kind: string, fileName?: string, parentName?: string, isAdditionalSpan?: boolean, markerPosition?: number): void; - navigationBarChildItem(parent: string, text: string, kind: string): void; + navigationBar(json: any): void; navigationItemsListCount(count: number, searchValue: string, matchKind?: string): void; navigationItemsListContains(name: string, kind: string, searchValue: string, matchKind: string, fileName?: string, parentName?: string): void; occurrencesAtPositionContains(range: Range, isWriteAccess?: boolean): void; diff --git a/tests/cases/fourslash/getNavigationBarItems.ts b/tests/cases/fourslash/getNavigationBarItems.ts index cd09f61011e97..a2b0492514a0d 100644 --- a/tests/cases/fourslash/getNavigationBarItems.ts +++ b/tests/cases/fourslash/getNavigationBarItems.ts @@ -5,7 +5,31 @@ //// ["bar"]: string; ////} -verify.navigationBarCount(5); -verify.navigationBarContains("C", "class"); -verify.navigationBarChildItem("C", "[\"bar\"]", "property"); -verify.navigationBarChildItem("C", "foo", "property"); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "C", + "kind": "class" + } + ], + "indent": 0 + }, + { + "text": "C", + "kind": "class", + "childItems": [ + { + "text": "[\"bar\"]", + "kind": "property" + }, + { + "text": "foo", + "kind": "property" + } + ], + "indent": 1 + } +]) diff --git a/tests/cases/fourslash/navbar_const.ts b/tests/cases/fourslash/navbar_const.ts index 5d8b42607c8c9..02a10f46a74e8 100644 --- a/tests/cases/fourslash/navbar_const.ts +++ b/tests/cases/fourslash/navbar_const.ts @@ -1,13 +1,17 @@ /// -//// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0; +//// const c = 0; -test.markers().forEach(marker => { - verify.navigationBarContains( - marker.data.itemName, - marker.data.kind, - marker.fileName, - marker.data.parentName, - marker.data.isAdditionalRange, - marker.position); -}); \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "c", + "kind": "const" + } + ], + "indent": 0 + } +]); diff --git a/tests/cases/fourslash/navbar_contains-no-duplicates.ts b/tests/cases/fourslash/navbar_contains-no-duplicates.ts index 42b33a722ada5..333130ff79591 100644 --- a/tests/cases/fourslash/navbar_contains-no-duplicates.ts +++ b/tests/cases/fourslash/navbar_contains-no-duplicates.ts @@ -1,42 +1,142 @@ /// -//// {| "itemName": "Windows", "kind": "module", "parentName": "" |}declare module Windows { -//// {| "itemName": "Foundation", "kind": "module", "parentName": "Windows" |}export module Foundation { -//// export var {| "itemName": "A", "kind": "var" |}A; -//// {| "itemName": "Test", "kind": "class", "parentName": "Foundation" |}export class Test { -//// {| "itemName": "wow", "kind": "method" |}public wow(); +//// declare module Windows { +//// export module Foundation { +//// export var A; +//// export class Test { +//// public wow(); //// } //// } //// } //// -//// {| "itemName": "Windows", "kind": "module", "parentName": "", "isAdditionalRange": true |}declare module Windows { -//// {| "itemName": "Foundation", "kind": "module", "parentName": "Windows", "isAdditionalRange": true |}export module Foundation { -//// export var {| "itemName": "B", "kind": "var" |}B; -//// {| "itemName": "Test", "kind": "module" |}export module Test { -//// {| "itemName": "Boom", "kind": "function" |}export function Boom(): number; +//// declare module Windows { +//// export module Foundation { +//// export var B; +//// export module Test { +//// export function Boom(): number; //// } //// } //// } //// -//// {| "itemName": "ABC", "kind": "class", "parentName": "" |}class ABC { -//// {| "itemName": "foo", "kind": "method" |}public foo() { +//// class ABC { +//// public foo() { //// return 3; //// } //// } //// -//// {| "itemName": "ABC", "kind": "module", "parentName": "" |}module ABC { -//// export var {| "itemName": "x", "kind": "var" |}x = 3; +//// module ABC { +//// export var x = 3; //// } -test.markers().forEach(marker => { - if (marker.data) { - verify.navigationBarContains( - marker.data.itemName, - marker.data.kind, - marker.fileName, - marker.data.parentName, - marker.data.isAdditionalRange, - marker.position); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "ABC", + "kind": "class" + }, + { + "text": "ABC", + "kind": "module" + }, + { + "text": "Windows", + "kind": "module", + "kindModifiers": "declare" + } + ], + "indent": 0 + }, + { + "text": "ABC", + "kind": "class", + "childItems": [ + { + "text": "foo", + "kind": "method", + "kindModifiers": "public" + } + ], + "indent": 1 + }, + { + "text": "ABC", + "kind": "module", + "childItems": [ + { + "text": "x", + "kind": "var", + "kindModifiers": "export" + } + ], + "indent": 1 + }, + { + "text": "Windows", + "kind": "module", + "kindModifiers": "declare", + "childItems": [ + { + "text": "Foundation", + "kind": "module", + "kindModifiers": "export,declare" + } + ], + "indent": 1 + }, + { + "text": "Foundation", + "kind": "module", + "kindModifiers": "export,declare", + "childItems": [ + { + "text": "A", + "kind": "var", + "kindModifiers": "export,declare" + }, + { + "text": "Test", + "kind": "class", + "kindModifiers": "export,declare" + }, + { + "text": "B", + "kind": "var", + "kindModifiers": "export,declare" + }, + { + "text": "Test", + "kind": "module", + "kindModifiers": "export,declare" + } + ], + "indent": 2 + }, + { + "text": "Test", + "kind": "class", + "kindModifiers": "export,declare", + "childItems": [ + { + "text": "wow", + "kind": "method", + "kindModifiers": "public,declare" + } + ], + "indent": 3 + }, + { + "text": "Test", + "kind": "module", + "kindModifiers": "export,declare", + "childItems": [ + { + "text": "Boom", + "kind": "function", + "kindModifiers": "export,declare" + } + ], + "indent": 3 } -}); - -verify.navigationBarCount(19); +]); diff --git a/tests/cases/fourslash/navbar_exportDefault.ts b/tests/cases/fourslash/navbar_exportDefault.ts index a56eeb8b2260a..7c666589f127e 100644 --- a/tests/cases/fourslash/navbar_exportDefault.ts +++ b/tests/cases/fourslash/navbar_exportDefault.ts @@ -1,24 +1,93 @@ /// // @Filename: a.ts -//// {| "itemName": "default", "kind": "class", "parentName": "" |}export default class { } +////export default class { } // @Filename: b.ts -//// {| "itemName": "C", "kind": "class", "parentName": "" |}export default class C { } +////export default class C { } // @Filename: c.ts -//// {| "itemName": "default", "kind": "function", "parentName": "" |}export default function { } +////export default function { } // @Filename: d.ts -//// {| "itemName": "Func", "kind": "function", "parentName": "" |}export default function Func { } - -test.markers().forEach(marker => { - goTo.file(marker.fileName); - verify.navigationBarContains( - marker.data.itemName, - marker.data.kind, - marker.fileName, - marker.data.parentName, - marker.data.isAdditionalRange, - marker.position); -}); \ No newline at end of file +////export default function Func { } + +goTo.file("a.ts"); +verify.navigationBar([ + { + "text": "\"a\"", + "kind": "module", + "childItems": [], + "indent": 0 + }, + { + "text": "default", + "kind": "class", + "kindModifiers": "export", + "childItems": [], + "indent": 1 + } +]); + +goTo.file("b.ts"); +verify.navigationBar([ + { + "text": "\"b\"", + "kind": "module", + "childItems": [ + { + "text": "C", + "kind": "class", + "kindModifiers": "export" + } + ], + "indent": 0 + }, + { + "text": "C", + "kind": "class", + "kindModifiers": "export", + "childItems": [], + "indent": 1 + } +]); + +goTo.file("c.ts"); +verify.navigationBar([ + { + "text": "\"c\"", + "kind": "module", + "childItems": [], + "indent": 0 + }, + { + "text": "default", + "kind": "function", + "kindModifiers": "export", + "childItems": [], + "indent": 1 + } +]); + +goTo.file("d.ts"); +verify.navigationBar([ + { + "text": "\"d\"", + "kind": "module", + "childItems": [ + { + "text": "Func", + "kind": "function", + "kindModifiers": "export" + } + ], + "indent": 0 + }, + { + "text": "Func", + "kind": "function", + "kindModifiers": "export", + "childItems": [], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navbar_let.ts b/tests/cases/fourslash/navbar_let.ts index c3b125526efdd..dc9d9c078577e 100644 --- a/tests/cases/fourslash/navbar_let.ts +++ b/tests/cases/fourslash/navbar_let.ts @@ -1,13 +1,17 @@ /// -//// {| "itemName": "c", "kind": "let", "parentName": "" |}let c = 0; +////let c = 0; -test.markers().forEach(marker => { - verify.navigationBarContains( - marker.data.itemName, - marker.data.kind, - marker.fileName, - marker.data.parentName, - marker.data.isAdditionalRange, - marker.position); -}); \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "c", + "kind": "let" + } + ], + "indent": 0 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts b/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts index afac15daacc8a..007a9c9b804a8 100644 --- a/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts +++ b/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts @@ -6,16 +6,56 @@ ////const bar1, [c, d] ////var {e, x: [f, g]} = {a:1, x:[]}; -verify.navigationBarCount(12); // global (1) + variable declarations (4) + binding patterns (7) -verify.navigationBarContains("foo", "var"); -verify.navigationBarContains("bar", "var"); -verify.navigationBarContains("foo1", "let") -verify.navigationBarContains("a", "let"); -verify.navigationBarContains("b", "let"); -verify.navigationBarContains("bar1", "const"); -verify.navigationBarContains("c", "const"); -verify.navigationBarContains("d", "const"); -verify.navigationBarContains("e", "var"); -verify.navigationBarContains("f", "var"); -verify.navigationBarContains("g", "var"); - +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "a", + "kind": "let" + }, + { + "text": "b", + "kind": "let" + }, + { + "text": "bar", + "kind": "var" + }, + { + "text": "bar1", + "kind": "const" + }, + { + "text": "c", + "kind": "const" + }, + { + "text": "d", + "kind": "const" + }, + { + "text": "e", + "kind": "var" + }, + { + "text": "f", + "kind": "var" + }, + { + "text": "foo", + "kind": "var" + }, + { + "text": "foo1", + "kind": "let" + }, + { + "text": "g", + "kind": "var" + } + ], + "indent": 0 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts b/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts index 24979e141e541..41751f5c74b0f 100644 --- a/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts +++ b/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts @@ -11,4 +11,50 @@ //// } ////} -verify.navigationBarCount(9); // global + 2 children + 2x(class + field + constructor) +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "A", + "kind": "class" + }, + { + "text": "B", + "kind": "class" + } + ], + "indent": 0 + }, + { + "text": "A", + "kind": "class", + "childItems": [ + { + "text": "constructor", + "kind": "constructor" + }, + { + "text": "x", + "kind": "property" + } + ], + "indent": 1 + }, + { + "text": "B", + "kind": "class", + "childItems": [ + { + "text": "constructor", + "kind": "constructor" + }, + { + "text": "x", + "kind": "property" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts b/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts index a80f4c596d49e..27c33f6afb266 100644 --- a/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts +++ b/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts @@ -5,8 +5,27 @@ //// } ////} -verify.navigationBarContains("Test", "class"); -verify.navigationBarContains("constructor", "constructor"); - -// no other items -verify.navigationBarCount(4); // global + 1 child, Test + 1 child \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "Test", + "kind": "class" + } + ], + "indent": 0 + }, + { + "text": "Test", + "kind": "class", + "childItems": [ + { + "text": "constructor", + "kind": "constructor" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsExports.ts b/tests/cases/fourslash/navigationBarItemsExports.ts index b88b60d0efbde..79422f962746b 100644 --- a/tests/cases/fourslash/navigationBarItemsExports.ts +++ b/tests/cases/fourslash/navigationBarItemsExports.ts @@ -1,18 +1,33 @@ /// -////export { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +////export { a } from "a"; //// -////export { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a" +////export { b as B } from "a" //// -////{| "itemName": "e", "kind": "alias", "parentName": "" |} export import e = require("a"); +////export import e = require("a"); //// ////export * from "a"; // no bindings here -test.markers().forEach((marker) => { - if (marker.data) { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +verify.navigationBar([ + { + "text": "\"navigationBarItemsExports\"", + "kind": "module", + "childItems": [ + { + "text": "a", + "kind": "alias" + }, + { + "text": "B", + "kind": "alias" + }, + { + "text": "e", + "kind": "alias", + "kindModifiers": "export" + } + ], + "indent": 0 } -}); - -verify.navigationBarCount(4); +]); diff --git a/tests/cases/fourslash/navigationBarItemsFunctions.ts b/tests/cases/fourslash/navigationBarItemsFunctions.ts index 0948923c0461f..e2260f2ff2bc5 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctions.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctions.ts @@ -1,23 +1,61 @@ /// -////{| "itemName": "", "kind": "module" |} -//// -////{| "itemName": "foo", "kind": "function" |}function foo() { +////function foo() { //// var x = 10; -//// {| "itemName": "bar", "kind": "function", "parentName": "foo" |}function bar() { +//// function bar() { //// var y = 10; -//// {| "itemName": "biz", "kind": "function", "parentName": "bar" |}function biz() { +//// function biz() { //// var z = 10; //// } //// } ////} //// -////{| "itemName": "baz", "kind": "function", "parentName": "" |}function baz() { +////function baz() { //// var v = 10; ////} -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -verify.navigationBarCount(8); // 4 functions + global. Note: there are 8 because of the functions show up at the top level and as child items. +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "baz", + "kind": "function" + }, + { + "text": "foo", + "kind": "function" + } + ], + "indent": 0 + }, + { + "text": "baz", + "kind": "function", + "childItems": [], + "indent": 1 + }, + { + "text": "foo", + "kind": "function", + "childItems": [ + { + "text": "bar", + "kind": "function" + } + ], + "indent": 1 + }, + { + "text": "bar", + "kind": "function", + "childItems": [ + { + "text": "biz", + "kind": "function" + } + ], + "indent": 2 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts b/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts index e8bf1d33fc3dc..dc84b50ff306f 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts @@ -1,12 +1,25 @@ /// -////{| "itemName": "f", "kind": "function" |} ////function f() { //// function; ////} -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -verify.navigationBarCount(3); // and 'f'. \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "f", + "kind": "function" + } + ], + "indent": 0 + }, + { + "text": "f", + "kind": "function", + "childItems": [], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts b/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts index 9576d4dd78964..b4612efcac0e5 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts @@ -1,13 +1,26 @@ /// ////function; -////{| "itemName": "f", "kind": "function" |} ////function f() { //// function; ////} -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -verify.navigationBarCount(3); // and 'f' \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "f", + "kind": "function" + } + ], + "indent": 0 + }, + { + "text": "f", + "kind": "function", + "childItems": [], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsImports.ts b/tests/cases/fourslash/navigationBarItemsImports.ts index 53619da310a6e..d6526a7a68c0f 100644 --- a/tests/cases/fourslash/navigationBarItemsImports.ts +++ b/tests/cases/fourslash/navigationBarItemsImports.ts @@ -1,25 +1,57 @@ /// -////import {| "itemName": "d1", "kind": "alias", "parentName": "" |}d1 from "a"; +////import d1 from "a"; //// -////import { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +////import { a } from "a"; //// -////import { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a" +////import { b as B } from "a" //// -////import {| "itemName": "d2", "kind": "alias", "parentName": "" |}d2, -//// { {| "itemName": "c", "kind": "alias", "parentName": "" |}c, -//// {| "itemName": "D", "kind": "alias", "parentName": "" |} d as D } from "a" +////import d2, { c, d as D } from "a" //// -////{| "itemName": "e", "kind": "alias", "parentName": "" |}import e = require("a"); +////import e = require("a"); //// -////import {| "itemName": "ns", "kind": "alias", "parentName": "" |}* as ns from "a"; +////import * as ns from "a"; -test.markers().forEach((marker) => { - if (marker.data) { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +verify.navigationBar([ + { + "text": "\"navigationBarItemsImports\"", + "kind": "module", + "childItems": [ + { + "text": "a", + "kind": "alias" + }, + { + "text": "B", + "kind": "alias" + }, + { + "text": "c", + "kind": "alias" + }, + { + "text": "D", + "kind": "alias" + }, + { + "text": "d1", + "kind": "alias" + }, + { + "text": "d2", + "kind": "alias" + }, + { + "text": "e", + "kind": "alias" + }, + { + "text": "ns", + "kind": "alias" + } + ], + "indent": 0 } -}); - -verify.navigationBarCount(9); +]); diff --git a/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts b/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts index 8d93d241ae195..7d2fb4ed1277c 100644 --- a/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts +++ b/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts @@ -2,41 +2,140 @@ ////class Class { //// constructor() { -//// {| "itemName": "LocalFunctionInConstructor", "kind": "function", "parentName": "constructor"|}function LocalFunctionInConstructor() { -//// -//// } -//// -//// {| "itemName": "LocalInterfaceInConstrcutor", "kind": "interface", "parentName": "constructor"|}interface LocalInterfaceInConstrcutor { -//// } -//// -//// {| "itemName": "LocalEnumInConstructor", "kind": "enum", "parentName": "constructor"|}enum LocalEnumInConstructor { -//// {| "itemName": "LocalEnumMemberInConstructor", "kind": "property", "parentName": "LocalEnumInConstructor"|}LocalEnumMemberInConstructor, -//// } +//// function LocalFunctionInConstructor() {} +//// interface LocalInterfaceInConstrcutor {} +//// enum LocalEnumInConstructor { LocalEnumMemberInConstructor } //// } //// //// method() { -//// {| "itemName": "LocalFunctionInMethod", "kind": "function", "parentName": "method"|}function LocalFunctionInMethod() { -//// {| "itemName": "LocalFunctionInLocalFunctionInMethod", "kind": "function", "parentName": "LocalFunctionInMethod"|}function LocalFunctionInLocalFunctionInMethod() { -//// -//// } -//// } -//// -//// {| "itemName": "LocalInterfaceInMethod", "kind": "interface", "parentName": "method"|}interface LocalInterfaceInMethod { -//// } -//// -//// {| "itemName": "LocalEnumInMethod", "kind": "enum", "parentName": "method"|}enum LocalEnumInMethod { -//// {| "itemName": "LocalEnumMemberInMethod", "kind": "property", "parentName": "LocalEnumInMethod"|}LocalEnumMemberInMethod, +//// function LocalFunctionInMethod() { +//// function LocalFunctionInLocalFunctionInMethod() {} //// } +//// interface LocalInterfaceInMethod {} +//// enum LocalEnumInMethod { LocalEnumMemberInMethod } //// } //// -//// emptyMethod() { // Non child functions method should not be duplicated -//// -//// } +//// emptyMethod() { } // Non child functions method should not be duplicated ////} -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -// no other items -verify.navigationBarCount(23); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "Class", + "kind": "class" + } + ], + "indent": 0 + }, + { + "text": "Class", + "kind": "class", + "childItems": [ + { + "text": "constructor", + "kind": "constructor" + }, + { + "text": "emptyMethod", + "kind": "method" + }, + { + "text": "method", + "kind": "method" + } + ], + "indent": 1 + }, + { + "text": "constructor", + "kind": "constructor", + "childItems": [ + { + "text": "LocalEnumInConstructor", + "kind": "enum" + }, + { + "text": "LocalFunctionInConstructor", + "kind": "function" + }, + { + "text": "LocalInterfaceInConstrcutor", + "kind": "interface" + } + ], + "indent": 2 + }, + { + "text": "LocalEnumInConstructor", + "kind": "enum", + "childItems": [ + { + "text": "LocalEnumMemberInConstructor", + "kind": "property" + } + ], + "indent": 2 + }, + { + "text": "LocalFunctionInConstructor", + "kind": "function", + "childItems": [], + "indent": 2 + }, + { + "text": "LocalInterfaceInConstrcutor", + "kind": "interface", + "childItems": [], + "indent": 2 + }, + { + "text": "method", + "kind": "method", + "childItems": [ + { + "text": "LocalEnumInMethod", + "kind": "enum" + }, + { + "text": "LocalFunctionInMethod", + "kind": "function" + }, + { + "text": "LocalInterfaceInMethod", + "kind": "interface" + } + ], + "indent": 2 + }, + { + "text": "LocalEnumInMethod", + "kind": "enum", + "childItems": [ + { + "text": "LocalEnumMemberInMethod", + "kind": "property" + } + ], + "indent": 2 + }, + { + "text": "LocalFunctionInMethod", + "kind": "function", + "childItems": [ + { + "text": "LocalFunctionInLocalFunctionInMethod", + "kind": "function" + } + ], + "indent": 2 + }, + { + "text": "LocalInterfaceInMethod", + "kind": "interface", + "childItems": [], + "indent": 2 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsItems.ts b/tests/cases/fourslash/navigationBarItemsItems.ts index e8e9fd40824cb..013d28cd402d7 100644 --- a/tests/cases/fourslash/navigationBarItemsItems.ts +++ b/tests/cases/fourslash/navigationBarItemsItems.ts @@ -1,52 +1,172 @@ /// ////// Interface -////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint { -//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number; -//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint; -//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any; -//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number; -//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string; +////interface IPoint { +//// getDist(): number; +//// new(): IPoint; +//// (): any; +//// [x:string]: number; +//// prop: string; ////} //// /////// Module -////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +////module Shapes { //// //// // Class -//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint { -//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Point" |}constructor (public x: number, public y: number) { } +//// export class Point implements IPoint { +//// constructor (public x: number, public y: number) { } //// //// // Instance member -//// {| "itemName": "getDist", "kind": "method", "parentName": "Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } +//// getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } //// //// // Getter -//// {| "itemName": "value", "kind": "getter", "parentName": "Point" |}get value(): number { return 0; } +//// get value(): number { return 0; } //// //// // Setter -//// {| "itemName": "value", "kind": "setter", "parentName": "Point" |}set value(newValue: number) { return; } +//// set value(newValue: number) { return; } //// //// // Static member -//// {| "itemName": "origin", "kind": "property", "parentName": "Point" |}static origin = new Point(0, 0); +//// static origin = new Point(0, 0); //// //// // Static method -//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Point" |}private static getOrigin() { return Point.origin;} +//// private static getOrigin() { return Point.origin; } //// } //// -//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values { -//// value1, -//// {| "itemName": "value2", "kind": "property", "parentName": "Values" |}value2, -//// value3, -//// } +//// enum Values { value1, value2, value3 } ////} //// ////// Local variables -////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4); -////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist(); +////var p: IPoint = new Shapes.Point(3, 4); +////var dist = p.getDist(); -test.markers().forEach((marker) => { - if (marker.data) { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "dist", + "kind": "var" + }, + { + "text": "IPoint", + "kind": "interface" + }, + { + "text": "p", + "kind": "var" + }, + { + "text": "Shapes", + "kind": "module" + } + ], + "indent": 0 + }, + { + "text": "IPoint", + "kind": "interface", + "childItems": [ + { + "text": "()", + "kind": "call" + }, + { + "text": "new()", + "kind": "construct" + }, + { + "text": "[]", + "kind": "index" + }, + { + "text": "getDist", + "kind": "method" + }, + { + "text": "prop", + "kind": "property" + } + ], + "indent": 1 + }, + { + "text": "Shapes", + "kind": "module", + "childItems": [ + { + "text": "Point", + "kind": "class", + "kindModifiers": "export" + }, + { + "text": "Values", + "kind": "enum" + } + ], + "indent": 1 + }, + { + "text": "Point", + "kind": "class", + "kindModifiers": "export", + "childItems": [ + { + "text": "constructor", + "kind": "constructor" + }, + { + "text": "getDist", + "kind": "method" + }, + { + "text": "getOrigin", + "kind": "method", + "kindModifiers": "private,static" + }, + { + "text": "origin", + "kind": "property", + "kindModifiers": "static" + }, + { + "text": "value", + "kind": "getter" + }, + { + "text": "value", + "kind": "setter" + }, + { + "text": "x", + "kind": "property", + "kindModifiers": "public" + }, + { + "text": "y", + "kind": "property", + "kindModifiers": "public" + } + ], + "indent": 2 + }, + { + "text": "Values", + "kind": "enum", + "childItems": [ + { + "text": "value1", + "kind": "property" + }, + { + "text": "value2", + "kind": "property" + }, + { + "text": "value3", + "kind": "property" + } + ], + "indent": 2 } -}); - -verify.navigationBarCount(27); +]); diff --git a/tests/cases/fourslash/navigationBarItemsItems2.ts b/tests/cases/fourslash/navigationBarItemsItems2.ts index 013f27b4d716b..27c32531d6ba2 100644 --- a/tests/cases/fourslash/navigationBarItemsItems2.ts +++ b/tests/cases/fourslash/navigationBarItemsItems2.ts @@ -1,6 +1,5 @@ /// - /////**/ goTo.marker(); @@ -8,5 +7,29 @@ edit.insertLine("module A"); edit.insert("export class "); // should not crash -verify.navigationBarCount(4); - +verify.navigationBar([ + { + "text": "\"navigationBarItemsItems2\"", + "kind": "module", + "childItems": [ + { + "text": "A", + "kind": "module" + } + ], + "indent": 0 + }, + { + "text": "default", + "kind": "class", + "kindModifiers": "export", + "childItems": [], + "indent": 1 + }, + { + "text": "A", + "kind": "module", + "childItems": [], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts b/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts index dac6e96ab931d..34e4a1c0c89f3 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts @@ -30,15 +30,57 @@ ////} goTo.marker("file1"); -verify.navigationBarCount(0); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [], + "indent": 0 + } +]); goTo.marker("file2"); -verify.navigationBarContains("", "module"); -verify.navigationBarContains("x", "var"); -verify.navigationBarCount(2); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "x", + "kind": "var" + } + ], + "indent": 0 + } +]); goTo.marker("file3"); -verify.navigationBarContains("", "module"); -verify.navigationBarContains("foo", "function"); -verify.navigationBarContains("bar", "function"); -verify.navigationBarCount(5); \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "bar", + "kind": "function" + }, + { + "text": "foo", + "kind": "function" + } + ], + "indent": 0 + }, + { + "text": "bar", + "kind": "function", + "childItems": [], + "indent": 1 + }, + { + "text": "foo", + "kind": "function", + "childItems": [], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts b/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts index 7b2e0def4bf2b..f2df772fb19b4 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts @@ -1,11 +1,33 @@ /// -////{| "itemName": "Bar", "kind": "class", "parentName": "\"navigationBarItemsItemsExternalModules\"" |}export class Bar { -//// {| "itemName": "s", "kind": "property", "parentName": "Bar" |}public s: string; +////export class Bar { +//// public s: string; ////} -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -verify.navigationBarCount(4); // external module node + class + property +verify.navigationBar([ + { + "text": "\"navigationBarItemsItemsExternalModules\"", + "kind": "module", + "childItems": [ + { + "text": "Bar", + "kind": "class", + "kindModifiers": "export" + } + ], + "indent": 0 + }, + { + "text": "Bar", + "kind": "class", + "kindModifiers": "export", + "childItems": [ + { + "text": "s", + "kind": "property", + "kindModifiers": "public" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts b/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts index 9087493b298b4..54d4759afe62e 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts @@ -1,15 +1,40 @@ /// // @Filename: test/file.ts -////{| "itemName": "Bar", "kind": "class", "parentName": "\"file\"" |}export class Bar { -//// {| "itemName": "s", "kind": "property", "parentName": "Bar" |}public s: string; +////export class Bar { +//// public s: string; ////} -////{| "itemName": "\"file\"", "kind": "module" |} -////{| "itemName": "x", "kind": "var", "parentName": "\"file\"" |} ////export var x: number; -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -verify.navigationBarCount(5); // external module node + variable in module + class + property +verify.navigationBar([ + { + "text": "\"file\"", + "kind": "module", + "childItems": [ + { + "text": "Bar", + "kind": "class", + "kindModifiers": "export" + }, + { + "text": "x", + "kind": "var", + "kindModifiers": "export" + } + ], + "indent": 0 + }, + { + "text": "Bar", + "kind": "class", + "kindModifiers": "export", + "childItems": [ + { + "text": "s", + "kind": "property", + "kindModifiers": "public" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts b/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts index a00b3a131dd10..2db04c980d294 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts @@ -1,15 +1,40 @@ /// // @Filename: test/my fil"e.ts -////{| "itemName": "Bar", "kind": "class", "parentName": "\"my fil\\\"e\"" |}export class Bar { -//// {| "itemName": "s", "kind": "property", "parentName": "Bar" |}public s: string; +////export class Bar { +//// public s: string; ////} -////{| "itemName": "\"my fil\\\"e\"", "kind": "module" |} -////{| "itemName": "x", "kind": "var", "parentName": "\"my fil\\\"e\"" |} ////export var x: number; -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -verify.navigationBarCount(5); // external module node + 2 children + class + property +verify.navigationBar([ + { + "text": "\"my fil\\\"e\"", + "kind": "module", + "childItems": [ + { + "text": "Bar", + "kind": "class", + "kindModifiers": "export" + }, + { + "text": "x", + "kind": "var", + "kindModifiers": "export" + } + ], + "indent": 0 + }, + { + "text": "Bar", + "kind": "class", + "kindModifiers": "export", + "childItems": [ + { + "text": "s", + "kind": "property", + "kindModifiers": "public" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts b/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts index 5429011888c03..ef4022ce046bb 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts @@ -19,12 +19,56 @@ //// export var z = 0; ////} goTo.marker("file1"); -verify.navigationBarContains("Module1", "module"); -verify.navigationBarContains("x", "var"); // nothing else should show up -verify.navigationBarCount(4); // , its child, Module1, its child +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "Module1", + "kind": "module" + } + ], + "indent": 0 + }, + { + "text": "Module1", + "kind": "module", + "childItems": [ + { + "text": "x", + "kind": "var", + "kindModifiers": "export" + } + ], + "indent": 1 + } +]); goTo.marker("file2"); -verify.navigationBarContains("Module1.SubModule", "module"); -verify.navigationBarContains("y", "var"); -verify.navigationBarCount(4); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "Module1.SubModule", + "kind": "module" + } + ], + "indent": 0 + }, + { + "text": "Module1.SubModule", + "kind": "module", + "childItems": [ + { + "text": "y", + "kind": "var", + "kindModifiers": "export" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsMissingName1.ts b/tests/cases/fourslash/navigationBarItemsMissingName1.ts index 59f2911f3aaa7..4738cc45063ba 100644 --- a/tests/cases/fourslash/navigationBarItemsMissingName1.ts +++ b/tests/cases/fourslash/navigationBarItemsMissingName1.ts @@ -1,16 +1,29 @@ ////export function -/////** -//// * This is a class. -//// */ -////{| "itemName": "C", "kind": "class", "parentName": "\"navigationBarItemsMissingName1\"" |} class C { -//// {| "itemName": "foo", "kind": "method" |} foo() { -//// } +////class C { +//// foo() {} ////} - -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -/// Root + 1 child, class + 1 child -verify.navigationBarCount(4); +verify.navigationBar([ + { + "text": "\"navigationBarItemsMissingName1\"", + "kind": "module", + "childItems": [ + { + "text": "C", + "kind": "class" + } + ], + "indent": 0 + }, + { + "text": "C", + "kind": "class", + "childItems": [ + { + "text": "foo", + "kind": "method" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsMissingName2.ts b/tests/cases/fourslash/navigationBarItemsMissingName2.ts index d26aa0b553d08..f4a37cf11543e 100644 --- a/tests/cases/fourslash/navigationBarItemsMissingName2.ts +++ b/tests/cases/fourslash/navigationBarItemsMissingName2.ts @@ -2,10 +2,26 @@ //// * This is a class. //// */ ////class /* But it has no name! */ { -//// foo() { -//// } +//// foo() {} ////} - -// The class is unnamed, so its method is not included either. -verify.navigationBarCount(2); +// Anonymous classes are still included. +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [], + "indent": 0 + }, + { + "text": "default", + "kind": "class", + "childItems": [ + { + "text": "foo", + "kind": "method" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsModules.ts b/tests/cases/fourslash/navigationBarItemsModules.ts index 237ec8eb275ef..c3b8aef08ebf5 100644 --- a/tests/cases/fourslash/navigationBarItemsModules.ts +++ b/tests/cases/fourslash/navigationBarItemsModules.ts @@ -1,49 +1,137 @@ /// -////{| "itemName": "\"X.Y.Z\"", "kind": "module", "parentName": "" |} -////declare module "X.Y.Z" { -////} +////declare module "X.Y.Z" {} //// -////{| "itemName": "'X2.Y2.Z2'", "kind": "module", "parentName": "" |} -////declare module 'X2.Y2.Z2' { -////} +////declare module 'X2.Y2.Z2' {} //// -////{| "itemName": "A.B.C", "kind": "module", "parentName": "" |} ////module A.B.C { -//// {| "itemName": "x", "kind": "var", "parentName": "A.B.C" |} //// export var x; ////} //// -////{| "itemName": "A.B", "kind": "module", "parentName": "" |} ////module A.B { -//// {| "itemName": "y", "kind": "var", "parentName": "A.B" |} //// export var y; ////} //// -////{| "itemName": "A", "kind": "module", "parentName": "" |} ////module A { -//// {| "itemName": "z", "kind": "var", "parentName": "A" |} //// export var z; ////} //// -////{| "itemName": "A", "kind": "module", "parentName": "" |} ////module A { -//// {| "itemName": "B", "kind": "module", "parentName": "A" |} //// module B { -//// {| "itemName": "C", "kind": "module", "parentName": "B" |} //// module C { -//// {| "itemName": "x", "kind": "var", "parentName": "C" |} //// declare var x; //// } //// } ////} - -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -/// We have 8 module keywords, and 4 var keywords. -/// The declarations of A.B.C.x do not get merged, so the 4 vars are independent. -/// The two 'A' modules, however, do get merged, so in reality we have 7 modules. -verify.navigationBarCount(19); +//We have 8 module keywords, and 4 var keywords. +//The declarations of A.B.C.x do not get merged, so the 4 vars are independent. +//The two 'A' modules, however, do get merged, so in reality we have 7 modules. +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "A.B.C", + "kind": "module" + }, + { + "text": "A.B", + "kind": "module" + }, + { + "text": "A", + "kind": "module" + }, + { + "text": "\"X.Y.Z\"", + "kind": "module", + "kindModifiers": "declare" + }, + { + "text": "'X2.Y2.Z2'", + "kind": "module", + "kindModifiers": "declare" + } + ], + "indent": 0 + }, + { + "text": "A.B.C", + "kind": "module", + "childItems": [ + { + "text": "x", + "kind": "var", + "kindModifiers": "export" + } + ], + "indent": 1 + }, + { + "text": "A.B", + "kind": "module", + "childItems": [ + { + "text": "y", + "kind": "var", + "kindModifiers": "export" + } + ], + "indent": 1 + }, + { + "text": "A", + "kind": "module", + "childItems": [ + { + "text": "z", + "kind": "var", + "kindModifiers": "export" + }, + { + "text": "B", + "kind": "module" + } + ], + "indent": 1 + }, + { + "text": "B", + "kind": "module", + "childItems": [ + { + "text": "C", + "kind": "module" + } + ], + "indent": 2 + }, + { + "text": "C", + "kind": "module", + "childItems": [ + { + "text": "x", + "kind": "var", + "kindModifiers": "declare" + } + ], + "indent": 3 + }, + { + "text": "\"X.Y.Z\"", + "kind": "module", + "kindModifiers": "declare", + "childItems": [], + "indent": 1 + }, + { + "text": "'X2.Y2.Z2'", + "kind": "module", + "kindModifiers": "declare", + "childItems": [], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts b/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts index 6bd3d799171d5..c2e43f5f7b78d 100644 --- a/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts +++ b/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts @@ -1,31 +1,22 @@ -////{| "itemName": "\"Multiline\\r\\nMadness\"", "kind": "module", "parentName": "" |} ////declare module "Multiline\r\nMadness" { ////} //// -////{| "itemName": "\"Multiline\\\nMadness\"", "kind": "module", "parentName": "" |} ////declare module "Multiline\ ////Madness" { ////} -////{| "itemName": "\"MultilineMadness\"", "kind": "module", "parentName": "" |} ////declare module "MultilineMadness" {} //// -////{| "itemName": "Foo", "kind": "interface", "parentName": "" |} ////interface Foo { -//// {| "itemName": "\"a1\\\\\\r\\nb\"", "kind": "property", "parentName": "Foo" |} //// "a1\\\r\nb"; -//// {| "itemName": "\"a2\\\n \\\n b\"", "kind": "method", "parentName": "Foo" |} //// "a2\ //// \ //// b"(): Foo; ////} //// -////{| "itemName": "Bar", "kind": "class", "parentName": "" |} ////class Bar implements Foo { -//// {| "itemName": "'a1\\\\\\r\\nb'", "kind": "property", "parentName": "Bar" |} //// 'a1\\\r\nb': Foo; //// -//// {| "itemName": "'a2\\\n \\\n b'", "kind": "method", "parentName": "Bar" |} //// 'a2\ //// \ //// b'(): Foo { @@ -33,9 +24,86 @@ //// } ////} - -test.markers().forEach((marker) => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -verify.navigationBarCount(15); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "Bar", + "kind": "class" + }, + { + "text": "Foo", + "kind": "interface" + }, + { + "text": "\"Multiline\\r\\nMadness\"", + "kind": "module", + "kindModifiers": "declare" + }, + { + "text": "\"Multiline\\\nMadness\"", + "kind": "module", + "kindModifiers": "declare" + }, + { + "text": "\"MultilineMadness\"", + "kind": "module", + "kindModifiers": "declare" + } + ], + "indent": 0 + }, + { + "text": "Bar", + "kind": "class", + "childItems": [ + { + "text": "'a1\\\\\\r\\nb'", + "kind": "property" + }, + { + "text": "'a2\\\n \\\n b'", + "kind": "method" + } + ], + "indent": 1 + }, + { + "text": "Foo", + "kind": "interface", + "childItems": [ + { + "text": "\"a1\\\\\\r\\nb\"", + "kind": "property" + }, + { + "text": "\"a2\\\n \\\n b\"", + "kind": "method" + } + ], + "indent": 1 + }, + { + "text": "\"Multiline\\r\\nMadness\"", + "kind": "module", + "kindModifiers": "declare", + "childItems": [], + "indent": 1 + }, + { + "text": "\"Multiline\\\nMadness\"", + "kind": "module", + "kindModifiers": "declare", + "childItems": [], + "indent": 1 + }, + { + "text": "\"MultilineMadness\"", + "kind": "module", + "kindModifiers": "declare", + "childItems": [], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts b/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts index 8e1981f6101c1..d99d3bce9ebd6 100644 --- a/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts +++ b/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts @@ -6,10 +6,37 @@ //// } ////} -verify.navigationBarContains("List", "class"); -verify.navigationBarContains("constructor", "constructor"); -verify.navigationBarContains("a", "property"); -verify.navigationBarContains("b", "property"); - -// no other items -verify.navigationBarCount(6); \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "List", + "kind": "class" + } + ], + "indent": 0 + }, + { + "text": "List", + "kind": "class", + "childItems": [ + { + "text": "constructor", + "kind": "constructor" + }, + { + "text": "a", + "kind": "property", + "kindModifiers": "public" + }, + { + "text": "b", + "kind": "property", + "kindModifiers": "public" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsSymbols1.ts b/tests/cases/fourslash/navigationBarItemsSymbols1.ts index 6d55812fa0e29..8c565447c1972 100644 --- a/tests/cases/fourslash/navigationBarItemsSymbols1.ts +++ b/tests/cases/fourslash/navigationBarItemsSymbols1.ts @@ -1,18 +1,40 @@ /// -////{| "itemName": "C", "kind": "class", "parentName": "" |} ////class C { -//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "C" |} //// [Symbol.isRegExp] = 0; -//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "C" |} //// [Symbol.iterator]() { } -//// {| "itemName": "[Symbol.isConcatSpreadable]", "kind": "getter", "parentName": "C" |} //// get [Symbol.isConcatSpreadable]() { } ////} -test.markers().forEach(marker => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -// 2 lack markers: and its child -verify.navigationBarCount(2 + test.markers().length); \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "C", + "kind": "class" + } + ], + "indent": 0 + }, + { + "text": "C", + "kind": "class", + "childItems": [ + { + "text": "[Symbol.isConcatSpreadable]", + "kind": "getter" + }, + { + "text": "[Symbol.isRegExp]", + "kind": "property" + }, + { + "text": "[Symbol.iterator]", + "kind": "method" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsSymbols2.ts b/tests/cases/fourslash/navigationBarItemsSymbols2.ts index 5c398f77bbd10..d747b5dadaa0c 100644 --- a/tests/cases/fourslash/navigationBarItemsSymbols2.ts +++ b/tests/cases/fourslash/navigationBarItemsSymbols2.ts @@ -1,16 +1,35 @@ /// -////{| "itemName": "I", "kind": "interface", "parentName": "" |} ////interface I { -//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "I" |} //// [Symbol.isRegExp]: string; -//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "I" |} //// [Symbol.iterator](): string; ////} -test.markers().forEach(marker => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -// 2 are not marked: and its child. -verify.navigationBarCount(2 + test.markers().length); \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "I", + "kind": "interface" + } + ], + "indent": 0 + }, + { + "text": "I", + "kind": "interface", + "childItems": [ + { + "text": "[Symbol.isRegExp]", + "kind": "property" + }, + { + "text": "[Symbol.iterator]", + "kind": "method" + } + ], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsSymbols3.ts b/tests/cases/fourslash/navigationBarItemsSymbols3.ts index 23451588ecdde..29ff9f277a3f4 100644 --- a/tests/cases/fourslash/navigationBarItemsSymbols3.ts +++ b/tests/cases/fourslash/navigationBarItemsSymbols3.ts @@ -1,13 +1,26 @@ /// -////{| "itemName": "E", "kind": "enum", "parentName": "" |} ////enum E { //// // No nav bar entry for this //// [Symbol.isRegExp] = 0 ////} -test.markers().forEach(marker => { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); -}); - -verify.navigationBarCount(3); // and E appearing both toplevel and under \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "E", + "kind": "enum" + } + ], + "indent": 0 + }, + { + "text": "E", + "kind": "enum", + "childItems": [], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/navigationBarItemsTypeAlias.ts b/tests/cases/fourslash/navigationBarItemsTypeAlias.ts index 50923256533e3..8a422651bf39b 100644 --- a/tests/cases/fourslash/navigationBarItemsTypeAlias.ts +++ b/tests/cases/fourslash/navigationBarItemsTypeAlias.ts @@ -2,5 +2,17 @@ ////type T = number | string; -verify.navigationBarCount(1); -verify.navigationBarContains("T", "type"); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [], + "indent": 0 + }, + { + "text": "T", + "kind": "type", + "childItems": [], + "indent": 1 + } +]); diff --git a/tests/cases/fourslash/server/navbar01.ts b/tests/cases/fourslash/server/navbar01.ts index fea424317dbe8..ed8ed2d856384 100644 --- a/tests/cases/fourslash/server/navbar01.ts +++ b/tests/cases/fourslash/server/navbar01.ts @@ -1,52 +1,171 @@ /// ////// Interface -////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint { -//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number; -//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint; -//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any; -//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number; -//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string; +////interface IPoint { +//// getDist(): number; +//// new(): IPoint; +//// (): any; +//// [x:string]: number; +//// prop: string; ////} //// /////// Module -////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { -//// +////module Shapes { //// // Class -//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint { -//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Point" |}constructor (public x: number, public y: number) { } +//// export class Point implements IPoint { +//// constructor (public x: number, public y: number) { } //// //// // Instance member -//// {| "itemName": "getDist", "kind": "method", "parentName": "Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } +//// getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } //// //// // Getter -//// {| "itemName": "value", "kind": "getter", "parentName": "Point" |}get value(): number { return 0; } +//// get value(): number { return 0; } //// //// // Setter -//// {| "itemName": "value", "kind": "setter", "parentName": "Point" |}set value(newValue: number) { return; } +//// set value(newValue: number) { return; } //// //// // Static member -//// {| "itemName": "origin", "kind": "property", "parentName": "Point" |}static origin = new Point(0, 0); +//// static origin = new Point(0, 0); //// //// // Static method -//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Point" |}private static getOrigin() { return Point.origin;} +//// private static getOrigin() { return Point.origin;} //// } //// -//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values { -//// value1, -//// {| "itemName": "value2", "kind": "property", "parentName": "Values" |}value2, -//// value3, -//// } +//// enum Values { value1, value2, value3 } ////} //// ////// Local variables -////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4); -////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist(); +////var p: IPoint = new Shapes.Point(3, 4); +////var dist = p.getDist(); -test.markers().forEach((marker) => { - if (marker.data) { - verify.navigationBarContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "dist", + "kind": "var" + }, + { + "text": "IPoint", + "kind": "interface" + }, + { + "text": "p", + "kind": "var" + }, + { + "text": "Shapes", + "kind": "module" + } + ], + "indent": 0 + }, + { + "text": "IPoint", + "kind": "interface", + "childItems": [ + { + "text": "()", + "kind": "call" + }, + { + "text": "new()", + "kind": "construct" + }, + { + "text": "[]", + "kind": "index" + }, + { + "text": "getDist", + "kind": "method" + }, + { + "text": "prop", + "kind": "property" + } + ], + "indent": 0 + }, + { + "text": "Shapes", + "kind": "module", + "childItems": [ + { + "text": "Point", + "kind": "class", + "kindModifiers": "export" + }, + { + "text": "Values", + "kind": "enum" + } + ], + "indent": 0 + }, + { + "text": "Point", + "kind": "class", + "kindModifiers": "export", + "childItems": [ + { + "text": "constructor", + "kind": "constructor" + }, + { + "text": "getDist", + "kind": "method" + }, + { + "text": "getOrigin", + "kind": "method", + "kindModifiers": "private,static" + }, + { + "text": "origin", + "kind": "property", + "kindModifiers": "static" + }, + { + "text": "value", + "kind": "getter" + }, + { + "text": "value", + "kind": "setter" + }, + { + "text": "x", + "kind": "property", + "kindModifiers": "public" + }, + { + "text": "y", + "kind": "property", + "kindModifiers": "public" + } + ], + "indent": 0 + }, + { + "text": "Values", + "kind": "enum", + "childItems": [ + { + "text": "value1", + "kind": "property" + }, + { + "text": "value2", + "kind": "property" + }, + { + "text": "value3", + "kind": "property" + } + ], + "indent": 0 } -}); - -verify.navigationBarCount(27); +]); diff --git a/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts b/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts index a2cdb80baef50..fe852e03a2848 100644 --- a/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts +++ b/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts @@ -2,12 +2,16 @@ //// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0; -test.markers().forEach(marker => { - verify.navigationBarContains( - marker.data.itemName, - marker.data.kind, - marker.fileName, - marker.data.parentName, - marker.data.isAdditionalRange, - marker.position); -}); \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "c", + "kind": "const" + } + ], + "indent": 0 + } +]); diff --git a/tests/cases/fourslash/shims/getNavigationBarItems.ts b/tests/cases/fourslash/shims/getNavigationBarItems.ts index a2cdb80baef50..fe852e03a2848 100644 --- a/tests/cases/fourslash/shims/getNavigationBarItems.ts +++ b/tests/cases/fourslash/shims/getNavigationBarItems.ts @@ -2,12 +2,16 @@ //// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0; -test.markers().forEach(marker => { - verify.navigationBarContains( - marker.data.itemName, - marker.data.kind, - marker.fileName, - marker.data.parentName, - marker.data.isAdditionalRange, - marker.position); -}); \ No newline at end of file +verify.navigationBar([ + { + "text": "", + "kind": "module", + "childItems": [ + { + "text": "c", + "kind": "const" + } + ], + "indent": 0 + } +]); From 12914eacc5300c5cd9a0aa44df4bef85591288be Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 26 May 2016 09:01:56 -0700 Subject: [PATCH 3/5] Fix lint errors --- src/harness/fourslash.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c33c9107ad7dd..53aaa8c7d6eb3 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1963,7 +1963,7 @@ namespace FourSlash { let items = this.languageService.getNavigationBarItems(this.activeFile.fileName); items = this.simplifyNavigationBar(items); if (JSON.stringify(items) !== JSON.stringify(json)) { - this.raiseError(`verifyNavigationBar failed - expected: ${JSON.stringify(json, undefined, 2)}, got: ${JSON.stringify(items, undefined, 2)}`) + this.raiseError(`verifyNavigationBar failed - expected: ${JSON.stringify(json, undefined, 2)}, got: ${JSON.stringify(items, undefined, 2)}`); } } @@ -1971,30 +1971,35 @@ namespace FourSlash { private simplifyNavigationBar(items: ts.NavigationBarItem[]): any { return items.map(item => { item = ts.clone(item); - if (item.kindModifiers === "") + if (item.kindModifiers === "") { delete item.kindModifiers; + } + // We won't check this. delete item.spans; item.childItems = item.childItems.map(child => { child = ts.clone(child); + delete child.spans; ts.Debug.assert(child.childItems.length === 0); - ts.Debug.assert(child.indent === 0); - ts.Debug.assert(child.bolded === false); - ts.Debug.assert(child.grayed === false); delete child.childItems; + ts.Debug.assert(child.indent === 0); delete child.indent; + ts.Debug.assert(child.bolded === false); delete child.bolded; + ts.Debug.assert(child.grayed === false); delete child.grayed; - delete child.spans; - if (child.kindModifiers === "") + if (child.kindModifiers === "") { delete child.kindModifiers; + } return child; }); - if (item.bolded === false) + if (item.bolded === false) { delete item.bolded; - if (item.grayed === false) + } + if (item.grayed === false) { delete item.grayed; + } return item; - }) + }); } public printNavigationItems(searchValue: string) { From 58d69cda6447b626ad269c946f2f7ec8e8aba758 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 26 May 2016 10:03:07 -0700 Subject: [PATCH 4/5] Fix localeCompare differences between node versions node 6.2.0: "a".localeCompare("A") is -1. node 0.10.45: "a".localeCompare("A") is 32. --- src/services/navigationBar.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index f6f7b741a569e..8db95584eb41e 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -134,7 +134,7 @@ namespace ts.NavigationBar { function sortNodes(nodes: Node[]): Node[] { return nodes.slice(0).sort((n1: Declaration, n2: Declaration) => { if (n1.name && n2.name) { - return getPropertyNameForPropertyNameNode(n1.name).localeCompare(getPropertyNameForPropertyNameNode(n2.name)); + return localeCompareFix(getPropertyNameForPropertyNameNode(n1.name), getPropertyNameForPropertyNameNode(n2.name)); } else if (n1.name) { return 1; @@ -146,6 +146,16 @@ namespace ts.NavigationBar { return n1.kind - n2.kind; } }); + + // node 0.10 treats "a" as greater than "B". + // For consistency, sort alphabetically, falling back to which is lower-case. + function localeCompareFix(a: string, b: string) { + const cmp = a.toLowerCase().localeCompare(b.toLowerCase()); + if (cmp !== 0) + return cmp; + // Return the *opposite* of the `<` operator, which works the same in node 0.10 and 6.0. + return a < b ? 1 : a > b ? -1 : 0; + } } function addTopLevelNodes(nodes: Node[], topLevelNodes: Node[]): void { From b2664e7f842fe838e4a96564651b0fab723207ee Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 27 May 2016 06:12:10 -0700 Subject: [PATCH 5/5] Use a JSON.stringify replacer function instead of changing the value beforehand --- src/harness/fourslash.ts | 56 ++++++------------- .../fourslash/deleteClassWithEnumPresent.ts | 3 +- .../cases/fourslash/getNavigationBarItems.ts | 3 +- tests/cases/fourslash/navbar_const.ts | 3 +- .../navbar_contains-no-duplicates.ts | 3 +- tests/cases/fourslash/navbar_exportDefault.ts | 16 +----- tests/cases/fourslash/navbar_let.ts | 3 +- .../navigationBarItemsBindingPatterns.ts | 3 +- ...ionBarItemsBindingPatternsInConstructor.ts | 3 +- .../navigationBarItemsEmptyConstructors.ts | 3 +- .../fourslash/navigationBarItemsExports.ts | 3 +- .../fourslash/navigationBarItemsFunctions.ts | 4 +- .../navigationBarItemsFunctionsBroken.ts | 4 +- .../navigationBarItemsFunctionsBroken2.ts | 4 +- .../fourslash/navigationBarItemsImports.ts | 3 +- ...ionBarItemsInsideMethodsAndConstructors.ts | 6 +- .../fourslash/navigationBarItemsItems.ts | 3 +- .../fourslash/navigationBarItemsItems2.ts | 5 +- ...rItemsItemsContainsNoAnonymousFunctions.ts | 12 +--- .../navigationBarItemsItemsExternalModules.ts | 3 +- ...navigationBarItemsItemsExternalModules2.ts | 3 +- ...navigationBarItemsItemsExternalModules3.ts | 3 +- .../navigationBarItemsItemsModuleVariables.ts | 6 +- .../navigationBarItemsMissingName1.ts | 3 +- .../navigationBarItemsMissingName2.ts | 4 +- .../fourslash/navigationBarItemsModules.ts | 5 +- ...ationBarItemsMultilineStringIdentifiers.ts | 6 +- ...BarItemsPropertiesDefinedInConstructors.ts | 3 +- .../fourslash/navigationBarItemsSymbols1.ts | 3 +- .../fourslash/navigationBarItemsSymbols2.ts | 3 +- .../fourslash/navigationBarItemsSymbols3.ts | 4 +- .../fourslash/navigationBarItemsTypeAlias.ts | 4 +- tests/cases/fourslash/server/navbar01.ts | 15 ++--- .../shims-pp/getNavigationBarItems.ts | 3 +- .../fourslash/shims/getNavigationBarItems.ts | 3 +- 35 files changed, 60 insertions(+), 151 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 53aaa8c7d6eb3..4a756ab3b1ecc 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1960,46 +1960,24 @@ namespace FourSlash { } public verifyNavigationBar(json: any) { - let items = this.languageService.getNavigationBarItems(this.activeFile.fileName); - items = this.simplifyNavigationBar(items); - if (JSON.stringify(items) !== JSON.stringify(json)) { - this.raiseError(`verifyNavigationBar failed - expected: ${JSON.stringify(json, undefined, 2)}, got: ${JSON.stringify(items, undefined, 2)}`); - } - } - - // Remove any properties that tend to all have the same value so that test data is easier to read. - private simplifyNavigationBar(items: ts.NavigationBarItem[]): any { - return items.map(item => { - item = ts.clone(item); - if (item.kindModifiers === "") { - delete item.kindModifiers; - } - // We won't check this. - delete item.spans; - item.childItems = item.childItems.map(child => { - child = ts.clone(child); - delete child.spans; - ts.Debug.assert(child.childItems.length === 0); - delete child.childItems; - ts.Debug.assert(child.indent === 0); - delete child.indent; - ts.Debug.assert(child.bolded === false); - delete child.bolded; - ts.Debug.assert(child.grayed === false); - delete child.grayed; - if (child.kindModifiers === "") { - delete child.kindModifiers; - } - return child; - }); - if (item.bolded === false) { - delete item.bolded; - } - if (item.grayed === false) { - delete item.grayed; + const items = this.languageService.getNavigationBarItems(this.activeFile.fileName); + if (JSON.stringify(items, replacer) !== JSON.stringify(json)) { + this.raiseError(`verifyNavigationBar failed - expected: ${JSON.stringify(json, undefined, 2)}, got: ${JSON.stringify(items, replacer, 2)}`); + } + + // Make the data easier to read. + function replacer(key: string, value: any) { + switch (key) { + case "spans": + // We won't ever check this. + return undefined; + case "childItems": + return value.length === 0 ? undefined : value; + default: + // Omit falsy values, those are presumed to be the default. + return value || undefined; } - return item; - }); + } } public printNavigationItems(searchValue: string) { diff --git a/tests/cases/fourslash/deleteClassWithEnumPresent.ts b/tests/cases/fourslash/deleteClassWithEnumPresent.ts index d8d4478afe764..17d2adae0b132 100644 --- a/tests/cases/fourslash/deleteClassWithEnumPresent.ts +++ b/tests/cases/fourslash/deleteClassWithEnumPresent.ts @@ -14,8 +14,7 @@ verify.navigationBar([ "text": "Foo", "kind": "enum" } - ], - "indent": 0 + ] }, { "text": "Foo", diff --git a/tests/cases/fourslash/getNavigationBarItems.ts b/tests/cases/fourslash/getNavigationBarItems.ts index a2b0492514a0d..c3b519fe114d1 100644 --- a/tests/cases/fourslash/getNavigationBarItems.ts +++ b/tests/cases/fourslash/getNavigationBarItems.ts @@ -14,8 +14,7 @@ verify.navigationBar([ "text": "C", "kind": "class" } - ], - "indent": 0 + ] }, { "text": "C", diff --git a/tests/cases/fourslash/navbar_const.ts b/tests/cases/fourslash/navbar_const.ts index 02a10f46a74e8..6ec594a2873f5 100644 --- a/tests/cases/fourslash/navbar_const.ts +++ b/tests/cases/fourslash/navbar_const.ts @@ -11,7 +11,6 @@ verify.navigationBar([ "text": "c", "kind": "const" } - ], - "indent": 0 + ] } ]); diff --git a/tests/cases/fourslash/navbar_contains-no-duplicates.ts b/tests/cases/fourslash/navbar_contains-no-duplicates.ts index 333130ff79591..e259a7bef901f 100644 --- a/tests/cases/fourslash/navbar_contains-no-duplicates.ts +++ b/tests/cases/fourslash/navbar_contains-no-duplicates.ts @@ -45,8 +45,7 @@ verify.navigationBar([ "kind": "module", "kindModifiers": "declare" } - ], - "indent": 0 + ] }, { "text": "ABC", diff --git a/tests/cases/fourslash/navbar_exportDefault.ts b/tests/cases/fourslash/navbar_exportDefault.ts index 7c666589f127e..dc99cff7d649c 100644 --- a/tests/cases/fourslash/navbar_exportDefault.ts +++ b/tests/cases/fourslash/navbar_exportDefault.ts @@ -16,15 +16,12 @@ goTo.file("a.ts"); verify.navigationBar([ { "text": "\"a\"", - "kind": "module", - "childItems": [], - "indent": 0 + "kind": "module" }, { "text": "default", "kind": "class", "kindModifiers": "export", - "childItems": [], "indent": 1 } ]); @@ -40,14 +37,12 @@ verify.navigationBar([ "kind": "class", "kindModifiers": "export" } - ], - "indent": 0 + ] }, { "text": "C", "kind": "class", "kindModifiers": "export", - "childItems": [], "indent": 1 } ]); @@ -57,14 +52,11 @@ verify.navigationBar([ { "text": "\"c\"", "kind": "module", - "childItems": [], - "indent": 0 }, { "text": "default", "kind": "function", "kindModifiers": "export", - "childItems": [], "indent": 1 } ]); @@ -80,14 +72,12 @@ verify.navigationBar([ "kind": "function", "kindModifiers": "export" } - ], - "indent": 0 + ] }, { "text": "Func", "kind": "function", "kindModifiers": "export", - "childItems": [], "indent": 1 } ]); diff --git a/tests/cases/fourslash/navbar_let.ts b/tests/cases/fourslash/navbar_let.ts index dc9d9c078577e..7ccd61cdfd679 100644 --- a/tests/cases/fourslash/navbar_let.ts +++ b/tests/cases/fourslash/navbar_let.ts @@ -11,7 +11,6 @@ verify.navigationBar([ "text": "c", "kind": "let" } - ], - "indent": 0 + ] } ]); diff --git a/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts b/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts index 007a9c9b804a8..849f918f47314 100644 --- a/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts +++ b/tests/cases/fourslash/navigationBarItemsBindingPatterns.ts @@ -55,7 +55,6 @@ verify.navigationBar([ "text": "g", "kind": "var" } - ], - "indent": 0 + ] } ]); diff --git a/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts b/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts index 41751f5c74b0f..0ae3e692aa1f8 100644 --- a/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts +++ b/tests/cases/fourslash/navigationBarItemsBindingPatternsInConstructor.ts @@ -24,8 +24,7 @@ verify.navigationBar([ "text": "B", "kind": "class" } - ], - "indent": 0 + ] }, { "text": "A", diff --git a/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts b/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts index 27c33f6afb266..fd534f4c6db5a 100644 --- a/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts +++ b/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts @@ -14,8 +14,7 @@ verify.navigationBar([ "text": "Test", "kind": "class" } - ], - "indent": 0 + ] }, { "text": "Test", diff --git a/tests/cases/fourslash/navigationBarItemsExports.ts b/tests/cases/fourslash/navigationBarItemsExports.ts index 79422f962746b..3ec9b0a713811 100644 --- a/tests/cases/fourslash/navigationBarItemsExports.ts +++ b/tests/cases/fourslash/navigationBarItemsExports.ts @@ -27,7 +27,6 @@ verify.navigationBar([ "kind": "alias", "kindModifiers": "export" } - ], - "indent": 0 + ] } ]); diff --git a/tests/cases/fourslash/navigationBarItemsFunctions.ts b/tests/cases/fourslash/navigationBarItemsFunctions.ts index e2260f2ff2bc5..91546462a2572 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctions.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctions.ts @@ -27,13 +27,11 @@ verify.navigationBar([ "text": "foo", "kind": "function" } - ], - "indent": 0 + ] }, { "text": "baz", "kind": "function", - "childItems": [], "indent": 1 }, { diff --git a/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts b/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts index dc84b50ff306f..96dcbb944ae07 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctionsBroken.ts @@ -13,13 +13,11 @@ verify.navigationBar([ "text": "f", "kind": "function" } - ], - "indent": 0 + ] }, { "text": "f", "kind": "function", - "childItems": [], "indent": 1 } ]); diff --git a/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts b/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts index b4612efcac0e5..127bde8c9e71d 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctionsBroken2.ts @@ -14,13 +14,11 @@ verify.navigationBar([ "text": "f", "kind": "function" } - ], - "indent": 0 + ] }, { "text": "f", "kind": "function", - "childItems": [], "indent": 1 } ]); diff --git a/tests/cases/fourslash/navigationBarItemsImports.ts b/tests/cases/fourslash/navigationBarItemsImports.ts index d6526a7a68c0f..ed398ec7f1d4b 100644 --- a/tests/cases/fourslash/navigationBarItemsImports.ts +++ b/tests/cases/fourslash/navigationBarItemsImports.ts @@ -51,7 +51,6 @@ verify.navigationBar([ "text": "ns", "kind": "alias" } - ], - "indent": 0 + ] } ]); diff --git a/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts b/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts index 7d2fb4ed1277c..28ec25c6f1dd2 100644 --- a/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts +++ b/tests/cases/fourslash/navigationBarItemsInsideMethodsAndConstructors.ts @@ -27,8 +27,7 @@ verify.navigationBar([ "text": "Class", "kind": "class" } - ], - "indent": 0 + ] }, { "text": "Class", @@ -82,13 +81,11 @@ verify.navigationBar([ { "text": "LocalFunctionInConstructor", "kind": "function", - "childItems": [], "indent": 2 }, { "text": "LocalInterfaceInConstrcutor", "kind": "interface", - "childItems": [], "indent": 2 }, { @@ -135,7 +132,6 @@ verify.navigationBar([ { "text": "LocalInterfaceInMethod", "kind": "interface", - "childItems": [], "indent": 2 } ]); diff --git a/tests/cases/fourslash/navigationBarItemsItems.ts b/tests/cases/fourslash/navigationBarItemsItems.ts index 013d28cd402d7..87da858173421 100644 --- a/tests/cases/fourslash/navigationBarItemsItems.ts +++ b/tests/cases/fourslash/navigationBarItemsItems.ts @@ -60,8 +60,7 @@ verify.navigationBar([ "text": "Shapes", "kind": "module" } - ], - "indent": 0 + ] }, { "text": "IPoint", diff --git a/tests/cases/fourslash/navigationBarItemsItems2.ts b/tests/cases/fourslash/navigationBarItemsItems2.ts index 27c32531d6ba2..762531d8778b5 100644 --- a/tests/cases/fourslash/navigationBarItemsItems2.ts +++ b/tests/cases/fourslash/navigationBarItemsItems2.ts @@ -16,20 +16,17 @@ verify.navigationBar([ "text": "A", "kind": "module" } - ], - "indent": 0 + ] }, { "text": "default", "kind": "class", "kindModifiers": "export", - "childItems": [], "indent": 1 }, { "text": "A", "kind": "module", - "childItems": [], "indent": 1 } ]); diff --git a/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts b/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts index 34e4a1c0c89f3..276e19624c92a 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsContainsNoAnonymousFunctions.ts @@ -33,9 +33,7 @@ goTo.marker("file1"); verify.navigationBar([ { "text": "", - "kind": "module", - "childItems": [], - "indent": 0 + "kind": "module" } ]); @@ -49,8 +47,7 @@ verify.navigationBar([ "text": "x", "kind": "var" } - ], - "indent": 0 + ] } ]); @@ -68,19 +65,16 @@ verify.navigationBar([ "text": "foo", "kind": "function" } - ], - "indent": 0 + ] }, { "text": "bar", "kind": "function", - "childItems": [], "indent": 1 }, { "text": "foo", "kind": "function", - "childItems": [], "indent": 1 } ]); diff --git a/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts b/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts index f2df772fb19b4..04091185dd062 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsExternalModules.ts @@ -14,8 +14,7 @@ verify.navigationBar([ "kind": "class", "kindModifiers": "export" } - ], - "indent": 0 + ] }, { "text": "Bar", diff --git a/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts b/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts index 54d4759afe62e..4939091d9442d 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsExternalModules2.ts @@ -21,8 +21,7 @@ verify.navigationBar([ "kind": "var", "kindModifiers": "export" } - ], - "indent": 0 + ] }, { "text": "Bar", diff --git a/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts b/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts index 2db04c980d294..5ee760fabc613 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsExternalModules3.ts @@ -21,8 +21,7 @@ verify.navigationBar([ "kind": "var", "kindModifiers": "export" } - ], - "indent": 0 + ] }, { "text": "Bar", diff --git a/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts b/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts index ef4022ce046bb..6b85d4816125a 100644 --- a/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts +++ b/tests/cases/fourslash/navigationBarItemsItemsModuleVariables.ts @@ -29,8 +29,7 @@ verify.navigationBar([ "text": "Module1", "kind": "module" } - ], - "indent": 0 + ] }, { "text": "Module1", @@ -56,8 +55,7 @@ verify.navigationBar([ "text": "Module1.SubModule", "kind": "module" } - ], - "indent": 0 + ] }, { "text": "Module1.SubModule", diff --git a/tests/cases/fourslash/navigationBarItemsMissingName1.ts b/tests/cases/fourslash/navigationBarItemsMissingName1.ts index 4738cc45063ba..af0e89683bcfe 100644 --- a/tests/cases/fourslash/navigationBarItemsMissingName1.ts +++ b/tests/cases/fourslash/navigationBarItemsMissingName1.ts @@ -12,8 +12,7 @@ verify.navigationBar([ "text": "C", "kind": "class" } - ], - "indent": 0 + ] }, { "text": "C", diff --git a/tests/cases/fourslash/navigationBarItemsMissingName2.ts b/tests/cases/fourslash/navigationBarItemsMissingName2.ts index f4a37cf11543e..2eda3b07855c7 100644 --- a/tests/cases/fourslash/navigationBarItemsMissingName2.ts +++ b/tests/cases/fourslash/navigationBarItemsMissingName2.ts @@ -9,9 +9,7 @@ verify.navigationBar([ { "text": "", - "kind": "module", - "childItems": [], - "indent": 0 + "kind": "module" }, { "text": "default", diff --git a/tests/cases/fourslash/navigationBarItemsModules.ts b/tests/cases/fourslash/navigationBarItemsModules.ts index c3b8aef08ebf5..979f22084e587 100644 --- a/tests/cases/fourslash/navigationBarItemsModules.ts +++ b/tests/cases/fourslash/navigationBarItemsModules.ts @@ -54,8 +54,7 @@ verify.navigationBar([ "kind": "module", "kindModifiers": "declare" } - ], - "indent": 0 + ] }, { "text": "A.B.C", @@ -124,14 +123,12 @@ verify.navigationBar([ "text": "\"X.Y.Z\"", "kind": "module", "kindModifiers": "declare", - "childItems": [], "indent": 1 }, { "text": "'X2.Y2.Z2'", "kind": "module", "kindModifiers": "declare", - "childItems": [], "indent": 1 } ]); diff --git a/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts b/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts index c2e43f5f7b78d..2ee4c93a2f1fb 100644 --- a/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts +++ b/tests/cases/fourslash/navigationBarItemsMultilineStringIdentifiers.ts @@ -52,8 +52,7 @@ verify.navigationBar([ "kind": "module", "kindModifiers": "declare" } - ], - "indent": 0 + ] }, { "text": "Bar", @@ -89,21 +88,18 @@ verify.navigationBar([ "text": "\"Multiline\\r\\nMadness\"", "kind": "module", "kindModifiers": "declare", - "childItems": [], "indent": 1 }, { "text": "\"Multiline\\\nMadness\"", "kind": "module", "kindModifiers": "declare", - "childItems": [], "indent": 1 }, { "text": "\"MultilineMadness\"", "kind": "module", "kindModifiers": "declare", - "childItems": [], "indent": 1 } ]); diff --git a/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts b/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts index d99d3bce9ebd6..9e5a48370c1cb 100644 --- a/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts +++ b/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts @@ -15,8 +15,7 @@ verify.navigationBar([ "text": "List", "kind": "class" } - ], - "indent": 0 + ] }, { "text": "List", diff --git a/tests/cases/fourslash/navigationBarItemsSymbols1.ts b/tests/cases/fourslash/navigationBarItemsSymbols1.ts index 8c565447c1972..53f4c7af445cf 100644 --- a/tests/cases/fourslash/navigationBarItemsSymbols1.ts +++ b/tests/cases/fourslash/navigationBarItemsSymbols1.ts @@ -15,8 +15,7 @@ verify.navigationBar([ "text": "C", "kind": "class" } - ], - "indent": 0 + ] }, { "text": "C", diff --git a/tests/cases/fourslash/navigationBarItemsSymbols2.ts b/tests/cases/fourslash/navigationBarItemsSymbols2.ts index d747b5dadaa0c..2674047f9c059 100644 --- a/tests/cases/fourslash/navigationBarItemsSymbols2.ts +++ b/tests/cases/fourslash/navigationBarItemsSymbols2.ts @@ -14,8 +14,7 @@ verify.navigationBar([ "text": "I", "kind": "interface" } - ], - "indent": 0 + ] }, { "text": "I", diff --git a/tests/cases/fourslash/navigationBarItemsSymbols3.ts b/tests/cases/fourslash/navigationBarItemsSymbols3.ts index 29ff9f277a3f4..9564c496dd8d6 100644 --- a/tests/cases/fourslash/navigationBarItemsSymbols3.ts +++ b/tests/cases/fourslash/navigationBarItemsSymbols3.ts @@ -14,13 +14,11 @@ verify.navigationBar([ "text": "E", "kind": "enum" } - ], - "indent": 0 + ] }, { "text": "E", "kind": "enum", - "childItems": [], "indent": 1 } ]); diff --git a/tests/cases/fourslash/navigationBarItemsTypeAlias.ts b/tests/cases/fourslash/navigationBarItemsTypeAlias.ts index 4973e84b2edbe..8ff9854ac1634 100644 --- a/tests/cases/fourslash/navigationBarItemsTypeAlias.ts +++ b/tests/cases/fourslash/navigationBarItemsTypeAlias.ts @@ -11,13 +11,11 @@ verify.navigationBar([ "text": "T", "kind": "type" } - ], - "indent": 0 + ] }, { "text": "T", "kind": "type", - "childItems": [], "indent": 1 } ]); diff --git a/tests/cases/fourslash/server/navbar01.ts b/tests/cases/fourslash/server/navbar01.ts index ed8ed2d856384..7f2229fcb818d 100644 --- a/tests/cases/fourslash/server/navbar01.ts +++ b/tests/cases/fourslash/server/navbar01.ts @@ -59,8 +59,7 @@ verify.navigationBar([ "text": "Shapes", "kind": "module" } - ], - "indent": 0 + ] }, { "text": "IPoint", @@ -86,8 +85,7 @@ verify.navigationBar([ "text": "prop", "kind": "property" } - ], - "indent": 0 + ] }, { "text": "Shapes", @@ -102,8 +100,7 @@ verify.navigationBar([ "text": "Values", "kind": "enum" } - ], - "indent": 0 + ] }, { "text": "Point", @@ -146,8 +143,7 @@ verify.navigationBar([ "kind": "property", "kindModifiers": "public" } - ], - "indent": 0 + ] }, { "text": "Values", @@ -165,7 +161,6 @@ verify.navigationBar([ "text": "value3", "kind": "property" } - ], - "indent": 0 + ] } ]); diff --git a/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts b/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts index fe852e03a2848..b06d782d8bf4c 100644 --- a/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts +++ b/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts @@ -11,7 +11,6 @@ verify.navigationBar([ "text": "c", "kind": "const" } - ], - "indent": 0 + ] } ]); diff --git a/tests/cases/fourslash/shims/getNavigationBarItems.ts b/tests/cases/fourslash/shims/getNavigationBarItems.ts index fe852e03a2848..b06d782d8bf4c 100644 --- a/tests/cases/fourslash/shims/getNavigationBarItems.ts +++ b/tests/cases/fourslash/shims/getNavigationBarItems.ts @@ -11,7 +11,6 @@ verify.navigationBar([ "text": "c", "kind": "const" } - ], - "indent": 0 + ] } ]);