2017-01-26 20:02:08 +01:00
|
|
|
/// <reference path="fourslash.ts" />
|
|
|
|
|
2018-01-09 01:36:23 +01:00
|
|
|
// @allowSyntheticDefaultimports: true
|
2017-01-26 20:02:08 +01:00
|
|
|
// @Filename: /node_modules/a/index.d.ts
|
2019-06-13 21:25:02 +02:00
|
|
|
////[|declare function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}a|](): void;|]
|
|
|
|
////[|declare namespace [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}a|] {
|
2017-01-26 20:02:08 +01:00
|
|
|
//// export const x: number;
|
2019-06-06 00:01:34 +02:00
|
|
|
////}|]
|
2019-06-13 21:25:02 +02:00
|
|
|
////[|export = [|{| "contextRangeIndex": 4 |}a|];|]
|
2017-01-26 20:02:08 +01:00
|
|
|
|
|
|
|
// Import with different name and we find local refs
|
|
|
|
// @Filename: /b.ts
|
2019-06-13 21:25:02 +02:00
|
|
|
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 6 |}b|] from "a";|]
|
2017-01-26 20:02:08 +01:00
|
|
|
////[|b|]();
|
|
|
|
////[|b|].x;
|
|
|
|
|
|
|
|
// Import with same name and we find all refs
|
|
|
|
// @Filename: /c.ts
|
2019-06-13 21:25:02 +02:00
|
|
|
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 10 |}a|] from "a";|]
|
2017-01-26 20:02:08 +01:00
|
|
|
////[|a|]();
|
|
|
|
////[|a|].x;
|
|
|
|
|
|
|
|
verify.noErrors();
|
2019-06-06 00:01:34 +02:00
|
|
|
const [a0Def, a0, a1Def, a1, a2Def, a2, b0Def, b0, b1, b2, c0Def, c0, c1, c2] = test.ranges();
|
2017-01-26 20:02:08 +01:00
|
|
|
const aRanges = [a0, a1, a2];
|
|
|
|
const bRanges = [b0, b1, b2];
|
|
|
|
const cRanges = [c0, c1, c2];
|
|
|
|
|
2018-03-01 21:46:00 +01:00
|
|
|
verify.referenceGroups([a0, a1, a2], [
|
2017-01-26 20:02:08 +01:00
|
|
|
{ definition: "namespace a\nfunction a(): void", ranges: aRanges },
|
2017-10-26 02:50:11 +02:00
|
|
|
{ definition: "(alias) function b(): void\n(alias) namespace b\nimport b", ranges: bRanges },
|
|
|
|
{ definition: "(alias) function a(): void\n(alias) namespace a\nimport a", ranges: cRanges }
|
2017-01-26 20:02:08 +01:00
|
|
|
]);
|
|
|
|
|
2018-03-01 21:46:00 +01:00
|
|
|
verify.referenceGroups([b0, b1], [
|
2017-10-26 02:50:11 +02:00
|
|
|
{ definition: "(alias) function b(): void\n(alias) namespace b\nimport b", ranges: bRanges }
|
2017-01-26 20:02:08 +01:00
|
|
|
]);
|
|
|
|
|
2018-03-01 21:46:00 +01:00
|
|
|
verify.referenceGroups([c0, c1, c2], [
|
2017-10-26 02:50:11 +02:00
|
|
|
{ definition: "(alias) function a(): void\n(alias) namespace a\nimport a", ranges: cRanges },
|
2017-01-26 20:02:08 +01:00
|
|
|
{ definition: "namespace a\nfunction a(): void", ranges: aRanges },
|
2017-10-26 02:50:11 +02:00
|
|
|
{ definition: "(alias) function b(): void\n(alias) namespace b\nimport b", ranges: bRanges }
|
2017-01-26 20:02:08 +01:00
|
|
|
]);
|
|
|
|
|
|
|
|
verify.renameLocations(aRanges, aRanges.concat(cRanges));
|
|
|
|
verify.rangesAreRenameLocations(bRanges);
|
|
|
|
verify.rangesAreRenameLocations(cRanges);
|