You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix unpredictable markdown link text when copying permalink from gutter
- Add range field to PermalinkInfo to track the range used for the permalink
- Update getMarkdownLinkText to accept and use the permalink range
- When copying markdown permalink, extract text from the correct line/range
- Fixes issue where right-clicking gutter would use previous selection text
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
@@ -284,12 +285,12 @@ export async function createSinglePermalink(
284
285
): Promise<PermalinkInfo>{
285
286
const{ uri, range }=getFileAndPosition(context,positionInfo);
286
287
if(!uri){
287
-
return{permalink: undefined,error: vscode.l10n.t('No active text editor position to create permalink from.'),originalFile: undefined};
288
+
return{permalink: undefined,error: vscode.l10n.t('No active text editor position to create permalink from.'),originalFile: undefined,range: undefined};
288
289
}
289
290
290
291
constrepository=getRepositoryForFile(gitAPI,uri);
291
292
if(!repository){
292
-
return{permalink: undefined,error: vscode.l10n.t('The current file isn\'t part of repository.'),originalFile: uri};
293
+
return{permalink: undefined,error: vscode.l10n.t('The current file isn\'t part of repository.'),originalFile: uri, range};
293
294
}
294
295
295
296
letcommitHash: string|undefined;
@@ -301,7 +302,7 @@ export async function createSinglePermalink(
@@ -404,11 +406,11 @@ export async function createSingleGitHubLink(
404
406
): Promise<PermalinkInfo>{
405
407
const{ uri, range }=getFileAndPosition(context);
406
408
if(!uri){
407
-
return{permalink: undefined,error: vscode.l10n.t('No active text editor position to create permalink from.'),originalFile: undefined};
409
+
return{permalink: undefined,error: vscode.l10n.t('No active text editor position to create permalink from.'),originalFile: undefined,range: undefined};
0 commit comments