From 9d42ab983d12780eb2a2e8e90dc63e532a36b462 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 31 May 2018 13:32:02 -0700 Subject: [PATCH] implementations: Use declaration name for the span (#24537) * implementations: Use declaration name for the span * Always get name in nodeEntry --- src/services/findAllReferences.ts | 4 ++-- .../goToImplementationClassMethod_00.ts | 2 +- .../goToImplementationClassMethod_01.ts | 2 +- .../fourslash/goToImplementationEnum_00.ts | 2 +- .../fourslash/goToImplementationEnum_01.ts | 4 ++-- .../goToImplementationInterfaceMethod_00.ts | 10 +++++----- .../goToImplementationInterfaceMethod_01.ts | 2 +- .../goToImplementationInterfaceMethod_02.ts | 2 +- .../goToImplementationInterfaceMethod_03.ts | 2 +- .../goToImplementationInterfaceMethod_04.ts | 4 ++-- .../goToImplementationInterfaceMethod_05.ts | 2 +- .../goToImplementationInterfaceMethod_06.ts | 6 +++--- .../goToImplementationInterfaceMethod_08.ts | 4 ++-- .../goToImplementationInterfaceMethod_09.ts | 2 +- .../goToImplementationInterfaceMethod_10.ts | 6 +++--- .../goToImplementationInterfaceMethod_11.ts | 4 ++-- .../goToImplementationInterfaceProperty_00.ts | 8 ++++---- .../goToImplementationInterfaceProperty_01.ts | 2 +- .../goToImplementationInterface_01.ts | 8 ++++---- .../goToImplementationInterface_07.ts | 4 ++-- .../goToImplementationInterface_08.ts | 2 +- .../fourslash/goToImplementationLocal_00.ts | 4 ++-- .../fourslash/goToImplementationLocal_01.ts | 4 ++-- .../fourslash/goToImplementationLocal_02.ts | 4 ++-- .../fourslash/goToImplementationLocal_03.ts | 4 ++-- .../fourslash/goToImplementationLocal_04.ts | 4 ++-- .../fourslash/goToImplementationLocal_05.ts | 4 ++-- .../fourslash/goToImplementationLocal_06.ts | 4 ++-- .../fourslash/goToImplementationLocal_07.ts | 4 ++-- .../fourslash/goToImplementationLocal_08.ts | 4 ++-- .../goToImplementationNamespace_00.ts | 4 ++-- .../goToImplementationNamespace_01.ts | 2 +- .../goToImplementationNamespace_02.ts | 2 +- .../goToImplementationNamespace_03.ts | 8 ++++---- .../goToImplementationNamespace_04.ts | 8 ++++---- .../goToImplementationNamespace_05.ts | 4 ++-- .../goToImplementationNamespace_06.ts | 4 ++-- ...mentationShorthandPropertyAssignment_00.ts | 6 +++--- ...mentationShorthandPropertyAssignment_01.ts | 8 ++++---- ...mentationShorthandPropertyAssignment_02.ts | 2 +- .../fourslash/goToImplementationSuper_00.ts | 4 ++-- .../fourslash/goToImplementationSuper_01.ts | 4 ++-- .../fourslash/goToImplementationThis_00.ts | 6 +++--- .../fourslash/goToImplementationThis_01.ts | 6 +++--- .../goToImplementation_inDifferentFiles.ts | 8 ++++---- .../fourslash/server/implementation01.ts | 5 ++--- .../shims-pp/getImplementationAtPosition.ts | 19 ++++++------------- .../shims/getImplementationAtPosition.ts | 19 ++++++------------- 48 files changed, 111 insertions(+), 126 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index de1510943c3..c87bdb5e925 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -24,7 +24,7 @@ namespace ts.FindAllReferences { textSpan: TextSpan; } export function nodeEntry(node: Node, isInString?: true): NodeEntry { - return { type: "node", node, isInString }; + return { type: "node", node: (node as NamedDeclaration).name || node, isInString }; } export interface Options { @@ -1096,7 +1096,7 @@ namespace ts.FindAllReferences.Core { function addImplementationReferences(refNode: Node, addReference: (node: Node) => void, state: State): void { // Check if we found a function/propertyAssignment/method with an implementation or initializer if (isDeclarationName(refNode) && isImplementation(refNode.parent)) { - addReference(refNode.parent); + addReference(refNode); return; } diff --git a/tests/cases/fourslash/goToImplementationClassMethod_00.ts b/tests/cases/fourslash/goToImplementationClassMethod_00.ts index 09bece0c1a2..8c8ad0723ee 100644 --- a/tests/cases/fourslash/goToImplementationClassMethod_00.ts +++ b/tests/cases/fourslash/goToImplementationClassMethod_00.ts @@ -3,7 +3,7 @@ // Should handle calls made on members declared in a class //// class Bar { -//// [|{|"parts": ["(","method",")"," ","Bar",".","hello","(",")",":"," ","void"], "kind": "method"|}hello() {}|] +//// [|{|"parts": ["(","method",")"," ","Bar",".","hello","(",")",":"," ","void"], "kind": "method"|}hello|]() {} //// } //// //// new Bar().hel/*reference*/lo; diff --git a/tests/cases/fourslash/goToImplementationClassMethod_01.ts b/tests/cases/fourslash/goToImplementationClassMethod_01.ts index 7f59376a6ae..5aa9deace63 100644 --- a/tests/cases/fourslash/goToImplementationClassMethod_01.ts +++ b/tests/cases/fourslash/goToImplementationClassMethod_01.ts @@ -7,7 +7,7 @@ //// } //// //// class Bar extends AbstractBar{ -//// [|hello() {}|] +//// [|hello|]() {} //// } //// //// function whatever(x: AbstractBar) { diff --git a/tests/cases/fourslash/goToImplementationEnum_00.ts b/tests/cases/fourslash/goToImplementationEnum_00.ts index 81e72b871a2..ee5750ed04d 100644 --- a/tests/cases/fourslash/goToImplementationEnum_00.ts +++ b/tests/cases/fourslash/goToImplementationEnum_00.ts @@ -3,7 +3,7 @@ // Should handle calls made on members of an enum //// enum Foo { -//// [|Foo1 = function initializer() { return 5 } ()|], +//// [|Foo1|] = function initializer() { return 5 } (), //// Foo2 = 6 //// } //// diff --git a/tests/cases/fourslash/goToImplementationEnum_01.ts b/tests/cases/fourslash/goToImplementationEnum_01.ts index 43273b6b03a..cf21420609b 100644 --- a/tests/cases/fourslash/goToImplementationEnum_01.ts +++ b/tests/cases/fourslash/goToImplementationEnum_01.ts @@ -2,10 +2,10 @@ // Should handle calls made on enum name -//// [|enum Foo { +//// enum [|Foo|] { //// Foo1 = function initializer() { return 5 } (), //// Foo2 = 6 -//// }|] +//// } //// //// Fo/*reference*/o; diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_00.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_00.ts index 7ec63c4e94b..0a50197d7ad 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_00.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_00.ts @@ -6,19 +6,19 @@ //// he/*declaration*/llo: () => void //// } //// -//// var bar: Foo = { [|hello: helloImpl|] }; -//// var baz: Foo = { [|"hello": helloImpl|] }; +//// var bar: Foo = { [|hello|]: helloImpl }; +//// var baz: Foo = { "[|hello|]": helloImpl }; //// //// function helloImpl () {} //// -//// function whatever(x: Foo = { [|hello() {/**1*/}|] }) { +//// function whatever(x: Foo = { [|hello|]() {/**1*/} }) { //// x.he/*function_call*/llo() //// } //// //// class Bar { -//// x: Foo = { [|hello() {/*2*/}|] } +//// x: Foo = { [|hello|]() {/*2*/} } //// -//// constructor(public f: Foo = { [|hello() {/**3*/}|] } ) {} +//// constructor(public f: Foo = { [|hello|]() {/**3*/} } ) {} //// } verify.allRangesAppearInImplementationList("function_call"); diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_01.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_01.ts index 8bd328bcb54..d7626b3bf74 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_01.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_01.ts @@ -8,7 +8,7 @@ //// } //// //// class Bar implements Foo { -//// [|hello() {}|] +//// [|hello|]() {} //// public sure() {} //// } //// diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_02.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_02.ts index 82dceaad91c..d672f1c8f48 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_02.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_02.ts @@ -11,7 +11,7 @@ //// } //// //// class Bar extends AbstractBar { -//// [|hello() {}|] +//// [|hello|]() {} //// } //// //// function whatever(a: AbstractBar) { diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_03.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_03.ts index 8826cc1eab4..3753fe4e351 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_03.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_03.ts @@ -7,7 +7,7 @@ //// } //// //// class Bar extends SuperBar { -//// [|hello() {}|] +//// [|hello|]() {} //// } //// //// class SuperBar implements Foo { diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_04.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_04.ts index a9b825c717f..a4c832b43ae 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_04.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_04.ts @@ -7,11 +7,11 @@ //// } //// //// class Bar extends SuperBar { -//// [|hello() {}|] +//// [|hello|]() {} //// } //// //// class SuperBar implements Foo { -//// [|hello() {}|] +//// [|hello|]() {} //// } //// //// class OtherBar implements Foo { diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_05.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_05.ts index b051e16a929..c8cc432c161 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_05.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_05.ts @@ -7,7 +7,7 @@ //// } //// //// class SuperBar implements Foo { -//// [|hello() {}|] +//// [|hello|]() {} //// } //// //// class Bar extends SuperBar { diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_06.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_06.ts index b340270096d..ac39ed70928 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_06.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_06.ts @@ -11,19 +11,19 @@ //// } //// //// class Bar implements Foo { -//// [|hello() {}|] +//// [|hello|]() {} //// someOtherFunction() {} //// } //// //// function createFoo(): Foo { //// return { -//// [|hello() {}|], +//// [|hello|]() {}, //// someOtherFunction() {} //// }; //// } //// //// var y: Foo = { -//// [|hello() {}|], +//// [|hello|]() {}, //// someOtherFunction() {} //// }; //// diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_08.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_08.ts index d2038f99efd..ed1a4b34f50 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_08.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_08.ts @@ -7,7 +7,7 @@ //// } //// //// class SuperBar implements Foo { -//// [|hello() {}|] +//// [|hello|]() {} //// } //// //// class Bar extends SuperBar { @@ -15,7 +15,7 @@ //// } //// //// class SubBar extends Bar { -//// [|hello() {}|] +//// [|hello|]() {} //// } diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_09.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_09.ts index 84c57ec2bce..b507be3fe2b 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_09.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_09.ts @@ -20,7 +20,7 @@ //// } //// //// class SuperBar extends MegaBar { -//// [|hello() {}|] +//// [|hello|]() {} //// } //// //// class MegaBar implements Foo { diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_10.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_10.ts index 0604d2511f2..ebc0f0e713a 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_10.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_10.ts @@ -16,7 +16,7 @@ //// } //// //// class FooImpl implements Foo { -//// [|hello() {/**FooImpl*/}|] +//// [|hello|]() {/**FooImpl*/} //// aloha() {} //// } //// @@ -25,12 +25,12 @@ //// } //// //// class BarImpl implements Bar { -//// [|hello() {/**BarImpl*/}|] +//// [|hello|]() {/**BarImpl*/} //// goodbye() {} //// } //// //// class FooAndBarImpl implements Foo, Bar { -//// [|hello() {/**FooAndBarImpl*/}|] +//// [|hello|]() {/**FooAndBarImpl*/} //// aloha() {} //// goodbye() {} //// } diff --git a/tests/cases/fourslash/goToImplementationInterfaceMethod_11.ts b/tests/cases/fourslash/goToImplementationInterfaceMethod_11.ts index 9528aa409b4..07f06a6d76d 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceMethod_11.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceMethod_11.ts @@ -6,7 +6,7 @@ //// hel/*reference*/lo(): void; //// } //// -//// var x = { [|hello: () => {}|] }; -//// var y = (((({ [|hello: () => {}|] })))); +//// var x = { [|hello|]: () => {} }; +//// var y = (((({ [|hello|]: () => {} })))); verify.allRangesAppearInImplementationList("reference"); \ No newline at end of file diff --git a/tests/cases/fourslash/goToImplementationInterfaceProperty_00.ts b/tests/cases/fourslash/goToImplementationInterfaceProperty_00.ts index 70e49c10b45..547d14d493e 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceProperty_00.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceProperty_00.ts @@ -6,17 +6,17 @@ //// hello: number //// } //// -//// var bar: Foo = { [|hello: 5|] }; +//// var bar: Foo = { [|hello|]: 5 }; //// //// -//// function whatever(x: Foo = { [|hello: 5 * 9|] }) { +//// function whatever(x: Foo = { [|hello|]: 5 * 9 }) { //// x.he/*reference*/llo //// } //// //// class Bar { -//// x: Foo = { [|hello: 6|] } +//// x: Foo = { [|hello|]: 6 } //// -//// constructor(public f: Foo = { [|hello: 7|] } ) {} +//// constructor(public f: Foo = { [|hello|]: 7 } ) {} //// } verify.allRangesAppearInImplementationList("reference"); \ No newline at end of file diff --git a/tests/cases/fourslash/goToImplementationInterfaceProperty_01.ts b/tests/cases/fourslash/goToImplementationInterfaceProperty_01.ts index 14b80362917..46cb696d3de 100644 --- a/tests/cases/fourslash/goToImplementationInterfaceProperty_01.ts +++ b/tests/cases/fourslash/goToImplementationInterfaceProperty_01.ts @@ -5,7 +5,7 @@ //// interface Foo { hello: number } //// //// class Bar implements Foo { -//// [|hello = 5 * 9;|] +//// [|hello|] = 5 * 9; //// } //// //// function whatever(foo: Foo) { diff --git a/tests/cases/fourslash/goToImplementationInterface_01.ts b/tests/cases/fourslash/goToImplementationInterface_01.ts index 62d01da6ca8..9f76e9db5cd 100644 --- a/tests/cases/fourslash/goToImplementationInterface_01.ts +++ b/tests/cases/fourslash/goToImplementationInterface_01.ts @@ -2,13 +2,13 @@ //// interface Fo/*interface_definition*/o { hello(): void } //// -//// [|class SuperBar implements Foo { +//// class [|SuperBar|] implements Foo { //// hello () {} -//// }|] +//// } //// -//// [|abstract class AbstractBar implements Foo { +//// abstract class [|AbstractBar|] implements Foo { //// abstract hello (): void; -//// }|] +//// } //// //// class Bar extends SuperBar { //// } diff --git a/tests/cases/fourslash/goToImplementationInterface_07.ts b/tests/cases/fourslash/goToImplementationInterface_07.ts index 960072004b4..3ebf76d1e3e 100644 --- a/tests/cases/fourslash/goToImplementationInterface_07.ts +++ b/tests/cases/fourslash/goToImplementationInterface_07.ts @@ -20,11 +20,11 @@ //// let x8: Foo[] = [|[{ hello () { /**arrayType*/} }]|]; //// let x9: { y: Foo } = [|{ y: { hello () { /**typeLiteral*/} } }|]; //// let x10 = [|{|"parts": ["(","anonymous local class",")"], "kind": "local class"|}class implements Foo { hello() {} }|] -//// let x11 = [|{|"parts": ["(","local class",")"," ","C"], "kind": "local class"|}class C implements Foo { hello() {} }|] +//// let x11 = class [|{|"parts": ["(","local class",")"," ","C"], "kind": "local class"|}C|] implements Foo { hello() {} } //// //// // Should not do anything for type predicates //// function isFoo(a: any): a is Foo { //// return true; //// } -verify.allRangesAppearInImplementationList("interface_definition"); \ No newline at end of file +verify.allRangesAppearInImplementationList("interface_definition"); diff --git a/tests/cases/fourslash/goToImplementationInterface_08.ts b/tests/cases/fourslash/goToImplementationInterface_08.ts index 652cfe46246..470776c737b 100644 --- a/tests/cases/fourslash/goToImplementationInterface_08.ts +++ b/tests/cases/fourslash/goToImplementationInterface_08.ts @@ -11,7 +11,7 @@ //// interface C extends B, A {} //// //// class X implements B { -//// [|hello() {}|] +//// [|hello|]() {} //// } //// //// function someFunction(d : A) { diff --git a/tests/cases/fourslash/goToImplementationLocal_00.ts b/tests/cases/fourslash/goToImplementationLocal_00.ts index b97fadfcb02..f5e01b89cee 100644 --- a/tests/cases/fourslash/goToImplementationLocal_00.ts +++ b/tests/cases/fourslash/goToImplementationLocal_00.ts @@ -3,6 +3,6 @@ // Should return definition of locally declared functions //// he/*function_call*/llo(); -//// [|function hello() {}|] +//// function [|hello|]() {} -verify.allRangesAppearInImplementationList("function_call"); \ No newline at end of file +verify.allRangesAppearInImplementationList("function_call"); diff --git a/tests/cases/fourslash/goToImplementationLocal_01.ts b/tests/cases/fourslash/goToImplementationLocal_01.ts index 0bda3418354..fe83db9b887 100644 --- a/tests/cases/fourslash/goToImplementationLocal_01.ts +++ b/tests/cases/fourslash/goToImplementationLocal_01.ts @@ -2,7 +2,7 @@ // Should return the defintion of locally defined variables -//// const [|hello = function() {}|]; +//// const [|hello|] = function() {}; //// he/*function_call*/llo(); -verify.allRangesAppearInImplementationList("function_call"); \ No newline at end of file +verify.allRangesAppearInImplementationList("function_call"); diff --git a/tests/cases/fourslash/goToImplementationLocal_02.ts b/tests/cases/fourslash/goToImplementationLocal_02.ts index 62bb8a71a10..6ec1bf0380d 100644 --- a/tests/cases/fourslash/goToImplementationLocal_02.ts +++ b/tests/cases/fourslash/goToImplementationLocal_02.ts @@ -1,8 +1,8 @@ /// -//// const x = { [|hello: () => {}|] }; +//// const x = { [|hello|]: () => {} }; //// //// x.he/*function_call*/llo(); //// -verify.allRangesAppearInImplementationList("function_call"); \ No newline at end of file +verify.allRangesAppearInImplementationList("function_call"); diff --git a/tests/cases/fourslash/goToImplementationLocal_03.ts b/tests/cases/fourslash/goToImplementationLocal_03.ts index d3f25ea29dc..6f40437a8bb 100644 --- a/tests/cases/fourslash/goToImplementationLocal_03.ts +++ b/tests/cases/fourslash/goToImplementationLocal_03.ts @@ -2,11 +2,11 @@ // Should return the definition when invoked on variable assignment -//// let [|he/*local_var*/llo = {}|]; +//// let [|he/*local_var*/llo|] = {}; //// //// x.hello(); //// //// hello = {}; //// -verify.allRangesAppearInImplementationList("local_var"); \ No newline at end of file +verify.allRangesAppearInImplementationList("local_var"); diff --git a/tests/cases/fourslash/goToImplementationLocal_04.ts b/tests/cases/fourslash/goToImplementationLocal_04.ts index 9de9dcd0a9f..e564a375592 100644 --- a/tests/cases/fourslash/goToImplementationLocal_04.ts +++ b/tests/cases/fourslash/goToImplementationLocal_04.ts @@ -2,9 +2,9 @@ // Should return definition of function when invoked on the declaration -//// [|function he/*local_var*/llo() {}|] +//// function [|he/*local_var*/llo|]() {} //// //// hello(); //// -verify.allRangesAppearInImplementationList("local_var"); \ No newline at end of file +verify.allRangesAppearInImplementationList("local_var"); diff --git a/tests/cases/fourslash/goToImplementationLocal_05.ts b/tests/cases/fourslash/goToImplementationLocal_05.ts index 969f4c25fc7..c8e07ab7a74 100644 --- a/tests/cases/fourslash/goToImplementationLocal_05.ts +++ b/tests/cases/fourslash/goToImplementationLocal_05.ts @@ -6,7 +6,7 @@ //// public hello() {} //// } //// -//// var [|someVar = new Bar()|]; +//// var [|someVar|] = new Bar(); //// someVa/*reference*/r.hello(); -verify.allRangesAppearInImplementationList("reference"); \ No newline at end of file +verify.allRangesAppearInImplementationList("reference"); diff --git a/tests/cases/fourslash/goToImplementationLocal_06.ts b/tests/cases/fourslash/goToImplementationLocal_06.ts index acdbaffc36f..90c489bcf54 100644 --- a/tests/cases/fourslash/goToImplementationLocal_06.ts +++ b/tests/cases/fourslash/goToImplementationLocal_06.ts @@ -2,7 +2,7 @@ // Should be able to go to ambient variable declarations -//// declare var [|someVar: string|]; +//// declare var [|someVar|]: string; //// someVa/*reference*/r -verify.allRangesAppearInImplementationList("reference"); \ No newline at end of file +verify.allRangesAppearInImplementationList("reference"); diff --git a/tests/cases/fourslash/goToImplementationLocal_07.ts b/tests/cases/fourslash/goToImplementationLocal_07.ts index 3556c25abc0..b24b463e107 100644 --- a/tests/cases/fourslash/goToImplementationLocal_07.ts +++ b/tests/cases/fourslash/goToImplementationLocal_07.ts @@ -2,7 +2,7 @@ // Should be able to go to ambient function declarations -//// [|declare function someFunction(): () => void;|] +//// declare function [|someFunction|](): () => void; //// someFun/*reference*/ction(); -verify.allRangesAppearInImplementationList("reference"); \ No newline at end of file +verify.allRangesAppearInImplementationList("reference"); diff --git a/tests/cases/fourslash/goToImplementationLocal_08.ts b/tests/cases/fourslash/goToImplementationLocal_08.ts index 3556c25abc0..b24b463e107 100644 --- a/tests/cases/fourslash/goToImplementationLocal_08.ts +++ b/tests/cases/fourslash/goToImplementationLocal_08.ts @@ -2,7 +2,7 @@ // Should be able to go to ambient function declarations -//// [|declare function someFunction(): () => void;|] +//// declare function [|someFunction|](): () => void; //// someFun/*reference*/ction(); -verify.allRangesAppearInImplementationList("reference"); \ No newline at end of file +verify.allRangesAppearInImplementationList("reference"); diff --git a/tests/cases/fourslash/goToImplementationNamespace_00.ts b/tests/cases/fourslash/goToImplementationNamespace_00.ts index 5b71b7bbf9f..c1e05398e22 100644 --- a/tests/cases/fourslash/goToImplementationNamespace_00.ts +++ b/tests/cases/fourslash/goToImplementationNamespace_00.ts @@ -2,11 +2,11 @@ // Should handle namespace and module implementations -//// /*implementation0*/namespace Foo { +//// namespace /*implementation0*/Foo { //// export function hello() {} //// } //// -//// /*implementation1*/module Bar { +//// module /*implementation1*/Bar { //// export function sure() {} //// } //// diff --git a/tests/cases/fourslash/goToImplementationNamespace_01.ts b/tests/cases/fourslash/goToImplementationNamespace_01.ts index b2e267d5378..7d1d36ecde7 100644 --- a/tests/cases/fourslash/goToImplementationNamespace_01.ts +++ b/tests/cases/fourslash/goToImplementationNamespace_01.ts @@ -3,7 +3,7 @@ // Should handle property access expressions on namespaces //// namespace Foo { -//// [|export function hello() {}|] +//// export function [|hello|]() {} //// } //// //// Foo.hell/*reference*/o(); diff --git a/tests/cases/fourslash/goToImplementationNamespace_02.ts b/tests/cases/fourslash/goToImplementationNamespace_02.ts index 2d2ae960a99..c2c4318493e 100644 --- a/tests/cases/fourslash/goToImplementationNamespace_02.ts +++ b/tests/cases/fourslash/goToImplementationNamespace_02.ts @@ -3,7 +3,7 @@ // Should handle property access expressions on namespaces //// module Foo { -//// [|export function hello() {}|] +//// export function [|hello|]() {} //// } //// //// Foo.hell/*reference*/o(); diff --git a/tests/cases/fourslash/goToImplementationNamespace_03.ts b/tests/cases/fourslash/goToImplementationNamespace_03.ts index 751d182ec00..1cc6039933d 100644 --- a/tests/cases/fourslash/goToImplementationNamespace_03.ts +++ b/tests/cases/fourslash/goToImplementationNamespace_03.ts @@ -7,14 +7,14 @@ //// hello(): void; //// } //// -//// [|class BarImpl implements Bar { +//// class [|BarImpl|] implements Bar { //// hello() {} -//// }|] +//// } //// } //// -//// [|class Baz implements Foo.Bar { +//// class [|Baz|] implements Foo.Bar { //// hello() {} -//// }|] +//// } //// //// var someVar1 : Foo.Bar = [|{ hello: () => {/**1*/} }|]; //// diff --git a/tests/cases/fourslash/goToImplementationNamespace_04.ts b/tests/cases/fourslash/goToImplementationNamespace_04.ts index ac0b85e43fe..557b690a42d 100644 --- a/tests/cases/fourslash/goToImplementationNamespace_04.ts +++ b/tests/cases/fourslash/goToImplementationNamespace_04.ts @@ -7,14 +7,14 @@ //// hello(): void; //// } //// -//// [|class BarImpl implements Bar { +//// class [|BarImpl|] implements Bar { //// hello() {} -//// }|] +//// } //// } //// -//// [|class Baz implements Foo.Bar { +//// class [|Baz|] implements Foo.Bar { //// hello() {} -//// }|] +//// } //// //// var someVar1 : Foo.Bar = [|{ hello: () => {/**1*/} }|]; //// diff --git a/tests/cases/fourslash/goToImplementationNamespace_05.ts b/tests/cases/fourslash/goToImplementationNamespace_05.ts index 6936b79bd9b..6fcdb7a396d 100644 --- a/tests/cases/fourslash/goToImplementationNamespace_05.ts +++ b/tests/cases/fourslash/goToImplementationNamespace_05.ts @@ -2,11 +2,11 @@ // Should handle namespace and module implementations with qualified names -//// /*implementation0*/namespace Foo./*implementation2*/Baz { +//// namespace /*implementation0*/Foo./*implementation2*/Baz { //// export function hello() {} //// } //// -//// /*implementation1*/module Bar./*implementation3*/Baz { +//// module /*implementation1*/Bar./*implementation3*/Baz { //// export function sure() {} //// } //// diff --git a/tests/cases/fourslash/goToImplementationNamespace_06.ts b/tests/cases/fourslash/goToImplementationNamespace_06.ts index f5e52d90b1c..62ee4999758 100644 --- a/tests/cases/fourslash/goToImplementationNamespace_06.ts +++ b/tests/cases/fourslash/goToImplementationNamespace_06.ts @@ -2,9 +2,9 @@ // Should handle type queries -//// [|namespace F/*declaration*/oo { +//// namespace [|F/*declaration*/oo|] { //// declare function hello(): void; -//// }|] +//// } //// //// //// let x: typeof Foo = [|{ hello() {} }|]; diff --git a/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_00.ts b/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_00.ts index ad4a0cd6b51..4fed473c46b 100644 --- a/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_00.ts +++ b/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_00.ts @@ -14,7 +14,7 @@ //// Foo: FooConstructor; //// } //// -//// var x = /*classExpression*/class Foo { +//// var x = class /*classExpression*/Foo { //// createBarInClassExpression(): Bar { //// return { //// Fo/*classExpressionRef*/o @@ -24,7 +24,7 @@ //// someFunction() {} //// } //// -//// /*declaredClass*/class Foo { +//// class /*declaredClass*/Foo { //// //// } //// @@ -40,4 +40,4 @@ verify.caretAtMarker("classExpression"); goTo.marker("declaredClassRef"); goTo.implementation(); -verify.caretAtMarker("declaredClass"); \ No newline at end of file +verify.caretAtMarker("declaredClass"); diff --git a/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_01.ts b/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_01.ts index fb4763619a4..23af9ea1591 100644 --- a/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_01.ts +++ b/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_01.ts @@ -15,7 +15,7 @@ //// } //// //// // Class expression that gets used in a bar implementation -//// var x = [|class Foo { +//// var x = class [|Foo|] { //// createBarInClassExpression(): Bar { //// return { //// Foo @@ -23,13 +23,13 @@ //// } //// //// someFunction() {} -//// }|]; +//// }; //// //// // Class declaration that gets used in a bar implementation. This class has multiple definitions //// // (the class declaration and the interface above), but we only want the class returned -//// [|class Foo { +//// class [|Foo|] { //// -//// }|] +//// } //// //// function createBarUsingClassDeclaration(): Bar { //// return { diff --git a/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_02.ts b/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_02.ts index a27480c8272..30542c0c52b 100644 --- a/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_02.ts +++ b/tests/cases/fourslash/goToImplementationShorthandPropertyAssignment_02.ts @@ -11,7 +11,7 @@ //// hello //// }; //// -//// [|function hello() {}|] +//// function [|hello|]() {} //// } //// //// function whatever(x: Foo) { diff --git a/tests/cases/fourslash/goToImplementationSuper_00.ts b/tests/cases/fourslash/goToImplementationSuper_00.ts index 53377bdcdb0..16e059e43f1 100644 --- a/tests/cases/fourslash/goToImplementationSuper_00.ts +++ b/tests/cases/fourslash/goToImplementationSuper_00.ts @@ -2,9 +2,9 @@ // Should go to super class declaration when invoked on a super call expression -//// [|class Foo { +//// class [|Foo|] { //// constructor() {} -//// }|] +//// } //// //// class Bar extends Foo { //// constructor() { diff --git a/tests/cases/fourslash/goToImplementationSuper_01.ts b/tests/cases/fourslash/goToImplementationSuper_01.ts index fffa7caf716..6313b3930d9 100644 --- a/tests/cases/fourslash/goToImplementationSuper_01.ts +++ b/tests/cases/fourslash/goToImplementationSuper_01.ts @@ -2,9 +2,9 @@ // Should go to the super class declaration when invoked on the super keyword in a property access expression -//// [|class Foo { +//// class [|Foo|] { //// hello() {} -//// }|] +//// } //// //// class Bar extends Foo { //// hello() { diff --git a/tests/cases/fourslash/goToImplementationThis_00.ts b/tests/cases/fourslash/goToImplementationThis_00.ts index 19212c9a77a..5162eee9b46 100644 --- a/tests/cases/fourslash/goToImplementationThis_00.ts +++ b/tests/cases/fourslash/goToImplementationThis_00.ts @@ -2,12 +2,12 @@ // Should go to class declaration when invoked on this keyword in property access expression -//// [|class Bar extends Foo { +//// class [|Bar|] extends Foo { //// hello() { //// thi/*this_call*/s.whatever(); //// } //// //// whatever() {} -//// }|] +//// } -verify.allRangesAppearInImplementationList("this_call"); \ No newline at end of file +verify.allRangesAppearInImplementationList("this_call"); diff --git a/tests/cases/fourslash/goToImplementationThis_01.ts b/tests/cases/fourslash/goToImplementationThis_01.ts index 6761c6ec6c9..cd5ab3bfaaa 100644 --- a/tests/cases/fourslash/goToImplementationThis_01.ts +++ b/tests/cases/fourslash/goToImplementationThis_01.ts @@ -2,10 +2,10 @@ // Should go to class declaration when invoked on a this type reference -//// [|class Bar extends Foo { +//// class [|Bar|] extends Foo { //// hello(): th/*this_type*/is { //// return this; //// } -//// }|] +//// } -verify.allRangesAppearInImplementationList("this_type"); \ No newline at end of file +verify.allRangesAppearInImplementationList("this_type"); diff --git a/tests/cases/fourslash/server/goToImplementation_inDifferentFiles.ts b/tests/cases/fourslash/server/goToImplementation_inDifferentFiles.ts index e4289b83102..591e8de3608 100644 --- a/tests/cases/fourslash/server/goToImplementation_inDifferentFiles.ts +++ b/tests/cases/fourslash/server/goToImplementation_inDifferentFiles.ts @@ -3,13 +3,13 @@ // @Filename: /bar.ts ////import {Foo} from './foo' //// -////[|class A implements Foo { +////class [|A|] implements Foo { //// func() {} -////}|] +////} //// -////[|class B implements Foo { +////class [|B|] implements Foo { //// func() {} -////}|] +////} // @Filename: /foo.ts ////export interface /**/Foo { diff --git a/tests/cases/fourslash/server/implementation01.ts b/tests/cases/fourslash/server/implementation01.ts index 24d5f935bda..ddd8c792324 100644 --- a/tests/cases/fourslash/server/implementation01.ts +++ b/tests/cases/fourslash/server/implementation01.ts @@ -1,8 +1,7 @@ /// -// @Filename: a.ts -//// interface Fo/*1*/o {} -//// /*2*/class Bar implements Foo {} +////interface Fo/*1*/o {} +////class /*2*/Bar implements Foo {} goTo.marker('1'); goTo.implementation(); diff --git a/tests/cases/fourslash/shims-pp/getImplementationAtPosition.ts b/tests/cases/fourslash/shims-pp/getImplementationAtPosition.ts index a509922f919..22de573d2c9 100644 --- a/tests/cases/fourslash/shims-pp/getImplementationAtPosition.ts +++ b/tests/cases/fourslash/shims-pp/getImplementationAtPosition.ts @@ -1,9 +1,9 @@ -/// +/// // @Filename: goToImplementationDifferentFile_Implementation.ts -//// /*fooClassImplementation*/class FooImpl implements Foo {} +//// class /*fooClassImplementation*/FooImpl implements Foo {} //// -//// /*barClassImplementation*/class Bar { +//// class /*barClassImplementation*/Bar { //// /*barHelloFunctionImplementation*/hello() {} //// } //// @@ -15,21 +15,14 @@ //// //// x.hel/*barHelloFunctionReference*/lo(); //// -//// /*thisImplementation*/class SomeClass { +//// class /*thisImplementation*/SomeClass { //// someMethod() { //// thi/*thisReference*/s.someMethod(); //// } //// } -var markerList = [ - "fooClass", - "barClass", - "barHelloFunction", - "this" -]; - -markerList.forEach((marker) => { +for (const marker of ["fooClass", "barClass", "barHelloFunction", "this"]) { goTo.marker(marker + 'Reference'); goTo.implementation(); verify.caretAtMarker(marker + 'Implementation'); -}); +}; diff --git a/tests/cases/fourslash/shims/getImplementationAtPosition.ts b/tests/cases/fourslash/shims/getImplementationAtPosition.ts index a509922f919..22de573d2c9 100644 --- a/tests/cases/fourslash/shims/getImplementationAtPosition.ts +++ b/tests/cases/fourslash/shims/getImplementationAtPosition.ts @@ -1,9 +1,9 @@ -/// +/// // @Filename: goToImplementationDifferentFile_Implementation.ts -//// /*fooClassImplementation*/class FooImpl implements Foo {} +//// class /*fooClassImplementation*/FooImpl implements Foo {} //// -//// /*barClassImplementation*/class Bar { +//// class /*barClassImplementation*/Bar { //// /*barHelloFunctionImplementation*/hello() {} //// } //// @@ -15,21 +15,14 @@ //// //// x.hel/*barHelloFunctionReference*/lo(); //// -//// /*thisImplementation*/class SomeClass { +//// class /*thisImplementation*/SomeClass { //// someMethod() { //// thi/*thisReference*/s.someMethod(); //// } //// } -var markerList = [ - "fooClass", - "barClass", - "barHelloFunction", - "this" -]; - -markerList.forEach((marker) => { +for (const marker of ["fooClass", "barClass", "barHelloFunction", "this"]) { goTo.marker(marker + 'Reference'); goTo.implementation(); verify.caretAtMarker(marker + 'Implementation'); -}); +};