-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix incoming call hierarchy ranges #11455
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
| @@ -1,32 +1,35 @@ | ||
| /// <reference path="typings/fourslash.d.ts" /> | ||
|
|
||
| // @filename: declare.py | ||
| //// def /*marker1*/func(): | ||
| //// /*marker3*/def /*marker1*/func(): | ||
| //// return 1 | ||
|
|
||
| // @filename: consume.py | ||
| //// from declare import func | ||
| //// from declare import /*marker2*/func as foobar | ||
| //// | ||
| //// def [|callByName|](): | ||
| //// /*marker3*/func() | ||
| //// def callByAlias(): | ||
| //// foobar() | ||
| //// def [|/*callByNameSelection*/callByName|](): /*marker2*/func() | ||
|
|
||
| // @filename: consume2.py | ||
| //// from declare import func | ||
| //// | ||
| //// def [|callByName2|](): | ||
| //// func() | ||
| //// def [|/*callByName2Selection*/callByName2|](): func() | ||
|
|
||
| { | ||
| const ranges = helper.getRanges(); | ||
| const references = ranges.map((range) => { | ||
| return { path: range.fileName, range: helper.convertPositionRange(range) }; | ||
| }); | ||
| const callByNameSelectionRange = helper.getPositionRange('callByNameSelection'); | ||
| const callByName2SelectionRange = helper.getPositionRange('callByName2Selection'); | ||
| const itemList = [ | ||
| { filePath: references[0].path, range: references[0].range, name: 'callByName' }, | ||
| { filePath: references[1].path, range: references[1].range, name: 'callByName2' }, | ||
| { | ||
| filePath: helper.getMappedFilePath('consume.py'), | ||
|
Collaborator
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. Copilot generated: [verified] |
||
| range: helper.expandPositionRange(callByNameSelectionRange, 4, 10), | ||
| selectionRange: callByNameSelectionRange, | ||
| name: 'callByName', | ||
| }, | ||
| { | ||
| filePath: helper.getMappedFilePath('consume2.py'), | ||
| range: helper.expandPositionRange(callByName2SelectionRange, 4, 10), | ||
| selectionRange: callByName2SelectionRange, | ||
| name: 'callByName2', | ||
| }, | ||
| ]; | ||
|
|
||
| helper.verifyShowCallHierarchyGetIncomingCalls({ | ||
|
|
||
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.
Copilot generated:
Broader behavioral scope than documented.
getDeclarationForPositionis also called byrenameProvider.tsandreportReferences. This change means Rename and Find All References now resolve from thedefkeyword position (previously returnedundefined). This is likely a net improvement, but worth noting in the PR description and considering additional test coverage for rename-from-def scenarios.[verified]