дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
Replaces the Pull Requests tool window with a full review workflow on top of gh's authentication. - List with search, quick filters and paging; a tab per pull request and a New Pull Request tab. - Details: commit picker, changes tree with viewed state, CI and reviewer status, merge, close and reopen. - Timeline editor: comments, review threads, reactions and suggested changes. - Review in the diff viewer and, for the checked-out branch, in the editor (review mode). - New generic vcs extension points: registerDiffViewerProvider, lineInlays, reviewGutter, branch widget extensions; new vcs_merge_base and gh_api commands. - CSP: img-src allows https://avatars.githubusercontent.com for avatars. Fixed while testing against a real repository: remotes behind an SSH host alias, mergeability stuck on UNKNOWN, Apply Locally staying disabled after a checkout, relative links navigating the app's page, and review inlays wider than the pane. Co-authored-by: imacross <[email protected]>
42 рядки
1.9 KiB
TypeScript
42 рядки
1.9 KiB
TypeScript
/** Opening the Pull Requests tool window, its tabs and the timeline editor. */
|
|
import { toolWindowService } from "@/workbench/contributions";
|
|
import { pullRequestData, reloadPullRequestData } from "../data/pullRequest";
|
|
import { refreshConnection, useGhRepository } from "../data/repository";
|
|
import { openCreateTab, openPullRequestTab } from "./store";
|
|
import { activeTimelinePullRequest, openTimeline } from "./timelineInput";
|
|
|
|
export const WINDOW = "pullRequests";
|
|
|
|
/** Shows the tool window, checking gh and connecting first when needed; whether it is connected. */
|
|
export async function showPullRequests(focus = true): Promise<boolean> {
|
|
toolWindowService().show(WINDOW, focus);
|
|
if (!useGhRepository.getState().connection) await refreshConnection();
|
|
return !!useGhRepository.getState().connection;
|
|
}
|
|
|
|
/**
|
|
* "View Pull Request" (Enter / double-click in the list): opens or selects the `#N` tab
|
|
* and opens the timeline editor without focusing it. Details loaded before are refreshed
|
|
* with the mergeability (`GHPROpenPullRequestAction`).
|
|
*/
|
|
export async function openPullRequest(number: number, opts: { timeline?: boolean } = {}) {
|
|
if (!(await showPullRequests(false))) return;
|
|
openPullRequestTab(number);
|
|
if (pullRequestData(number, "details").value) {
|
|
void reloadPullRequestData(number, "details").catch(() => undefined);
|
|
void reloadPullRequestData(number, "mergeability").catch(() => undefined);
|
|
}
|
|
if (opts.timeline ?? true) await openTimeline(number, { focus: false });
|
|
}
|
|
|
|
/** "Create Pull Request…": the New Pull Request tab. */
|
|
export async function openCreatePullRequest() {
|
|
if (await showPullRequests()) openCreateTab();
|
|
}
|
|
|
|
/** "Select Opened Pull Request": the tab of the pull request whose timeline is the active editor. */
|
|
export async function selectOpenedPullRequest() {
|
|
const n = activeTimelinePullRequest();
|
|
if (n !== null) await openPullRequest(n, { timeline: false });
|
|
}
|