More tests
This commit is contained in:
parent
d1dc837353
commit
e1e1603547
|
@ -1,20 +1,19 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// ["[|{| "isDefinition": true |}prop1|]"]: () => void;
|
||||
//// [|["[|{| "isDefinition": true, "declarationRangeIndex": 0 |}prop1|]"]: () => void;|]
|
||||
////}
|
||||
////
|
||||
////class C implements I {
|
||||
//// ["[|{| "isDefinition": true |}prop1|]"]: any;
|
||||
//// [|["[|{| "isDefinition": true, "declarationRangeIndex": 2 |}prop1|]"]: any;|]
|
||||
////}
|
||||
////
|
||||
////var x: I = {
|
||||
//// ["[|{| "isWriteAccess": true, "isDefinition": true |}prop1|]"]: function () { },
|
||||
//// [|["[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}prop1|]"]: function () { }|],
|
||||
////}
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [r0, r1, r2] = ranges;
|
||||
verify.referenceGroups(ranges, [
|
||||
const [r0Def, r0, r1Def, r1, r2Def, r2] = test.ranges();
|
||||
verify.referenceGroups([r0, r1, r2], [
|
||||
{ definition: { text: '(property) I["prop1"]: () => void', range: r0 }, ranges: [r0, r2] },
|
||||
{ definition: { text: '(property) C["prop1"]: any', range: r1 }, ranges: [r1] },
|
||||
]);
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [[|{| "isDefinition": true |}42|]](): void;
|
||||
//// [|[[|{| "isDefinition": true, "declarationRangeIndex": 0 |}42|]](): void;|]
|
||||
////}
|
||||
////
|
||||
////class C implements I {
|
||||
//// [[|{| "isDefinition": true |}42|]]: any;
|
||||
//// [|[[|{| "isDefinition": true, "declarationRangeIndex": 2 |}42|]]: any;|]
|
||||
////}
|
||||
////
|
||||
////var x: I = {
|
||||
//// ["[|{| "isWriteAccess": true, "isDefinition": true |}42|]"]: function () { }
|
||||
//// [|["[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}42|]"]: function () { }|]
|
||||
////}
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [r0, r1, r2] = ranges;
|
||||
verify.referenceGroups(ranges, [
|
||||
const [r0Def, r0, r1Def, r1, r2Def, r2] = test.ranges();
|
||||
verify.referenceGroups([r0, r1, r2], [
|
||||
{ definition: { text: '(method) I[42](): void', range: r0 }, ranges: [r0, r2] },
|
||||
{ definition: { text: '(property) C[42]: any', range: r1 }, ranges: [r1] },
|
||||
]);
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: a.ts
|
||||
////export default function /*def*/[|{| "isWriteAccess": true, "isDefinition": true |}f|]() {}
|
||||
////[|export default function /*def*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|]() {}|]
|
||||
|
||||
// @Filename: b.ts
|
||||
////import [|{| "isWriteAccess": true, "isDefinition": true |}g|] from "./a";
|
||||
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}g|] from "./a";|]
|
||||
////[|/*ref*/g|]();
|
||||
|
||||
// @Filename: c.ts
|
||||
////import { f } from "./a";
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [r0, r1, r2] = ranges;
|
||||
const [r0Def, r0, r1Def, r1, r2] = test.ranges();
|
||||
verify.referenceGroups(r0, [
|
||||
{ definition: "function f(): void", ranges: [r0] },
|
||||
{ definition: "(alias) function g(): void\nimport g", ranges: [r1, r2] }
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////export default class [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedClass|] {
|
||||
////}
|
||||
////[|export default class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}DefaultExportedClass|] {
|
||||
////}|]
|
||||
////
|
||||
////var x: [|DefaultExportedClass|];
|
||||
////
|
||||
////var y = new [|DefaultExportedClass|];
|
||||
|
||||
verify.singleReferenceGroup("class DefaultExportedClass");
|
||||
verify.singleReferenceGroup("class DefaultExportedClass", "DefaultExportedClass");
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////export default function [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedFunction|]() {
|
||||
////[|export default function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}DefaultExportedFunction|]() {
|
||||
//// return [|DefaultExportedFunction|];
|
||||
////}
|
||||
////}|]
|
||||
////
|
||||
////var x: typeof [|DefaultExportedFunction|];
|
||||
////
|
||||
////var y = [|DefaultExportedFunction|]();
|
||||
////
|
||||
////namespace [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedFunction|] {
|
||||
////}
|
||||
////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}DefaultExportedFunction|] {
|
||||
////}|]
|
||||
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [r0, r1, r2, r3, r4] = ranges;
|
||||
const [r0Def, r0, r1, r2, r3, r4Def, r4] = test.ranges();
|
||||
const fnRanges = [r0, r1, r2, r3];
|
||||
verify.singleReferenceGroup("function DefaultExportedFunction(): () => typeof DefaultExportedFunction", fnRanges);
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////function [|{| "isWriteAccess": true, "isDefinition": true |}f|]() {
|
||||
////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|]() {
|
||||
//// return 100;
|
||||
////}
|
||||
////}|]
|
||||
////
|
||||
////export default [|f|];
|
||||
////[|export default [|{| "declarationRangeIndex": 2 |}f|];|]
|
||||
////
|
||||
////var x: typeof [|f|];
|
||||
////
|
||||
////var y = [|f|]();
|
||||
////
|
||||
////namespace [|{| "isWriteAccess": true, "isDefinition": true |}f|] {
|
||||
////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}f|] {
|
||||
//// var local = 100;
|
||||
////}
|
||||
////}|]
|
||||
|
||||
verify.singleReferenceGroup("namespace f\nfunction f(): number");
|
||||
verify.singleReferenceGroup("namespace f\nfunction f(): number", "f");
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
////
|
||||
////var y = new DefaultExportedClass;
|
||||
////
|
||||
////namespace [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedClass|] {
|
||||
////}
|
||||
////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}DefaultExportedClass|] {
|
||||
////}|]
|
||||
|
||||
verify.noErrors();
|
||||
|
||||
// The namespace and class do not merge,
|
||||
// so the namespace should be all alone.
|
||||
verify.singleReferenceGroup("class DefaultExportedClass\nnamespace DefaultExportedClass");
|
||||
verify.singleReferenceGroup("class DefaultExportedClass\nnamespace DefaultExportedClass", "DefaultExportedClass");
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /export.ts
|
||||
////const [|{| "isWriteAccess": true, "isDefinition": true |}foo|] = 1;
|
||||
////export default [|foo|];
|
||||
////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] = 1;|]
|
||||
////[|export default [|{| "declarationRangeIndex": 2 |}foo|];|]
|
||||
|
||||
// @Filename: /re-export.ts
|
||||
////export { [|{| "isWriteAccess": true, "isDefinition": true |}default|] } from "./export";
|
||||
////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}default|] } from "./export";|]
|
||||
|
||||
// @Filename: /re-export-dep.ts
|
||||
////import [|{| "isWriteAccess": true, "isDefinition": true |}fooDefault|] from "./re-export";
|
||||
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}fooDefault|] from "./re-export";|]
|
||||
|
||||
const [r0, r1, r2, r3] = test.ranges();
|
||||
const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3] = test.ranges();
|
||||
verify.referenceGroups([r0, r1], [
|
||||
{ definition: "const foo: 1", ranges: [r0, r1] },
|
||||
{ definition: "(alias) const foo: 1\nexport default", ranges: [r2], },
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
// @allowSyntheticDefaultImports: true
|
||||
|
||||
// @Filename: /export.ts
|
||||
////const [|{| "isWriteAccess": true, "isDefinition": true |}foo|] = 1;
|
||||
////export = [|foo|];
|
||||
////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] = 1;|]
|
||||
////[|export = [|{| "declarationRangeIndex": 2 |}foo|];|]
|
||||
|
||||
// @Filename: /re-export.ts
|
||||
////export { [|{| "isWriteAccess": true, "isDefinition": true |}default|] } from "./export";
|
||||
////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}default|] } from "./export";|]
|
||||
|
||||
// @Filename: /re-export-dep.ts
|
||||
////import [|{| "isWriteAccess": true, "isDefinition": true |}fooDefault|] from "./re-export";
|
||||
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}fooDefault|] from "./re-export";|]
|
||||
|
||||
verify.noErrors();
|
||||
|
||||
const [r0, r1, r2, r3] = test.ranges();
|
||||
const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3] = test.ranges();
|
||||
verify.referenceGroups([r0, r1], [
|
||||
{ definition: "const foo: 1", ranges: [r0, r1] },
|
||||
{ definition: "(alias) const foo: 1\nexport default", ranges: [r2], },
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: file1.ts
|
||||
////var foo = function [|{| "isWriteAccess": true, "isDefinition": true |}foo|](a = [|foo|](), b = () => [|foo|]) {
|
||||
////var foo = [|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|](a = [|foo|](), b = () => [|foo|]) {
|
||||
//// [|foo|]([|foo|], [|foo|]);
|
||||
////}
|
||||
////}|]
|
||||
|
||||
// @Filename: file2.ts
|
||||
/////// <reference path="file1.ts" />
|
||||
////foo();
|
||||
|
||||
verify.singleReferenceGroup("(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void");
|
||||
verify.singleReferenceGroup("(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", "foo");
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface T { [|{| "isDefinition": true |}a|]: number };
|
||||
////interface T { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: number|] };
|
||||
////type U = { [K in keyof T]: string };
|
||||
////type V = { [K in keyof U]: boolean };
|
||||
////const u: U = { [|{| "isWriteAccess": true, "isDefinition": true |}a|]: "" }
|
||||
////const v: V = { [|{| "isWriteAccess": true, "isDefinition": true |}a|]: true }
|
||||
////const u: U = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}a|]: ""|] }
|
||||
////const v: V = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}a|]: true|] }
|
||||
|
||||
verify.singleReferenceGroup("(property) T.a: number");
|
||||
verify.singleReferenceGroup("(property) T.a: number", "a");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// @Filename: /b.ts
|
||||
/////// <reference types="[|foo|]" />
|
||||
////import { x } from "[|foo|]";
|
||||
////declare module "[|{| "isWriteAccess": true, "isDefinition": true |}foo|]" {}
|
||||
////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}foo|]" {}|]
|
||||
|
||||
verify.noErrors();
|
||||
verify.singleReferenceGroup('module "/node_modules/foo/index"');
|
||||
verify.singleReferenceGroup('module "/node_modules/foo/index"', "foo");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var x = {
|
||||
//// [|{| "isWriteAccess": true, "isDefinition": true |}property|]: {}
|
||||
//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}property|]: {}|]
|
||||
////};
|
||||
////
|
||||
////x.[|property|];
|
||||
////
|
||||
////let {[|property|]: pVar} = x;
|
||||
////[|let {[|{| "declarationRangeIndex": 3 |}property|]: pVar} = x;|]
|
||||
|
||||
verify.singleReferenceGroup("(property) property: {}");
|
||||
verify.singleReferenceGroup("(property) property: {}", "property");
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface A1 { readonly [|{| "isDefinition": true |}a|]: string };
|
||||
////interface A2 { [|{| "isDefinition": true |}a|]?: number };
|
||||
////interface A1 { [|readonly [|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: string|] };
|
||||
////interface A2 { [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}a|]?: number|] };
|
||||
////let a1: A1;
|
||||
////let a2: A2;
|
||||
////let a12 = { ...a1, ...a2 };
|
||||
////a12.[|a|];
|
||||
////a1.[|a|];
|
||||
const ranges = test.ranges();
|
||||
const [r0, r1, r2, r3] = ranges;
|
||||
|
||||
const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges();
|
||||
|
||||
// members of spread types only refer to themselves and the resulting property
|
||||
verify.referenceGroups(r0, [{ definition: "(property) A1.a: string", ranges: [r0, r2, r3] }]);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
////interface Gen {
|
||||
//// x: number
|
||||
//// [|{| "isDefinition": true |}parent|]: Gen;
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}parent|]: Gen;|]
|
||||
//// millenial: string;
|
||||
////}
|
||||
////let t: Gen;
|
||||
////var { x, ...rest } = t;
|
||||
////rest.[|parent|];
|
||||
|
||||
verify.singleReferenceGroup("(property) Gen.parent: Gen");
|
||||
verify.singleReferenceGroup("(property) Gen.parent: Gen", "parent");
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
//// export function doThing(): string;
|
||||
//// export function doTheOtherThing(): void;
|
||||
|
||||
//// export as namespace [|{| "isWriteAccess": true, "isDefinition": true |}myLib|];
|
||||
//// [|export as namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}myLib|];|]
|
||||
|
||||
// @Filename: 1.ts
|
||||
//// /// <reference path="0.d.ts" />
|
||||
//// [|myLib|].doThing();
|
||||
|
||||
verify.singleReferenceGroup("export namespace myLib");
|
||||
verify.singleReferenceGroup("export namespace myLib", "myLib");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////var [|{| "isWriteAccess": true, "isDefinition": true |}Base|] = class { };
|
||||
////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Base|] = class { };|]
|
||||
////class C extends [|Base|] { }
|
||||
|
||||
verify.singleReferenceGroup("var Base: typeof Base");
|
||||
verify.singleReferenceGroup("var Base: typeof Base", "Base");
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////interface [|{| "isWriteAccess": true, "isDefinition": true |}Base|] { }
|
||||
////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Base|] { }|]
|
||||
////namespace n {
|
||||
//// var Base = class { };
|
||||
//// interface I extends [|Base|] { }
|
||||
////}
|
||||
|
||||
verify.singleReferenceGroup("interface Base");
|
||||
verify.singleReferenceGroup("interface Base", "Base");
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
// @Filename: /a.ts
|
||||
////export {};
|
||||
////declare global {
|
||||
//// function [|{| "isWriteAccess": true, "isDefinition": true |}f|](): void;
|
||||
//// [|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|](): void;|]
|
||||
////}
|
||||
|
||||
// @Filename: /b.ts
|
||||
////[|f|]();
|
||||
|
||||
verify.noErrors();
|
||||
verify.singleReferenceGroup("function f(): void");
|
||||
verify.singleReferenceGroup("function f(): void", "f");
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: f.ts
|
||||
////export { [|foo|] as [|{| "isWriteAccess": true, "isDefinition": true |}default|] };
|
||||
////function /*start*/[|{| "isWriteAccess": true, "isDefinition": true |}foo|](a: number, b: number) {
|
||||
////[|export { [|{| "declarationRangeIndex": 0 |}foo|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}default|] };|]
|
||||
////[|function /*start*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}foo|](a: number, b: number) {
|
||||
//// return a + b;
|
||||
////}
|
||||
////}|]
|
||||
|
||||
// @Filename: b.ts
|
||||
////import [|{| "isWriteAccess": true, "isDefinition": true |}bar|] from "./f";
|
||||
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}bar|] from "./f";|]
|
||||
////[|bar|](1, 2);
|
||||
|
||||
verify.noErrors();
|
||||
const [ foo0, foo1, foo2, bar0, bar1 ] = test.ranges();
|
||||
const [ foo0Def, foo0, foo1, foo2Def, foo2, bar0Def, bar0, bar1 ] = test.ranges();
|
||||
const fooGroup = { definition: "function foo(a: number, b: number): number", ranges: [foo0, foo2] };
|
||||
const exportDefaultGroup = { definition: "(alias) function foo(a: number, b: number): number\nexport default", ranges: [foo1] };
|
||||
const barGroup = { definition: "(alias) function bar(a: number, b: number): number\nimport bar", ranges: [bar0, bar1]};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////import j = N./**/ [|q|];
|
||||
////namespace N { export const [|{| "isWriteAccess": true, "isDefinition": true |}q|] = 0; }
|
||||
////namespace N { [|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 1 |}q|] = 0;|] }
|
||||
|
||||
goTo.marker();
|
||||
verify.referenceGroups("", [{ definition: "const N.q: 0", ranges: test.ranges() }]);
|
||||
verify.referenceGroups("", [{ definition: "const N.q: 0", ranges: test.rangesByText().get("q") }]);
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
// @resolveJsonModule: true
|
||||
|
||||
// @Filename: /a.ts
|
||||
////import [|{| "isWriteAccess": true, "isDefinition": true |}j|] = require("[|./j.json|]");
|
||||
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}j|] = require("[|./j.json|]");|]
|
||||
////[|j|];
|
||||
|
||||
// @Filename: /b.js
|
||||
////const [|{| "isWriteAccess": true, "isDefinition": true |}j|] = require("[|./j.json|]");
|
||||
////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}j|] = require("[|./j.json|]");|]
|
||||
////[|j|];
|
||||
|
||||
// @Filename: /j.json
|
||||
|
@ -17,7 +17,7 @@
|
|||
|
||||
verify.noErrors();
|
||||
|
||||
const [r0, r1, r2, r3, r4, r5, r6] = test.ranges();
|
||||
const [r0Def, r0, r1, r2, r3Def, r3, r4, r5, r6] = test.ranges();
|
||||
verify.singleReferenceGroup('import j = require("./j.json")', [r0, r2]);
|
||||
verify.referenceGroups([r1, r4], [{ definition: 'module "/j"', ranges: [r1, r4, r6] }]);
|
||||
verify.singleReferenceGroup('const j: {\n "x": number;\n}', [r3, r5]);
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: f.ts
|
||||
////export { [|foo|] as [|{| "isWriteAccess": true, "isDefinition": true |}foo|] }
|
||||
////function /*start*/[|{| "isWriteAccess": true, "isDefinition": true |}foo|](a: number, b: number) { }
|
||||
////[|export { [|{| "declarationRangeIndex": 0 |}foo|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] }|]
|
||||
////[|function /*start*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}foo|](a: number, b: number) { }|]
|
||||
|
||||
// @Filename: b.ts
|
||||
////import x = require("./f");
|
||||
////x.[|foo|](1, 2);
|
||||
|
||||
verify.noErrors();
|
||||
const [ foo0, foo1, foo2, foo3 ] = test.ranges();
|
||||
const [ foo0Def, foo0, foo1, foo2Def, foo2, foo3 ] = test.ranges();
|
||||
const fooGroup = { definition: "function foo(a: number, b: number): void", ranges: [foo0, foo2] };
|
||||
const exportFooGroup = { definition: "(alias) function foo(a: number, b: number): void\nexport foo", ranges: [foo1, foo3] };
|
||||
verify.referenceGroups("start", [fooGroup, exportFooGroup]);
|
||||
|
|
|
@ -2,27 +2,26 @@
|
|||
|
||||
// @allowSyntheticDefaultimports: true
|
||||
// @Filename: /node_modules/a/index.d.ts
|
||||
////declare function [|{| "isWriteAccess": true, "isDefinition": true |}a|](): void;
|
||||
////declare namespace [|{| "isWriteAccess": true, "isDefinition": true |}a|] {
|
||||
////[|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}a|](): void;|]
|
||||
////[|declare namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}a|] {
|
||||
//// export const x: number;
|
||||
////}
|
||||
////export = [|a|];
|
||||
////}|]
|
||||
////[|export = [|{| "declarationRangeIndex": 4 |}a|];|]
|
||||
|
||||
// Import with different name and we find local refs
|
||||
// @Filename: /b.ts
|
||||
////import [|{| "isWriteAccess": true, "isDefinition": true |}b|] from "a";
|
||||
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}b|] from "a";|]
|
||||
////[|b|]();
|
||||
////[|b|].x;
|
||||
|
||||
// Import with same name and we find all refs
|
||||
// @Filename: /c.ts
|
||||
////import [|{| "isWriteAccess": true, "isDefinition": true |}a|] from "a";
|
||||
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 10 |}a|] from "a";|]
|
||||
////[|a|]();
|
||||
////[|a|].x;
|
||||
|
||||
verify.noErrors();
|
||||
const ranges = test.ranges();
|
||||
const [a0, a1, a2, b0, b1, b2, c0, c1, c2] = ranges;
|
||||
const [a0Def, a0, a1Def, a1, a2Def, a2, b0Def, b0, b1, b2, c0Def, c0, c1, c2] = test.ranges();
|
||||
const aRanges = [a0, a1, a2];
|
||||
const bRanges = [b0, b1, b2];
|
||||
const cRanges = [c0, c1, c2];
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
// @Filename: /a.js
|
||||
////module.exports = 0;
|
||||
////export type [|{| "isWriteAccess": true, "isDefinition": true |}N|] = number;
|
||||
////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}N|] = number;|]
|
||||
|
||||
// @Filename: /b.js
|
||||
////type T = import("./a").[|N|];
|
||||
|
||||
verify.singleReferenceGroup("type N = number");
|
||||
verify.singleReferenceGroup("type N = number", "N");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I { [|{| "isDefinition": true |}boom|](): void; }
|
||||
////interface I { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}boom|](): void;|] }
|
||||
////new class C implements I {
|
||||
//// [|{| "isWriteAccess": true, "isDefinition": true |}boom|](){}
|
||||
//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}boom|](){}|]
|
||||
////}
|
||||
|
||||
const [r0, r1] = test.ranges();
|
||||
const [r0Def, r0, r1Def, r1] = test.ranges();
|
||||
verify.referenceGroups([r0, r1], [
|
||||
{ definition: "(method) I.boom(): void", ranges: [r0] },
|
||||
{ definition: "(method) C.boom(): void", ranges: [r1] }
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////interface I {
|
||||
//// [|{| "isDefinition": true |}0|]: number;
|
||||
//// [|{| "isDefinition": true |}s|]: string;
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}0|]: number;|]
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}s|]: string;|]
|
||||
////}
|
||||
////interface J {
|
||||
//// a: I[[|0|]],
|
||||
//// b: I["[|s|]"],
|
||||
////}
|
||||
|
||||
const [n0, s0, n1, s1] = test.ranges();
|
||||
verify.singleReferenceGroup("(property) I[0]: number", [n0, n1]);
|
||||
verify.singleReferenceGroup("(property) I.s: string", [s0, s1]);
|
||||
verify.singleReferenceGroup("(property) I[0]: number", "0");
|
||||
verify.singleReferenceGroup("(property) I.s: string", "s");
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class class1 extends class1 {
|
||||
//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { }
|
||||
//// [|{| "isDefinition": true |}propName|]: string;
|
||||
//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|]() { }|]
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|]
|
||||
//// }
|
||||
////
|
||||
//// var v: class1;
|
||||
//// v.[|doStuff|]();
|
||||
//// v.[|propName|];
|
||||
|
||||
const [r0, r1, r2, r3] = test.ranges();
|
||||
const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges();
|
||||
verify.singleReferenceGroup("(method) class1.doStuff(): void", [r0, r2]);
|
||||
verify.singleReferenceGroup("(property) class1.propName: string", [r1, r3]);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface interface1 extends interface1 {
|
||||
//// [|{| "isDefinition": true |}doStuff|](): void; // r0
|
||||
//// [|{| "isDefinition": true |}propName|]: string; // r1
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|](): void;|] // r0
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|] // r1
|
||||
//// }
|
||||
////
|
||||
//// var v: interface1;
|
||||
//// v.[|doStuff|](); // r2
|
||||
//// v.[|propName|]; // r3
|
||||
|
||||
const [r0, r1, r2, r3] = test.ranges();
|
||||
const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges();
|
||||
verify.singleReferenceGroup("(method) interface1.doStuff(): void", [r0, r2]);
|
||||
verify.singleReferenceGroup("(property) interface1.propName: string", [r1, r3]);
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class class1 extends class1 {
|
||||
//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } // r0
|
||||
//// [|{| "isDefinition": true |}propName|]: string; // r1
|
||||
//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|]() { }|] // r0
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|] // r1
|
||||
//// }
|
||||
//// interface interface1 extends interface1 {
|
||||
//// [|{| "isDefinition": true |}doStuff|](): void; // r2
|
||||
//// [|{| "isDefinition": true |}propName|]: string; // r3
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}doStuff|](): void;|] // r2
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 6 |}propName|]: string;|] // r3
|
||||
//// }
|
||||
//// class class2 extends class1 implements interface1 {
|
||||
//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } // r4
|
||||
//// [|{| "isDefinition": true |}propName|]: string; // r5
|
||||
//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}doStuff|]() { }|] // r4
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 10 |}propName|]: string;|] // r5
|
||||
//// }
|
||||
////
|
||||
//// var v: class2;
|
||||
//// v.[|doStuff|](); // r6
|
||||
//// v.[|propName|]; // r7
|
||||
|
||||
const [r0, r1, r2, r3, r4, r5, r6, r7] = test.ranges();
|
||||
const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4, r5Def, r5, r6, r7] = test.ranges();
|
||||
verify.referenceGroups(r0, [
|
||||
{ definition: "(method) class1.doStuff(): void", ranges: [r0] },
|
||||
{ definition: "(method) class2.doStuff(): void", ranges: [r4, r6] },
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// interface C extends D {
|
||||
//// [|{| "isDefinition": true |}prop0|]: string; // r0
|
||||
//// [|{| "isDefinition": true |}prop1|]: number; // r1
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}prop0|]: string;|] // r0
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}prop1|]: number;|] // r1
|
||||
//// }
|
||||
////
|
||||
//// interface D extends C {
|
||||
//// [|{| "isDefinition": true |}prop0|]: string; // r2
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}prop0|]: string;|] // r2
|
||||
//// }
|
||||
////
|
||||
//// var d: D;
|
||||
//// d.[|prop0|]; // r3
|
||||
//// d.[|prop1|]; // r4
|
||||
|
||||
const [r0, r1, r2, r3, r4] = test.ranges();
|
||||
const [r0Def, r0, r1Def, r1, r2Def, r2, r3, r4] = test.ranges();
|
||||
verify.referenceGroups([r0, r2, r3], [
|
||||
{ definition: "(property) C.prop0: string", ranges: [r0] },
|
||||
{ definition: "(property) D.prop0: string", ranges: [r2, r3] }
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// class C extends D {
|
||||
//// [|{| "isDefinition": true |}prop0|]: string; // r0
|
||||
//// [|{| "isDefinition": true |}prop1|]: number; // r1
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}prop0|]: string;|] // r0
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}prop1|]: number;|] // r1
|
||||
//// }
|
||||
////
|
||||
//// class D extends C {
|
||||
//// [|{| "isDefinition": true |}prop0|]: string; // r2
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}prop0|]: string;|] // r2
|
||||
//// }
|
||||
////
|
||||
//// var d: D;
|
||||
//// d.[|prop0|]; // r3
|
||||
//// d.[|prop1|]; // r4
|
||||
|
||||
const [r0, r1, r2, r3, r4] = test.ranges();
|
||||
const [r0Def, r0, r1Def, r1, r2Def, r2, r3, r4] = test.ranges();
|
||||
verify.singleReferenceGroup("(property) C.prop0: string", [r0]);
|
||||
verify.singleReferenceGroup("(property) C.prop1: number", [r1]);
|
||||
verify.singleReferenceGroup("(property) D.prop0: string", [r2, r3]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 10;
|
||||
////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 10;|]
|
||||
////var y = `${ [|x|] } ${ [|x|] }`
|
||||
|
||||
verify.singleReferenceGroup("var x: number");
|
||||
verify.singleReferenceGroup("var x: number", "x");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////function [|{| "isWriteAccess": true, "isDefinition": true |}f|](...rest: any[]) { }
|
||||
////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|](...rest: any[]) { }|]
|
||||
////[|f|] `${ [|f|] } ${ [|f|] }`
|
||||
|
||||
verify.singleReferenceGroup("function f(...rest: any[]): void");
|
||||
verify.singleReferenceGroup("function f(...rest: any[]): void", "f");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0;
|
||||
////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|]
|
||||
////
|
||||
////with ({}) {
|
||||
//// var y = x; // Reference of x here should not be picked
|
||||
|
@ -9,4 +9,4 @@
|
|||
////
|
||||
////[|{| "isWriteAccess": true |}x|] = [|x|] + 1;
|
||||
|
||||
verify.singleReferenceGroup("var x: number");
|
||||
verify.singleReferenceGroup("var x: number", "x");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// @allowJs: true
|
||||
|
||||
// @Filename: /a.js
|
||||
/////** @typedef {number} [|{| "isWriteAccess": true, "isDefinition": true |}T|] */
|
||||
/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|]|] */
|
||||
////
|
||||
/////**
|
||||
//// * @return {[|T|]}
|
||||
|
@ -17,4 +17,4 @@
|
|||
//// */
|
||||
////function f2(obj) { return 0; }
|
||||
|
||||
verify.singleReferenceGroup("type T = number");
|
||||
verify.singleReferenceGroup("type T = number", "T");
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface T { [|{| "isDefinition": true |}a|]: number; }
|
||||
////interface T { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: number;|] }
|
||||
////type U = { readonly [K in keyof T]?: string };
|
||||
////declare const t: T;
|
||||
////t.[|a|];
|
||||
////declare const u: U;
|
||||
////u.[|a|];
|
||||
|
||||
verify.singleReferenceGroup("(property) T.a: number");
|
||||
verify.singleReferenceGroup("(property) T.a: number", "a");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /node_modules/foo/index.d.ts
|
||||
////export type [|{| "isWriteAccess": true, "isDefinition": true |}T|] = number;
|
||||
////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|] = number;|]
|
||||
|
||||
// @Filename: /a.ts
|
||||
////import * as foo from "foo";
|
||||
|
@ -10,4 +10,4 @@
|
|||
////}
|
||||
|
||||
verify.noErrors();
|
||||
verify.singleReferenceGroup("type T = number");
|
||||
verify.singleReferenceGroup("type T = number", "T");
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
////const b = require("[|./b|]");
|
||||
|
||||
// @Filename: /b.js
|
||||
////[|module|].exports = 0;
|
||||
////[|[|{| "declarationRangeIndex": 1 |}module|].exports = 0;|]
|
||||
|
||||
verify.singleReferenceGroup('module "/b"')
|
||||
const [r0, rDef, r1] = test.ranges();
|
||||
verify.singleReferenceGroup('module "/b"', [r0, r1]);
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
// https://github.com/Microsoft/TypeScript/issues/15452
|
||||
|
||||
// @Filename: /a.ts
|
||||
////export const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0;
|
||||
////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|]
|
||||
|
||||
// @Filename: /b.ts
|
||||
////import "./a";
|
||||
|
||||
verify.singleReferenceGroup("const x: 0");
|
||||
verify.singleReferenceGroup("const x: 0", "x");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|{| "isDefinition": true |}property1|]: number;
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|]
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { [|property1|]: prop1 } = foo;
|
||||
////[|var { [|{| "declarationRangeIndex": 2 |}property1|]: prop1 } = foo;|]
|
||||
|
||||
verify.singleReferenceGroup("(property) I.property1: number");
|
||||
verify.singleReferenceGroup("(property) I.property1: number", "property1");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|{| "isDefinition": true |}property1|]: number;
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|]
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { [|property1|]: {} } = foo;
|
||||
////[|var { [|{| "declarationRangeIndex": 2 |}property1|]: {} } = foo;|]
|
||||
|
||||
verify.singleReferenceGroup("(property) I.property1: number");
|
||||
verify.singleReferenceGroup("(property) I.property1: number", "property1");
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|{| "isDefinition": true |}property1|]: number;
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|]
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var [{ [|property1|]: prop1 }, { [|{| "isWriteAccess": true, "isDefinition": true |}property1|], property2 } ] = [foo, foo];
|
||||
////[|var [{ [|{| "declarationRangeIndex": 2 |}property1|]: prop1 }, { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}property1|], property2 } ] = [foo, foo];|]
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [r0, r1, r2] = ranges;
|
||||
verify.referenceGroups([r0, r1], [{ definition: "(property) I.property1: number", ranges }]);
|
||||
const [r0Def, r0, r1Def, r1, r2] = test.ranges();
|
||||
verify.referenceGroups([r0, r1], [{
|
||||
definition: "(property) I.property1: number",
|
||||
ranges: [r0, r1, r2]
|
||||
}]);
|
||||
verify.referenceGroups(r2, [
|
||||
{ definition: "(property) I.property1: number", ranges: [r0, r1] },
|
||||
{ definition: "var property1: number", ranges: [r2] }
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|{| "isDefinition": true |}property1|]: number;
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|]
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////function f({ [|property1|]: p1 }: I,
|
||||
//// { [|{| "isWriteAccess": true, "isDefinition": true |}property1|] }: I,
|
||||
////function f([|{ [|{| "declarationRangeIndex": 2 |}property1|]: p1 }: I|],
|
||||
//// [|{ [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}property1|] }: I|],
|
||||
//// { property1: p2 }) {
|
||||
////
|
||||
//// return [|property1|] + 1;
|
||||
////}
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [r0, r1, r2, r3] = ranges;
|
||||
const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = test.ranges();
|
||||
verify.referenceGroups([r0, r1], [{ definition: "(property) I.property1: number", ranges: [r0, r1, r2] }]);
|
||||
verify.referenceGroups(r2, [
|
||||
{ definition: "(property) I.property1: number", ranges: [r0, r1] },
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|{| "isDefinition": true |}property1|]: number;
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|]
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var elems: I[];
|
||||
////for (let { [|property1|]: p } of elems) {
|
||||
////for ([|let { [|{| "declarationRangeIndex": 2 |}property1|]: p } of elems|]) {
|
||||
////}
|
||||
////for (let { [|{| "isWriteAccess": true, "isDefinition": true |}property1|] } of elems) {
|
||||
////for ([|let { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}property1|] } of elems|]) {
|
||||
////}
|
||||
////for (var { [|property1|]: p1 } of elems) {
|
||||
////for ([|var { [|{| "declarationRangeIndex": 6 |}property1|]: p1 } of elems|]) {
|
||||
////}
|
||||
////var p2;
|
||||
////for ({ [|{| "isWriteAccess": true, "isDefinition": true |}property1|] : p2 } of elems) {
|
||||
////for ([|{ [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}property1|] : p2 } of elems|]) {
|
||||
////}
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [r0, r1, r2, r3, r4] = ranges;
|
||||
verify.referenceGroups([r0, r1, r3, r4], [{ definition: "(property) I.property1: number", ranges }]);
|
||||
const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4] = test.ranges();
|
||||
verify.referenceGroups([r0, r1, r3, r4], [{
|
||||
definition: "(property) I.property1: number",
|
||||
ranges: [r0, r1, r2, r3, r4]
|
||||
}]);
|
||||
verify.referenceGroups(r2, [
|
||||
{ definition: "(property) I.property1: number", ranges: [r0, r1, r3, r4] },
|
||||
{ definition: "let property1: number", ranges: [r2] }
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
////let p, b;
|
||||
////
|
||||
////p, [{ [|{| "isDefinition": true |}a|]: p, b }] = [{ [|{| "isWriteAccess": true, "isDefinition": true |}a|]: 10, b: true }];
|
||||
////p, [|[{ [|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: p, b }] = [{ [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}a|]: 10|], b: true }]|];
|
||||
|
||||
verify.singleReferenceGroup("(property) a: any");
|
||||
verify.singleReferenceGroup("(property) a: any", "a");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface Recursive {
|
||||
//// [|{| "isDefinition": true |}next|]?: Recursive;
|
||||
//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}next|]?: Recursive;|]
|
||||
//// value: any;
|
||||
////}
|
||||
////
|
||||
////function f ({ [|next|]: { [|next|]: x} }: Recursive) {
|
||||
////function f ([|{ [|{| "declarationRangeIndex": 2 |}next|]: { [|{| "declarationRangeIndex": 2 |}next|]: x} }: Recursive|]) {
|
||||
////}
|
||||
|
||||
verify.singleReferenceGroup("(property) Recursive.next?: Recursive");
|
||||
verify.singleReferenceGroup("(property) Recursive.next?: Recursive", "next");
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
|
||||
////class A {
|
||||
//// [|constructor|](s: string) {}
|
||||
//// [|[|{| "declarationRangeIndex": 0 |}constructor|](s: string) {}|]
|
||||
////}
|
||||
////class B extends A { }
|
||||
////class C extends B {
|
||||
//// [|constructor|]() {
|
||||
//// [|[|{| "declarationRangeIndex": 2 |}constructor|]() {
|
||||
//// [|super|]("");
|
||||
//// }
|
||||
//// }|]
|
||||
////}
|
||||
////class D extends B { }
|
||||
////class E implements A { }
|
||||
|
@ -19,7 +19,7 @@
|
|||
////const e = new E();
|
||||
|
||||
verify.noErrors();
|
||||
const [aCtr, cCtr, cSuper, aNew, bNew, cNew, dNew] = test.ranges();
|
||||
const [aCtrDef, aCtr, cCtrDef, cCtr, cSuper, aNew, bNew, cNew, dNew] = test.ranges();
|
||||
verify.referenceGroups(aCtr, [
|
||||
{ definition: "class A", ranges: [aCtr, aNew] },
|
||||
{ definition: "class B", ranges: [cSuper, bNew]},
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
|
||||
////class A {
|
||||
//// [|constructor|](s: string) {}
|
||||
//// [|[|{| "declarationRangeIndex": 0 |}constructor|](s: string) {}|]
|
||||
////}
|
||||
////class B extends A {
|
||||
//// [|constructor|]() { [|super|](""); }
|
||||
//// [|[|{| "declarationRangeIndex": 2 |}constructor|]() { [|super|](""); }|]
|
||||
////}
|
||||
////class C extends B {
|
||||
//// [|constructor|]() {
|
||||
//// [|[|{| "declarationRangeIndex": 5 |}constructor|]() {
|
||||
//// [|super|]();
|
||||
//// }
|
||||
//// }|]
|
||||
////}
|
||||
////class D extends B { }
|
||||
////const a = new [|A|]("a");
|
||||
|
@ -19,7 +19,7 @@
|
|||
////const d = new [|D|]();
|
||||
|
||||
verify.noErrors();
|
||||
const [aCtr, bCtr, bSuper, cCtr, cSuper, aNew, bNew, cNew, dNew] = test.ranges();
|
||||
const [aCtrDef, aCtr, bCtrDef, bCtr, bSuper, cCtrDef, cCtr, cSuper, aNew, bNew, cNew, dNew] = test.ranges();
|
||||
verify.referenceGroups(aCtr, [{ definition: "class A", ranges: [aCtr, bSuper, aNew] }]);
|
||||
verify.referenceGroups(bCtr, [{ definition: "class B", ranges: [bCtr, cSuper, bNew]}, { definition: "class D", ranges: [dNew]}]);
|
||||
verify.referenceGroups(cCtr, [{ definition: "class C", ranges: [cCtr, cNew]}]);
|
|
@ -3,26 +3,26 @@
|
|||
// @Filename: f.ts
|
||||
|
||||
////class A {
|
||||
//// [|constructor|](s: string) {}
|
||||
//// [|[|{| "declarationRangeIndex": 0 |}constructor|](s: string) {}|]
|
||||
////}
|
||||
////class B extends A { }
|
||||
////export { [|{| "isWriteAccess": true, "isDefinition": true |}A|], [|{| "isWriteAccess": true, "isDefinition": true |}B|] };
|
||||
////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}A|], [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}B|] };|]
|
||||
|
||||
// @Filename: a.ts
|
||||
|
||||
////import { [|A|] as A1 } from "./f";
|
||||
////[|import { [|{| "declarationRangeIndex": 5 |}A|] as A1 } from "./f";|]
|
||||
////const a1 = new [|A1|]("a1");
|
||||
////export default class extends A1 { }
|
||||
////export { [|B|] as [|{| "isWriteAccess": true, "isDefinition": true |}B1|] } from "./f";
|
||||
////[|export { [|{| "declarationRangeIndex": 8 |}B|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}B1|] } from "./f";|]
|
||||
|
||||
// @Filename: b.ts
|
||||
|
||||
////import [|B|], { B1 } from "./a";
|
||||
////[|import [|{| "declarationRangeIndex": 11 |}B|], { B1 } from "./a";|]
|
||||
////const d = new [|B|]("b");
|
||||
////const d1 = new [|B1|]("b1");
|
||||
|
||||
verify.noErrors();
|
||||
const [aCtr, aExport, bExport, aImport, a1New, bReExport, b1Export, bDefault, bNew, b1New ] = test.ranges();
|
||||
const [aCtrDef, aCtr, exportDef, aExport, bExport, aImportDef, aImport, a1New, reExportDef, bReExport, b1Export, bDefaultDef, bDefault, bNew, b1New ] = test.ranges();
|
||||
verify.referenceGroups(aCtr, [
|
||||
{ definition: "class A", ranges: [aCtr, aExport] },
|
||||
{ definition: "class B", ranges: [bExport]},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////class X {
|
||||
//// public [|constructor|]() {}
|
||||
//// [|public [|{| "declarationRangeIndex": 0 |}constructor|]() {}|]
|
||||
////}
|
||||
////var x = new [|X|]();
|
||||
|
||||
const ranges = test.ranges();
|
||||
const [rDef, ...ranges] = test.ranges();
|
||||
verify.referenceGroups(ranges[0], [{ definition: "class X", ranges }]);
|
||||
|
|
Loading…
Reference in a new issue