Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Extend removeRefCommand to support call hierarchy items #61

Merged
merged 14 commits into from
Sep 8, 2020
Merged

Extend removeRefCommand to support call hierarchy items #61

merged 14 commits into from
Sep 8, 2020

Conversation

babakks
Copy link
Contributor

@babakks babakks commented Jun 3, 2020

This PR is following this issue on VS Code repo. In short, it was asked to also enable the "remove" button for call hierarchy trees to help users cancel out any items they've reviewed.

The problem with adding this feature was that the implementation of the call hierarchy tree, would resolve outgoing/incoming calls on demand (i.e., when the user clicked to expand a node) and then the children data were not taken hold of in the models.

To fulfill the request, a children property was added to the CallItem model, and move, remove and change events were added to the CallsModel class. The original removeRefCommand of the extension was updated accordingly.

⚠️ To avoid duplicating private method ReferencesModel._del, it's been moved to the outer context and referenced from withinCallsModel, too. Also, to be consistent, ReferencesModel._tail was moved with the former.

babakks added 5 commits June 4, 2020 01:25
Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
@ghost
Copy link

ghost commented Jun 3, 2020

CLA assistant check
All CLA requirements met.

@babakks
Copy link
Contributor Author

babakks commented Aug 3, 2020

@jrieken Is this PR going to be merged for this release?

@jrieken jrieken modified the milestones: June 2020, August 2020 Aug 10, 2020
@jrieken
Copy link
Member

jrieken commented Aug 11, 2020

Sorry this got lost... Will look into it

Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
@babakks babakks requested a review from jrieken August 31, 2020 08:42
src/extension.ts Outdated
@@ -254,6 +254,21 @@ export function activate(context: vscode.ExtensionContext) {
view.reveal(next, { select: true });
}
}
else if (model instanceof CallsModel) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no new line

src/models.ts Outdated
async getCallChildren(call: CallItem): Promise<CallItem[]> {
if (call.children)
return call.children;
call.children = await this.resolveCalls(call);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is resolveCalls now only used from this method? Should it be private async _resolveCalls... then or should they be merged into on?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can be merged into a single method, but that doesn't accommodate SRP. I've changed it to make resolveCalls a private method.

src/provider.ts Outdated
}

getParent(element: CallHierarchyItem) {
return element.parent;
return element ? element.parent : undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? element should never be falsy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. I didn't notice the parameter's type.

@jrieken jrieken self-requested a review September 1, 2020 14:13
Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
Signed-off-by: Babak Khalkhali Shandiz <[email protected]>
Copy link
Member

@jrieken jrieken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jrieken
Copy link
Member

jrieken commented Sep 8, 2020

Thank you!

@jrieken jrieken merged commit 0161cb4 into microsoft:master Sep 8, 2020
@jrieken jrieken modified the milestones: August 2020, September 2020 Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants