diff --git a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts index 71520fa1ec..aa7001a3d2 100644 --- a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts +++ b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts @@ -105,6 +105,7 @@ declare module 'vscode' { isComplete?: boolean; toolSpecificData?: ChatTerminalToolInvocationData; fromSubAgent?: boolean; + presentation?: 'hidden' | 'hiddenAfterComplete' | undefined; constructor(toolName: string, toolCallId: string, isError?: boolean); } diff --git a/src/@types/vscode.proposed.chatSessionsProvider.d.ts b/src/@types/vscode.proposed.chatSessionsProvider.d.ts index bd4e624430..772fc387b9 100644 --- a/src/@types/vscode.proposed.chatSessionsProvider.d.ts +++ b/src/@types/vscode.proposed.chatSessionsProvider.d.ts @@ -95,6 +95,11 @@ declare module 'vscode' { */ description?: string | MarkdownString; + /** + * An optional badge that provides additional context about the chat session. + */ + badge?: string | MarkdownString; + /** * An optional status indicating the current state of the session. */ diff --git a/src/github/prComment.ts b/src/github/prComment.ts index 12d74662f3..bd7970b75e 100644 --- a/src/github/prComment.ts +++ b/src/github/prComment.ts @@ -217,6 +217,7 @@ export class TemporaryComment extends CommentBase { const SUGGESTION_EXPRESSION = /```suggestion(\u0020*(\r\n|\n))((?[\s\S]*?)(\r\n|\n))?```/; const IMG_EXPRESSION = /.+?)['"].*?>/g; const UUID_EXPRESSION = /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}/; +export const COMMIT_SHA_EXPRESSION = /(? { + // Don't replace if inside code blocks + const beforeMatch = body.substring(0, offset); + const backtickCount = (beforeMatch.match(/`/g)?.length ?? 0); + if (backtickCount % 2 === 1) { + return match; + } + + // Don't replace if already part of a markdown link + if (beforeMatch.endsWith('[') || body.substring(offset + match.length).startsWith(']')) { + return match; + } + + const owner = githubRepository.remote.owner; + const repo = githubRepository.remote.repositoryName; + const commitUrl = `https://${githubRepository.remote.host}/${owner}/${repo}/commit/${match}`; + return `[${shortSha}](${commitUrl})`; + }); + } + private replaceNewlines(body: string) { return body.replace(/(?