Skip to content
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

Don't validate publish state for Continue On #186410

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions extensions/github/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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)) {
Expand Down
6 changes: 4 additions & 2 deletions extensions/github/src/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 => {
Expand Down