Skip to content

Commit

Permalink
Add 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 19, 2024
1 parent 1605896 commit 447f538
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plus/startWork/startWork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,15 @@ 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}`,
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 @@ -566,6 +567,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 447f538

Please sign in to comment.