Change tests to use the full JSON output of the navigation bar.

This reduces the confusion of verify.navigationBarCount() counting duplicate items.
This commit is contained in:
Andy Hanson 2016-05-26 07:30:31 -07:00
parent fe77f541f6
commit fe970abc81
36 changed files with 1656 additions and 448 deletions

View file

@ -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}.`);
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)}`)
}
}
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)})`);
}
}
// 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) {

View file

@ -5,4 +5,35 @@
goTo.marker();
edit.deleteAtCaret('class Bar { }'.length);
verify.navigationBarContains('Foo', 'enum', 'tests/cases/fourslash/deleteClassWithEnumPresent.ts', '');
verify.navigationBar([
{
"text": "<global>",
"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
}
]);

View file

@ -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;

View file

@ -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": "<global>",
"kind": "module",
"childItems": [
{
"text": "C",
"kind": "class"
}
],
"indent": 0
},
{
"text": "C",
"kind": "class",
"childItems": [
{
"text": "[\"bar\"]",
"kind": "property"
},
{
"text": "foo",
"kind": "property"
}
],
"indent": 1
}
])

View file

@ -1,13 +1,17 @@
/// <reference path="fourslash.ts" />
//// {| "itemName": "c", "kind": "const", "parentName": "<global>" |}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);
});
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "c",
"kind": "const"
}
],
"indent": 0
}
]);

View file

@ -1,42 +1,142 @@
/// <reference path="fourslash.ts" />
//// {| "itemName": "Windows", "kind": "module", "parentName": "<global>" |}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": "<global>", "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": "<global>" |}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": "<global>",
"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);
]);

View file

@ -1,24 +1,93 @@
/// <reference path="fourslash.ts" />
// @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 { }
////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);
});
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
}
]);

View file

@ -1,13 +1,17 @@
/// <reference path="fourslash.ts" />
//// {| "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);
});
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "c",
"kind": "let"
}
],
"indent": 0
}
]);

View file

@ -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": "<global>",
"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
}
]);

View file

@ -11,4 +11,50 @@
//// }
////}
verify.navigationBarCount(9); // global + 2 children + 2x(class + field + constructor)
verify.navigationBar([
{
"text": "<global>",
"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
}
]);

View file

@ -5,8 +5,27 @@
//// }
////}
verify.navigationBarContains("Test", "class");
verify.navigationBarContains("constructor", "constructor");
// no other items
verify.navigationBarCount(4); // global + 1 child, Test + 1 child
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "Test",
"kind": "class"
}
],
"indent": 0
},
{
"text": "Test",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
}
],
"indent": 1
}
]);

View file

@ -1,18 +1,33 @@
/// <reference path="fourslash.ts"/>
////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);
]);

View file

@ -1,23 +1,61 @@
/// <reference path="fourslash.ts"/>
////{| "itemName": "<global>", "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": "<global>" |}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": "<global>",
"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
}
]);

View file

@ -1,12 +1,25 @@
/// <reference path="fourslash.ts"/>
////{| "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); // <global> and 'f'.
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "f",
"kind": "function"
}
],
"indent": 0
},
{
"text": "f",
"kind": "function",
"childItems": [],
"indent": 1
}
]);

View file

@ -1,13 +1,26 @@
/// <reference path="fourslash.ts"/>
////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); // <global> and 'f'
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "f",
"kind": "function"
}
],
"indent": 0
},
{
"text": "f",
"kind": "function",
"childItems": [],
"indent": 1
}
]);

View file

@ -1,25 +1,57 @@
/// <reference path="fourslash.ts"/>
////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);
]);

View file

@ -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": "<global>",
"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
}
]);

View file

@ -1,52 +1,172 @@
/// <reference path="fourslash.ts"/>
////// Interface
////{| "itemName": "IPoint", "kind": "interface", "parentName": "<global>" |}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": "<global>" |}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": "<global>",
"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);
]);

View file

@ -1,6 +1,5 @@
/// <reference path="fourslash.ts"/>
/////**/
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
}
]);

View file

@ -30,15 +30,57 @@
////}
goTo.marker("file1");
verify.navigationBarCount(0);
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [],
"indent": 0
}
]);
goTo.marker("file2");
verify.navigationBarContains("<global>", "module");
verify.navigationBarContains("x", "var");
verify.navigationBarCount(2);
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "x",
"kind": "var"
}
],
"indent": 0
}
]);
goTo.marker("file3");
verify.navigationBarContains("<global>", "module");
verify.navigationBarContains("foo", "function");
verify.navigationBarContains("bar", "function");
verify.navigationBarCount(5);
verify.navigationBar([
{
"text": "<global>",
"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
}
]);

View file

@ -1,11 +1,33 @@
/// <reference path="fourslash.ts"/>
////{| "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
}
]);

View file

@ -1,15 +1,40 @@
/// <reference path="fourslash.ts"/>
// @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
}
]);

View file

@ -1,15 +1,40 @@
/// <reference path="fourslash.ts"/>
// @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
}
]);

View file

@ -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); // <global>, its child, Module1, its child
verify.navigationBar([
{
"text": "<global>",
"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": "<global>",
"kind": "module",
"childItems": [
{
"text": "Module1.SubModule",
"kind": "module"
}
],
"indent": 0
},
{
"text": "Module1.SubModule",
"kind": "module",
"childItems": [
{
"text": "y",
"kind": "var",
"kindModifiers": "export"
}
],
"indent": 1
}
]);

View file

@ -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
}
]);

View file

@ -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": "<global>",
"kind": "module",
"childItems": [],
"indent": 0
},
{
"text": "default",
"kind": "class",
"childItems": [
{
"text": "foo",
"kind": "method"
}
],
"indent": 1
}
]);

View file

@ -1,49 +1,137 @@
/// <reference path="fourslash.ts"/>
////{| "itemName": "\"X.Y.Z\"", "kind": "module", "parentName": "<global>" |}
////declare module "X.Y.Z" {
////}
////declare module "X.Y.Z" {}
////
////{| "itemName": "'X2.Y2.Z2'", "kind": "module", "parentName": "<global>" |}
////declare module 'X2.Y2.Z2' {
////}
////declare module 'X2.Y2.Z2' {}
////
////{| "itemName": "A.B.C", "kind": "module", "parentName": "<global>" |}
////module A.B.C {
//// {| "itemName": "x", "kind": "var", "parentName": "A.B.C" |}
//// export var x;
////}
////
////{| "itemName": "A.B", "kind": "module", "parentName": "<global>" |}
////module A.B {
//// {| "itemName": "y", "kind": "var", "parentName": "A.B" |}
//// export var y;
////}
////
////{| "itemName": "A", "kind": "module", "parentName": "<global>" |}
////module A {
//// {| "itemName": "z", "kind": "var", "parentName": "A" |}
//// export var z;
////}
////
////{| "itemName": "A", "kind": "module", "parentName": "<global>" |}
////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": "<global>",
"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
}
]);

View file

@ -1,31 +1,22 @@
////{| "itemName": "\"Multiline\\r\\nMadness\"", "kind": "module", "parentName": "<global>" |}
////declare module "Multiline\r\nMadness" {
////}
////
////{| "itemName": "\"Multiline\\\nMadness\"", "kind": "module", "parentName": "<global>" |}
////declare module "Multiline\
////Madness" {
////}
////{| "itemName": "\"MultilineMadness\"", "kind": "module", "parentName": "<global>" |}
////declare module "MultilineMadness" {}
////
////{| "itemName": "Foo", "kind": "interface", "parentName": "<global>" |}
////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": "<global>" |}
////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": "<global>",
"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
}
]);

View file

@ -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);
verify.navigationBar([
{
"text": "<global>",
"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
}
]);

View file

@ -1,18 +1,40 @@
/// <reference path="fourslash.ts"/>
////{| "itemName": "C", "kind": "class", "parentName": "<global>" |}
////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: <global> and its child
verify.navigationBarCount(2 + test.markers().length);
verify.navigationBar([
{
"text": "<global>",
"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
}
]);

View file

@ -1,16 +1,35 @@
/// <reference path="fourslash.ts"/>
////{| "itemName": "I", "kind": "interface", "parentName": "<global>" |}
////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: <global> and its child.
verify.navigationBarCount(2 + test.markers().length);
verify.navigationBar([
{
"text": "<global>",
"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
}
]);

View file

@ -1,13 +1,26 @@
/// <reference path="fourslash.ts"/>
////{| "itemName": "E", "kind": "enum", "parentName": "<global>" |}
////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); // <global> and E appearing both toplevel and under <global>
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "E",
"kind": "enum"
}
],
"indent": 0
},
{
"text": "E",
"kind": "enum",
"childItems": [],
"indent": 1
}
]);

View file

@ -2,5 +2,17 @@
////type T = number | string;
verify.navigationBarCount(1);
verify.navigationBarContains("T", "type");
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [],
"indent": 0
},
{
"text": "T",
"kind": "type",
"childItems": [],
"indent": 1
}
]);

View file

@ -1,52 +1,171 @@
/// <reference path="../fourslash.ts"/>
////// Interface
////{| "itemName": "IPoint", "kind": "interface", "parentName": "<global>" |}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": "<global>" |}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": "<global>",
"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);
]);

View file

@ -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);
});
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "c",
"kind": "const"
}
],
"indent": 0
}
]);

View file

@ -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);
});
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "c",
"kind": "const"
}
],
"indent": 0
}
]);