Don't validate publish state for Continue On (#186410)

This commit is contained in:
Joyce Er 2023-06-27 11:50:52 -07:00 committed by GitHub
parent 56ec7658d3
commit b114662b7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -11,7 +11,7 @@ import { LinkContext, getLink, getVscodeDevHost } from './links';
async function copyVscodeDevLink(gitAPI: GitAPI, useSelection: boolean, context: LinkContext, includeRange = true) {
try {
const permalink = await getLink(gitAPI, useSelection, getVscodeDevHost(), 'headlink', context, includeRange);
const permalink = await getLink(gitAPI, useSelection, true, getVscodeDevHost(), 'headlink', context, includeRange);
if (permalink) {
return vscode.env.clipboard.writeText(permalink);
}
@ -24,7 +24,7 @@ async function copyVscodeDevLink(gitAPI: GitAPI, useSelection: boolean, context:
async function openVscodeDevLink(gitAPI: GitAPI): Promise<vscode.Uri | undefined> {
try {
const headlink = await getLink(gitAPI, true, getVscodeDevHost(), 'headlink');
const headlink = await getLink(gitAPI, true, false, getVscodeDevHost(), 'headlink');
return headlink ? vscode.Uri.parse(headlink) : undefined;
} catch (err) {
if (!(err instanceof vscode.CancellationError)) {

View file

@ -129,7 +129,7 @@ export function encodeURIComponentExceptSlashes(path: string) {
return path.split('/').map((segment) => encodeURIComponent(segment)).join('/');
}
export async function getLink(gitAPI: GitAPI, useSelection: boolean, hostPrefix?: string, linkType: 'permalink' | 'headlink' = 'permalink', context?: LinkContext, useRange?: boolean): Promise<string | undefined> {
export async function getLink(gitAPI: GitAPI, useSelection: boolean, shouldEnsurePublished: boolean, hostPrefix?: string, linkType: 'permalink' | 'headlink' = 'permalink', context?: LinkContext, useRange?: boolean): Promise<string | undefined> {
hostPrefix = hostPrefix ?? 'https://github.com';
const fileAndPosition = getFileAndPosition(context);
if (!fileAndPosition) {
@ -143,7 +143,9 @@ export async function getLink(gitAPI: GitAPI, useSelection: boolean, hostPrefix?
return;
}
await ensurePublished(gitRepo, uri);
if (shouldEnsurePublished) {
await ensurePublished(gitRepo, uri);
}
let repo: { owner: string; repo: string } | undefined;
gitRepo.state.remotes.find(remote => {