Fix Files node parent in pull request changes tree - #8846
Conversation
|
Codex (@codex) review |
There was a problem hiding this comment.
Pull request overview
Fixes a VS Code tree handle resolution issue in the Changes in Pull Request view by aligning FilesCategoryNode’s parent pointer with its rendered container (RepositoryChangesNode), preventing the tree from becoming empty during auto-reveal when node handles aren’t cached.
Changes:
- Parent
FilesCategoryNodetoRepositoryChangesNodeto enableTreeDataProvider.getParent()to reconstruct the rendered chain. - Add a regression test validating the
Filesnode parent relationship used bygetParent()/TreeView.reveal().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/view/treeNodes/repositoryChangesNode.ts | Fixes the Files category node parent pointer to match the rendered tree hierarchy. |
| src/test/view/treeNodes/repositoryChangesNode.test.ts | Adds a regression test to validate the parent chain for the Files node. |
Comments suppressed due to low confidence (1)
src/view/treeNodes/repositoryChangesNode.ts:116
CommitsNodeis still constructed withthis.parent(the root tree provider), soCommitsNode.getParent()returnsundefinedeven though it is rendered underRepositoryChangesNode. This leaves the same VS Code handle-resolution/reveal failure mode in place for the visible Commits category node.
this._filesCategoryNode = new FilesCategoryNode(this, this._reviewModel, this.pullRequestModel);
this._commitsCategoryNode = new CommitsNode(
this.parent,
this._pullRequestManager,
this.pullRequestModel,
|
@microsoft-github-policy-service agree |
Alex Ross (alexr00)
left a comment
There was a problem hiding this comment.
Thank you for the PR!
|
Alex Ross (@alexr00) Christof Marti (@chrmarti) Thank you for reviewing! This is huge help for everyday development! |
|
/AzurePipelines run |
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. |
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (1)
src/test/view/treeNodes/repositoryChangesNode.test.ts:48
- The
RepositoryChangesNodeconstructor registers realvscode.window.onDidChangeActiveTextEditor/TreeView.onDidChangeVisibilitylisteners andrevealActiveEditorInTree()readsthis._reviewModel.localFileChanges. In this test stub,reviewModeldoesn’t definelocalFileChanges(orhasLocalFileChanges), so an editor/visibility event firing during the test can throw and/or causeFilesCategoryNode.getChildren()to hang waiting for changes. Add minimal fields to make the stub safe and deterministic.
const reviewModel = {
onDidChangeLocalFileChanges: () => disposable(),
};
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Low
|
/AzurePipelines run |
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. |
Summary
The Changes in Pull Request view can become empty when file auto-reveal asks VS Code to resolve the visible
Filescategory. The category was reporting the root tree provider as its parent instead of theRepositoryChangesNodethat directly contains it, so VS Code could not reconstruct the rendered parent chain when the node handle was not cached.FilesandCommitscategory nodes to their renderedRepositoryChangesNodecontainer.TreeDataProvider.getParent()andTreeView.reveal().Testing
npm run lintnpm run compilenpm run compile:testManual verification
Follow-up issues
None.
Fixes #8845