Skip to content

Commit 2a4289c

Browse files
Copilotalexr00
andcommitted
Fix share permalink markdown to use filename when triggered from tab context menu
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 40691a5 commit 2a4289c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/issues/issueFeatureRegistrar.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,12 @@ ${options?.body ?? ''}\n
16461646
const links = await this.getPermalinkWithError(repositoriesManager, includeRange, true, context);
16471647
const withPermalinks: (PermalinkInfo & { permalink: string })[] = links.filter((link): link is PermalinkInfo & { permalink: string } => !!link.permalink);
16481648

1649-
if (withPermalinks.length === 1) {
1649+
// Only use selection text when the context is from a gutter click (not a vscode.Uri) or editor selection,
1650+
// not when from a file tab context menu (context is just a vscode.Uri).
1651+
const firstContext = context.length > 0 ? context[0] : undefined;
1652+
const contextIsFromTab = firstContext instanceof vscode.Uri;
1653+
1654+
if (withPermalinks.length === 1 && !contextIsFromTab) {
16501655
const selection = this.getMarkdownLinkText(withPermalinks[0].range);
16511656
if (selection) {
16521657
return vscode.env.clipboard.writeText(`[${selection.trim()}](${withPermalinks[0].permalink})`);

0 commit comments

Comments
 (0)