-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add containerName to CallHierarchyItem #38997
Merged
+244
−3
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/baselines/reference/callHierarchyAccessor.callHierarchy.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
165 changes: 165 additions & 0 deletions
165
tests/baselines/reference/callHierarchyContainerName.callHierarchy.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
╭ name: f | ||
├ kind: function | ||
├ file: /tests/cases/fourslash/callHierarchyContainerName.ts | ||
├ span: | ||
│ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:1:1-1:16 | ||
│ │ 1: function f() {} | ||
│ │ ^^^^^^^^^^^^^^^ | ||
│ ╰ | ||
├ selectionSpan: | ||
│ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:1:10-1:11 | ||
│ │ 1: function f() {} | ||
│ │ ^ | ||
│ ╰ | ||
├ incoming: | ||
│ ╭ from: | ||
│ │ ╭ name: sameName | ||
│ │ ├ kind: method | ||
│ │ ├ containerName: A | ||
│ │ ├ file: /tests/cases/fourslash/callHierarchyContainerName.ts | ||
│ │ ├ span: | ||
│ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:4:3-6:4 | ||
│ │ │ │ 4: static sameName() { | ||
│ │ │ │ ^^^^^^^^^^^^^^^^^^^ | ||
│ │ │ │ 5: f(); | ||
│ │ │ │ ^^^^^^^^ | ||
│ │ │ │ 6: } | ||
│ │ │ │ ^^^ | ||
│ │ │ ╰ | ||
│ │ ├ selectionSpan: | ||
│ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:4:10-4:18 | ||
│ │ │ │ 4: static sameName() { | ||
│ │ │ │ ^^^^^^^^ | ||
│ │ │ ╰ | ||
│ │ ├ incoming: | ||
│ │ │ ╭ from: | ||
│ │ │ │ ╭ name: sameName | ||
│ │ │ │ ├ kind: method | ||
│ │ │ │ ├ containerName: B | ||
│ │ │ │ ├ file: /tests/cases/fourslash/callHierarchyContainerName.ts | ||
│ │ │ │ ├ span: | ||
│ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:10:3-12:4 | ||
│ │ │ │ │ │ 10: sameName() { | ||
│ │ │ │ │ │ ^^^^^^^^^^^^ | ||
│ │ │ │ │ │ 11: A.sameName(); | ||
│ │ │ │ │ │ ^^^^^^^^^^^^^^^^^ | ||
│ │ │ │ │ │ 12: } | ||
│ │ │ │ │ │ ^^^ | ||
│ │ │ │ │ ╰ | ||
│ │ │ │ ├ selectionSpan: | ||
│ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:10:3-10:11 | ||
│ │ │ │ │ │ 10: sameName() { | ||
│ │ │ │ │ │ ^^^^^^^^ | ||
│ │ │ │ │ ╰ | ||
│ │ │ │ ├ incoming: | ||
│ │ │ │ │ ╭ from: | ||
│ │ │ │ │ │ ╭ name: sameName | ||
│ │ │ │ │ │ ├ kind: getter | ||
│ │ │ │ │ │ ├ containerName: Obj | ||
│ │ │ │ │ │ ├ file: /tests/cases/fourslash/callHierarchyContainerName.ts | ||
│ │ │ │ │ │ ├ span: | ||
│ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:16:3-18:4 | ||
│ │ │ │ │ │ │ │ 16: get sameName() { | ||
│ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^ | ||
│ │ │ │ │ │ │ │ 17: return new B().sameName; | ||
│ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
│ │ │ │ │ │ │ │ 18: } | ||
│ │ │ │ │ │ │ │ ^^^ | ||
│ │ │ │ │ │ │ ╰ | ||
│ │ │ │ │ │ ├ selectionSpan: | ||
│ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:16:7-16:15 | ||
│ │ │ │ │ │ │ │ 16: get sameName() { | ||
│ │ │ │ │ │ │ │ ^^^^^^^^ | ||
│ │ │ │ │ │ │ ╰ | ||
│ │ │ │ │ │ ├ incoming: | ||
│ │ │ │ │ │ │ ╭ from: | ||
│ │ │ │ │ │ │ │ ╭ name: sameName | ||
│ │ │ │ │ │ │ │ ├ kind: function | ||
│ │ │ │ │ │ │ │ ├ containerName: Foo | ||
│ │ │ │ │ │ │ │ ├ file: /tests/cases/fourslash/callHierarchyContainerName.ts | ||
│ │ │ │ │ │ │ │ ├ span: | ||
│ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:22:3-24:4 | ||
│ │ │ │ │ │ │ │ │ │ 22: function sameName() { | ||
│ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^^^^^ | ||
│ │ │ │ │ │ │ │ │ │ 23: return Obj.sameName; | ||
│ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
│ │ │ │ │ │ │ │ │ │ 24: } | ||
│ │ │ │ │ │ │ │ │ │ ^^^ | ||
│ │ │ │ │ │ │ │ │ ╰ | ||
│ │ │ │ │ │ │ │ ├ selectionSpan: | ||
│ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:22:12-22:20 | ||
│ │ │ │ │ │ │ │ │ │ 22: function sameName() { | ||
│ │ │ │ │ │ │ │ │ │ ^^^^^^^^ | ||
│ │ │ │ │ │ │ │ │ ╰ | ||
│ │ │ │ │ │ │ │ ├ incoming: | ||
│ │ │ │ │ │ │ │ │ ╭ from: | ||
│ │ │ │ │ │ │ │ │ │ ╭ name: C | ||
│ │ │ │ │ │ │ │ │ │ ├ kind: class | ||
│ │ │ │ │ │ │ │ │ │ ├ containerName: Foo | ||
│ │ │ │ │ │ │ │ │ │ ├ file: /tests/cases/fourslash/callHierarchyContainerName.ts | ||
│ │ │ │ │ │ │ │ │ │ ├ span: | ||
│ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:26:3-30:4 | ||
│ │ │ │ │ │ │ │ │ │ │ │ 26: export class C { | ||
│ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^ | ||
│ │ │ │ │ │ │ │ │ │ │ │ 27: constructor() { | ||
│ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^^^ | ||
│ │ │ │ │ │ │ │ │ │ │ │ 28: sameName(); | ||
│ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^ | ||
│ │ │ │ │ │ │ │ │ │ │ │ 29: } | ||
│ │ │ │ │ │ │ │ │ │ │ │ ^^^^^ | ||
│ │ │ │ │ │ │ │ │ │ │ │ 30: } | ||
│ │ │ │ │ │ │ │ │ │ │ │ ^^^ | ||
│ │ │ │ │ │ │ │ │ │ │ ╰ | ||
│ │ │ │ │ │ │ │ │ │ ├ selectionSpan: | ||
│ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:26:16-26:17 | ||
│ │ │ │ │ │ │ │ │ │ │ │ 26: export class C { | ||
│ │ │ │ │ │ │ │ │ │ │ │ ^ | ||
│ │ │ │ │ │ │ │ │ │ │ ╰ | ||
│ │ │ │ │ │ │ │ │ │ ├ incoming: | ||
│ │ │ │ │ │ │ │ │ │ │ ╭ from: | ||
│ │ │ │ │ │ │ │ │ │ │ │ ╭ name: sameName | ||
│ │ │ │ │ │ │ │ │ │ │ │ ├ kind: function | ||
│ │ │ │ │ │ │ │ │ │ │ │ ├ containerName: Bar | ||
│ │ │ │ │ │ │ │ │ │ │ │ ├ file: /tests/cases/fourslash/callHierarchyContainerName.ts | ||
│ │ │ │ │ │ │ │ │ │ │ │ ├ span: | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:34:20-34:37 | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ │ 34: const sameName = () => new Foo.C(); | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^^^^^^^^^^ | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ ╰ | ||
│ │ │ │ │ │ │ │ │ │ │ │ ├ selectionSpan: | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:34:9-34:17 | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ │ 34: const sameName = () => new Foo.C(); | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^ | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ ╰ | ||
│ │ │ │ │ │ │ │ │ │ │ │ ╰ incoming: none | ||
│ │ │ │ │ │ │ │ │ │ │ ├ fromSpans: | ||
│ │ │ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:34:34-34:35 | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ 34: const sameName = () => new Foo.C(); | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ ^ | ||
│ │ │ │ │ │ │ │ │ │ ╰ ╰ ╰ | ||
│ │ │ │ │ │ │ │ │ ├ fromSpans: | ||
│ │ │ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:28:7-28:15 | ||
│ │ │ │ │ │ │ │ │ │ │ 28: sameName(); | ||
│ │ │ │ │ │ │ │ │ │ │ ^^^^^^^^ | ||
│ │ │ │ │ │ │ │ ╰ ╰ ╰ | ||
│ │ │ │ │ │ │ ├ fromSpans: | ||
│ │ │ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:23:16-23:24 | ||
│ │ │ │ │ │ │ │ │ 23: return Obj.sameName; | ||
│ │ │ │ │ │ │ │ │ ^^^^^^^^ | ||
│ │ │ │ │ │ ╰ ╰ ╰ | ||
│ │ │ │ │ ├ fromSpans: | ||
│ │ │ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:17:20-17:28 | ||
│ │ │ │ │ │ │ 17: return new B().sameName; | ||
│ │ │ │ │ │ │ ^^^^^^^^ | ||
│ │ │ │ ╰ ╰ ╰ | ||
│ │ │ ├ fromSpans: | ||
│ │ │ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:11:7-11:15 | ||
│ │ │ │ │ 11: A.sameName(); | ||
│ │ │ │ │ ^^^^^^^^ | ||
│ │ ╰ ╰ ╰ | ||
│ ├ fromSpans: | ||
│ │ ╭ /tests/cases/fourslash/callHierarchyContainerName.ts:5:5-5:6 | ||
│ │ │ 5: f(); | ||
│ │ │ ^ | ||
│ ╰ ╰ | ||
╰ outgoing: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////function /**/f() {} | ||
//// | ||
////class A { | ||
//// static sameName() { | ||
//// f(); | ||
//// } | ||
////} | ||
//// | ||
////class B { | ||
//// sameName() { | ||
//// A.sameName(); | ||
//// } | ||
////} | ||
//// | ||
////const Obj = { | ||
//// get sameName() { | ||
//// return new B().sameName; | ||
//// } | ||
////}; | ||
//// | ||
////namespace Foo { | ||
//// function sameName() { | ||
//// return Obj.sameName; | ||
//// } | ||
//// | ||
//// export class C { | ||
//// constructor() { | ||
//// sameName(); | ||
//// } | ||
//// } | ||
////} | ||
//// | ||
////module Bar { | ||
andrewbranch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//// const sameName = () => new Foo.C(); | ||
////} | ||
|
||
goTo.marker(); | ||
verify.baselineCallHierarchy(); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it safe to do this many unguarded parent accesses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes—
isConstNamedExpression
guarantees that the third-to-last.parent
is aVariableDeclarationList
orCatchClause
, so the second-to-last isVariableStatement | ForStatement | ForOfStatement | ForInStatement | TryStatement
, so one more.parent
is safe from there.