|
@ -85,7 +85,7 @@ export namespace Hovers { |
|
|
return undefined; |
|
|
return undefined; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
message = `[\`Changes\`](${DiffWithCommand.getMarkdownCommandArgs({ |
|
|
|
|
|
|
|
|
message = `[$(compare-changes) Changes](${DiffWithCommand.getMarkdownCommandArgs({ |
|
|
lhs: { |
|
|
lhs: { |
|
|
sha: diffUris.previous.sha || '', |
|
|
sha: diffUris.previous.sha || '', |
|
|
uri: diffUris.previous.documentUri() |
|
|
uri: diffUris.previous.documentUri() |
|
@ -105,9 +105,9 @@ export namespace Hovers { |
|
|
working: 'Working Tree' |
|
|
working: 'Working Tree' |
|
|
} |
|
|
} |
|
|
})}_`
|
|
|
})}_`
|
|
|
: `[\`${GitService.shortenSha( |
|
|
|
|
|
|
|
|
: `[$(git-commit) ${GitService.shortenSha( |
|
|
diffUris.previous.sha || '' |
|
|
diffUris.previous.sha || '' |
|
|
)}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs( |
|
|
|
|
|
|
|
|
)}](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs( |
|
|
diffUris.previous.sha || '' |
|
|
diffUris.previous.sha || '' |
|
|
)} "Show Commit Details")`;
|
|
|
)} "Show Commit Details")`;
|
|
|
|
|
|
|
|
@ -118,26 +118,29 @@ export namespace Hovers { |
|
|
working: 'Working Tree' |
|
|
working: 'Working Tree' |
|
|
} |
|
|
} |
|
|
})}_`
|
|
|
})}_`
|
|
|
: `[\`${GitService.shortenSha( |
|
|
|
|
|
|
|
|
: `[$(git-commit) ${GitService.shortenSha( |
|
|
diffUris.current.sha || '' |
|
|
diffUris.current.sha || '' |
|
|
)}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs( |
|
|
|
|
|
|
|
|
)}](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs( |
|
|
diffUris.current.sha || '' |
|
|
diffUris.current.sha || '' |
|
|
)} "Show Commit Details")`;
|
|
|
)} "Show Commit Details")`;
|
|
|
} else { |
|
|
} else { |
|
|
message = `[\`Changes\`](${DiffWithCommand.getMarkdownCommandArgs(commit, editorLine)} "Open Changes")`; |
|
|
|
|
|
|
|
|
message = `[$(compare-changes) Changes](${DiffWithCommand.getMarkdownCommandArgs( |
|
|
|
|
|
commit, |
|
|
|
|
|
editorLine |
|
|
|
|
|
)} "Open Changes")`;
|
|
|
|
|
|
|
|
|
previous = `[\`${commit.previousShortSha}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs( |
|
|
|
|
|
commit.previousSha |
|
|
|
|
|
)} "Show Commit Details")`;
|
|
|
|
|
|
|
|
|
previous = `[$(git-commit) ${ |
|
|
|
|
|
commit.previousShortSha |
|
|
|
|
|
}](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs(commit.previousSha)} "Show Commit Details")`;
|
|
|
|
|
|
|
|
|
current = `[\`${commit.shortSha}\`](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs( |
|
|
|
|
|
|
|
|
current = `[$(git-commit) ${commit.shortSha}](${ShowQuickCommitDetailsCommand.getMarkdownCommandArgs( |
|
|
commit.sha |
|
|
commit.sha |
|
|
)} "Show Commit Details")`;
|
|
|
)} "Show Commit Details")`;
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
message += ` ${GlyphChars.Dash} ${previous} ${GlyphChars.ArrowLeftRightLong} ${current}\n${diff}`; |
|
|
message += ` ${GlyphChars.Dash} ${previous} ${GlyphChars.ArrowLeftRightLong} ${current}\n${diff}`; |
|
|
|
|
|
|
|
|
const markdown = new MarkdownString(message); |
|
|
|
|
|
|
|
|
const markdown = new MarkdownString(message, true); |
|
|
markdown.isTrusted = true; |
|
|
markdown.isTrusted = true; |
|
|
return markdown; |
|
|
return markdown; |
|
|
} |
|
|
} |
|
@ -155,16 +158,16 @@ export namespace Hovers { |
|
|
|
|
|
|
|
|
const remotes = await Container.git.getRemotes(commit.repoPath, { sort: true }); |
|
|
const remotes = await Container.git.getRemotes(commit.repoPath, { sort: true }); |
|
|
|
|
|
|
|
|
const [previousLineDiffUris, autolinkedIssues, pr, presence] = await Promise.all([ |
|
|
|
|
|
|
|
|
const [previousLineDiffUris, autolinkedIssuesOrPullRequests, pr, presence] = await Promise.all([ |
|
|
commit.isUncommitted ? commit.getPreviousLineDiffUris(uri, editorLine, uri.sha) : undefined, |
|
|
commit.isUncommitted ? commit.getPreviousLineDiffUris(uri, editorLine, uri.sha) : undefined, |
|
|
getAutoLinkedIssues(commit.message, remotes), |
|
|
|
|
|
|
|
|
getAutoLinkedIssuesOrPullRequests(commit.message, remotes), |
|
|
getPullRequestForCommit(commit.ref, remotes), |
|
|
getPullRequestForCommit(commit.ref, remotes), |
|
|
Container.vsls.maybeGetPresence(commit.email).catch(reason => undefined) |
|
|
Container.vsls.maybeGetPresence(commit.email).catch(reason => undefined) |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
const details = CommitFormatter.fromTemplate(Container.config.hovers.detailsMarkdownFormat, commit, { |
|
|
const details = CommitFormatter.fromTemplate(Container.config.hovers.detailsMarkdownFormat, commit, { |
|
|
annotationType: annotationType, |
|
|
annotationType: annotationType, |
|
|
autolinkedIssues: autolinkedIssues, |
|
|
|
|
|
|
|
|
autolinkedIssuesOrPullRequests: autolinkedIssuesOrPullRequests, |
|
|
dateFormat: dateFormat, |
|
|
dateFormat: dateFormat, |
|
|
line: editorLine, |
|
|
line: editorLine, |
|
|
markdown: true, |
|
|
markdown: true, |
|
@ -174,7 +177,7 @@ export namespace Hovers { |
|
|
remotes: remotes |
|
|
remotes: remotes |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const markdown = new MarkdownString(details); |
|
|
|
|
|
|
|
|
const markdown = new MarkdownString(details, true); |
|
|
markdown.isTrusted = true; |
|
|
markdown.isTrusted = true; |
|
|
return markdown; |
|
|
return markdown; |
|
|
} |
|
|
} |
|
@ -189,7 +192,7 @@ export namespace Hovers { |
|
|
}\n\`\`\``; |
|
|
}\n\`\`\``; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getAutoLinkedIssues(message: string, remotes: GitRemote[]) { |
|
|
|
|
|
|
|
|
async function getAutoLinkedIssuesOrPullRequests(message: string, remotes: GitRemote[]) { |
|
|
const cc = Logger.getNewCorrelationContext('Hovers.getAutoLinkedIssues'); |
|
|
const cc = Logger.getNewCorrelationContext('Hovers.getAutoLinkedIssues'); |
|
|
Logger.debug(cc, `${GlyphChars.Dash} message=<message>`); |
|
|
Logger.debug(cc, `${GlyphChars.Dash} message=<message>`); |
|
|
|
|
|
|
|
@ -216,11 +219,13 @@ export namespace Hovers { |
|
|
const timeout = 250; |
|
|
const timeout = 250; |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
const autolinkedIssues = await Container.autolinks.getIssueLinks(message, remote, { timeout: timeout }); |
|
|
|
|
|
|
|
|
const autolinks = await Container.autolinks.getIssueOrPullRequestLinks(message, remote, { |
|
|
|
|
|
timeout: timeout |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
if (autolinkedIssues !== undefined && (Logger.level === TraceLevel.Debug || Logger.isDebugging)) { |
|
|
|
|
|
|
|
|
if (autolinks !== undefined && (Logger.level === TraceLevel.Debug || Logger.isDebugging)) { |
|
|
const timeouts = [ |
|
|
const timeouts = [ |
|
|
...Iterables.filterMap(autolinkedIssues.values(), issue => |
|
|
|
|
|
|
|
|
...Iterables.filterMap(autolinks.values(), issue => |
|
|
issue instanceof Promises.CancellationError ? issue.promise : undefined |
|
|
issue instanceof Promises.CancellationError ? issue.promise : undefined |
|
|
) |
|
|
) |
|
|
]; |
|
|
]; |
|
@ -229,20 +234,20 @@ export namespace Hovers { |
|
|
if (timeouts.length !== 0) { |
|
|
if (timeouts.length !== 0) { |
|
|
Logger.debug( |
|
|
Logger.debug( |
|
|
cc, |
|
|
cc, |
|
|
`timed out ${GlyphChars.Dash} issue queries (${ |
|
|
|
|
|
|
|
|
`timed out ${GlyphChars.Dash} issue/pr queries (${ |
|
|
timeouts.length |
|
|
timeouts.length |
|
|
}) took too long (over ${timeout} ms) ${GlyphChars.Dot} ${Strings.getDurationMilliseconds( |
|
|
}) took too long (over ${timeout} ms) ${GlyphChars.Dot} ${Strings.getDurationMilliseconds( |
|
|
start |
|
|
start |
|
|
)} ms`
|
|
|
)} ms`
|
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return autolinkedIssues; |
|
|
|
|
|
|
|
|
return autolinks; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Logger.debug(cc, `completed ${GlyphChars.Dot} ${Strings.getDurationMilliseconds(start)} ms`); |
|
|
Logger.debug(cc, `completed ${GlyphChars.Dot} ${Strings.getDurationMilliseconds(start)} ms`); |
|
|
|
|
|
|
|
|
return autolinkedIssues; |
|
|
|
|
|
|
|
|
return autolinks; |
|
|
} catch (ex) { |
|
|
} catch (ex) { |
|
|
Logger.error(ex, cc, `failed ${GlyphChars.Dot} ${Strings.getDurationMilliseconds(start)} ms`); |
|
|
Logger.error(ex, cc, `failed ${GlyphChars.Dot} ${Strings.getDurationMilliseconds(start)} ms`); |
|
|
|
|
|
|
|
|