Skip to content

Commit 3499119

Browse files
committed
Adds hover tooltip on an issue item in Start Work by extending details
(#3743, #3778)
1 parent 693969d commit 3499119

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/plus/startWork/startWork.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,14 +415,16 @@ export class StartWorkCommand extends QuickCommand<State> {
415415
): StepResultGenerator<StartWorkItem | StartWorkTypeItem> {
416416
const buildIssueItem = (i: StartWorkItem) => {
417417
const buttons = i.item.issue.url ? [OpenOnGitHubQuickInputButton] : [];
418+
const hoverContent = i.item.issue.body ? `${repeatSpaces(200)}\n\n${i.item.issue.body}` : '';
418419
return {
419420
label:
420421
i.item.issue.title.length > 60 ? `${i.item.issue.title.substring(0, 60)}...` : i.item.issue.title,
421422
// description: `${i.repoAndOwner}#${i.id}, by @${i.author}`,
422423
description: `\u00a0 ${
423424
i.item.issue.repository ? `${i.item.issue.repository.owner}/${i.item.issue.repository.repo}#` : ''
424425
}${i.item.issue.id} \u00a0`,
425-
detail: ` ${fromNow(i.item.issue.updatedDate)} by @${i.item.issue.author.name}`,
426+
// The spacing here at the beginning is used to align the description with the title. Otherwise it starts under the avatar icon:
427+
detail: ` ${fromNow(i.item.issue.updatedDate)} by @${i.item.issue.author.name}${hoverContent}`,
426428
iconPath: i.item.issue.author?.avatarUrl != null ? Uri.parse(i.item.issue.author.avatarUrl) : undefined,
427429
item: i,
428430
picked: i.item.issue.id === state.item?.item?.issue.id,
@@ -567,6 +569,10 @@ function isStartWorkTypeItem(item: unknown): item is StartWorkTypeItem {
567569
return item != null && typeof item === 'object' && 'type' in item;
568570
}
569571

572+
function repeatSpaces(count: number) {
573+
return ' '.repeat(count);
574+
}
575+
570576
export function getStartWorkItemIdHash(item: StartWorkItem) {
571577
return md5(item.item.issue.id);
572578
}

0 commit comments

Comments
 (0)