Skip to content

Commit 53315ca

Browse files
Copilotalexr00
andauthored
Fix Share GitHub Permalink as Markdown to use filename instead of cursor text (#8251)
* Initial plan * Initial plan for fixing permalink markdown link text Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Fix Share GitHub Permalink as Markdown to always use filename Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent d3b9fd3 commit 53315ca

1 file changed

Lines changed: 1 addition & 21 deletions

File tree

src/issues/shareProviders.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -218,27 +218,7 @@ export class GitHubPermalinkAsMarkdownShareProvider extends GitHubPermalinkShare
218218
}
219219

220220
private async getMarkdownLinkText(item: vscode.ShareableItem): Promise<string | undefined> {
221-
const fileName = pathLib.basename(item.resourceUri.path);
222-
223-
if (item.selection) {
224-
const document = await vscode.workspace.openTextDocument(item.resourceUri);
225-
226-
const editorSelection = item.selection.start === item.selection.end
227-
? item.selection
228-
: new vscode.Range(item.selection.start, new vscode.Position(item.selection.start.line + 1, 0));
229-
230-
const selectedText = document.getText(editorSelection);
231-
if (selectedText) {
232-
return selectedText;
233-
}
234-
235-
const wordRange = document.getWordRangeAtPosition(item.selection.start);
236-
if (wordRange) {
237-
return document.getText(wordRange);
238-
}
239-
}
240-
241-
return fileName;
221+
return pathLib.basename(item.resourceUri.path);
242222
}
243223
}
244224

0 commit comments

Comments
 (0)