-
Notifications
You must be signed in to change notification settings - Fork 732
Show webivew before PR is resolved #8402
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
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,7 +25,7 @@ import { isCopilotOnMyBehalf, PullRequestModel } from './pullRequestModel'; | |||||||||
| import { PullRequestReviewCommon, ReviewContext } from './pullRequestReviewCommon'; | ||||||||||
| import { branchPicks, pickEmail, reviewersQuickPick } from './quickPicks'; | ||||||||||
| import { parseReviewers } from './utils'; | ||||||||||
| import { CancelCodingAgentReply, ChangeBaseReply, ChangeReviewersReply, DeleteReviewResult, MergeArguments, MergeResult, PullRequest, ReviewType } from './views'; | ||||||||||
| import { CancelCodingAgentReply, ChangeBaseReply, ChangeReviewersReply, DeleteReviewResult, MergeArguments, MergeResult, PullRequest, ReviewType, UnresolvedIdentity } from './views'; | ||||||||||
| import { debounce } from '../common/async'; | ||||||||||
| import { COPILOT_ACCOUNTS, IComment } from '../common/comment'; | ||||||||||
| import { COPILOT_REVIEWER, COPILOT_REVIEWER_ACCOUNT, COPILOT_SWE_AGENT, copilotEventToStatus, CopilotPRStatus, mostRecentCopilotEvent } from '../common/copilot'; | ||||||||||
|
|
@@ -64,7 +64,8 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode | |||||||||
| telemetry: ITelemetry, | ||||||||||
| extensionUri: vscode.Uri, | ||||||||||
| folderRepositoryManager: FolderRepositoryManager, | ||||||||||
| issue: PullRequestModel, | ||||||||||
| identity: UnresolvedIdentity, | ||||||||||
| issue?: PullRequestModel, | ||||||||||
| toTheSide: boolean = false, | ||||||||||
| preserveFocus: boolean = true, | ||||||||||
| existingPanel?: vscode.WebviewPanel | ||||||||||
|
|
@@ -75,7 +76,7 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode | |||||||||
| "isCopilot" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } | ||||||||||
| } | ||||||||||
| */ | ||||||||||
| telemetry.sendTelemetryEvent('pr.openDescription', { isCopilot: (issue.author.login === COPILOT_SWE_AGENT) ? 'true' : 'false' }); | ||||||||||
| telemetry.sendTelemetryEvent('pr.openDescription', { isCopilot: (issue?.author.login === COPILOT_SWE_AGENT) ? 'true' : 'false' }); | ||||||||||
|
|
||||||||||
| const activeColumn = toTheSide | ||||||||||
| ? vscode.ViewColumn.Beside | ||||||||||
|
|
@@ -88,7 +89,7 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode | |||||||||
| if (PullRequestOverviewPanel.currentPanel) { | ||||||||||
| PullRequestOverviewPanel.currentPanel._panel.reveal(activeColumn, preserveFocus); | ||||||||||
| } else { | ||||||||||
| const title = `Pull Request #${issue.number.toString()}`; | ||||||||||
| const title = `Pull Request #${identity.number.toString()}`; | ||||||||||
| PullRequestOverviewPanel.currentPanel = new PullRequestOverviewPanel( | ||||||||||
| telemetry, | ||||||||||
| extensionUri, | ||||||||||
|
|
@@ -99,7 +100,7 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode | |||||||||
| ); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| await PullRequestOverviewPanel.currentPanel!.update(folderRepositoryManager, issue); | ||||||||||
| await PullRequestOverviewPanel.currentPanel!.updateWithIdentity(folderRepositoryManager, identity, issue); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| protected override set _currentPanel(panel: PullRequestOverviewPanel | undefined) { | ||||||||||
|
|
@@ -379,20 +380,43 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode | |||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public override async update( | ||||||||||
| /** | ||||||||||
| * Override to resolve pull requests instead of issues. | ||||||||||
| */ | ||||||||||
| protected override async resolveModel(identity: UnresolvedIdentity): Promise<PullRequestModel | undefined> { | ||||||||||
| return this._folderRepositoryManager.resolvePullRequest( | ||||||||||
| identity.owner, | ||||||||||
| identity.repo, | ||||||||||
| identity.number | ||||||||||
| ); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| protected override getItemTypeName(): string { | ||||||||||
| return 'Pull Request'; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public override async updateWithIdentity( | ||||||||||
| folderRepositoryManager: FolderRepositoryManager, | ||||||||||
| pullRequestModel: PullRequestModel, | ||||||||||
| identity: UnresolvedIdentity, | ||||||||||
| pullRequestModel?: PullRequestModel, | ||||||||||
| progressLocation?: string | ||||||||||
| ): Promise<void> { | ||||||||||
| const result = super.update(folderRepositoryManager, pullRequestModel, 'pr:github'); | ||||||||||
| if (this._folderRepositoryManager !== folderRepositoryManager) { | ||||||||||
| this.registerPrListeners(); | ||||||||||
| } | ||||||||||
| await super.updateWithIdentity(folderRepositoryManager, identity, pullRequestModel, progressLocation); | ||||||||||
|
|
||||||||||
| await result; | ||||||||||
| // Notify that this PR overview is now active | ||||||||||
| PullRequestOverviewPanel._onVisible.fire(pullRequestModel); | ||||||||||
| PullRequestOverviewPanel._onVisible.fire(this._item); | ||||||||||
|
||||||||||
| PullRequestOverviewPanel._onVisible.fire(this._item); | |
| if (this._item) { | |
| PullRequestOverviewPanel._onVisible.fire(this._item); | |
| } |
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.
The overview restorer still resolves the issue/PR model before showing the webview (lines 58 and 65). If the resolution fails, the panel is disposed without showing anything to the user (lines 59-61, 66-68). Consider updating this to match the pattern used in UriHandler._openIssueWebview, where the webview is shown immediately with the identity and the model is resolved asynchronously. This would provide better user feedback by showing the webview while the model is being loaded.
See below for a potential fix: