-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Fix find all references of inherited constructor #30514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
166f4de
129276d
768af25
a482f66
17616ac
6c7de67
b1ba80d
5e20db9
7e636e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
|
||
////class A { | ||
//// [|constructor|](s: string) {} | ||
////} | ||
////class B extends A { } | ||
////class C extends B { | ||
//// [|constructor|]() { | ||
//// [|super|](""); | ||
//// } | ||
////} | ||
////class D extends B { } | ||
////class E implements A { } | ||
////const a = new [|A|]("a"); | ||
////const b = new [|B|]("b"); | ||
////const c = new [|C|](); | ||
////const d = new [|D|]("d"); | ||
////const e = new E(); | ||
|
||
verify.noErrors(); | ||
const [aCtr, cCtr, cSuper, aNew, bNew, cNew, dNew] = test.ranges(); | ||
verify.referenceGroups(aCtr, [ | ||
{ definition: "class A", ranges: [aCtr, aNew] }, | ||
{ definition: "class B", ranges: [cSuper, bNew]}, | ||
{ definition: "class D", ranges: [dNew]}]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please add tests for finding constructors for all other classes as well. Also tests for constructor invocation locations as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to do this but find all references only understands that we are looking for a constructor reference if we call it on a constructor declaration. So if we call find all references on a constructor invocation like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might as well open an issue, although this seems like something that might have an existing issue. |
||
verify.referenceGroups(cCtr, [{ definition: "class C", ranges: [cCtr, cNew]}]); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
|
||
////class A { | ||
//// [|constructor|](s: string) {} | ||
////} | ||
////class B extends A { | ||
//// [|constructor|]() { [|super|](""); } | ||
////} | ||
////class C extends B { | ||
//// [|constructor|]() { | ||
//// [|super|](); | ||
//// } | ||
////} | ||
////class D extends B { } | ||
////const a = new [|A|]("a"); | ||
////const b = new [|B|](); | ||
////const c = new [|C|](); | ||
////const d = new [|D|](); | ||
|
||
verify.noErrors(); | ||
const [aCtr, bCtr, bSuper, 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]}]); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @Filename: f.ts | ||
|
||
////class A { | ||
//// [|constructor|](s: string) {} | ||
////} | ||
////class B extends A { } | ||
////export { [|{| "isWriteAccess": true, "isDefinition": true |}A|], [|{| "isWriteAccess": true, "isDefinition": true |}B|] }; | ||
|
||
// @Filename: a.ts | ||
|
||
////import { [|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"; | ||
|
||
// @Filename: b.ts | ||
|
||
////import [|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(); | ||
verify.referenceGroups(aCtr, [ | ||
{ definition: "class A", ranges: [aCtr, aExport] }, | ||
{ definition: "class B", ranges: [bExport]}, | ||
{ definition: "(alias) class B\nexport B", ranges: [bReExport]}, | ||
{ definition: "(alias) class B1\nexport B1", ranges: [b1Export]}, | ||
{ definition: "(alias) class B1\nimport B1", ranges: [b1New]}, | ||
{ definition: "(alias) class A\nexport A", ranges: [aImport]}, | ||
{ definition: "(alias) class A1\nimport A1", ranges: [a1New]}, | ||
{ definition: "class default", ranges: []}, | ||
{ definition: { text: "import B", range: bDefault }, ranges: [bNew]}]); |
Uh oh!
There was an error while loading. Please reload this page.