Skip to content

Commit

Permalink
Adds hover tooltip on an issue item in Start Work by extending details
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeibbb committed Nov 20, 2024
1 parent 693969d commit 3499119
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/plus/startWork/startWork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,16 @@ export class StartWorkCommand extends QuickCommand<State> {
): StepResultGenerator<StartWorkItem | StartWorkTypeItem> {
const buildIssueItem = (i: StartWorkItem) => {
const buttons = i.item.issue.url ? [OpenOnGitHubQuickInputButton] : [];
const hoverContent = i.item.issue.body ? `${repeatSpaces(200)}\n\n${i.item.issue.body}` : '';
return {
label:
i.item.issue.title.length > 60 ? `${i.item.issue.title.substring(0, 60)}...` : i.item.issue.title,
// description: `${i.repoAndOwner}#${i.id}, by @${i.author}`,
description: `\u00a0 ${
i.item.issue.repository ? `${i.item.issue.repository.owner}/${i.item.issue.repository.repo}#` : ''
}${i.item.issue.id} \u00a0`,
detail: ` ${fromNow(i.item.issue.updatedDate)} by @${i.item.issue.author.name}`,
// The spacing here at the beginning is used to align the description with the title. Otherwise it starts under the avatar icon:
detail: ` ${fromNow(i.item.issue.updatedDate)} by @${i.item.issue.author.name}${hoverContent}`,
iconPath: i.item.issue.author?.avatarUrl != null ? Uri.parse(i.item.issue.author.avatarUrl) : undefined,
item: i,
picked: i.item.issue.id === state.item?.item?.issue.id,
Expand Down Expand Up @@ -567,6 +569,10 @@ function isStartWorkTypeItem(item: unknown): item is StartWorkTypeItem {
return item != null && typeof item === 'object' && 'type' in item;
}

function repeatSpaces(count: number) {
return ' '.repeat(count);
}

export function getStartWorkItemIdHash(item: StartWorkItem) {
return md5(item.item.issue.id);
}

0 comments on commit 3499119

Please sign in to comment.