Skip to content

Commit 2f2d47c

Browse files
authored
Adding description and tooltip (#7610)
1 parent f7ac0e5 commit 2f2d47c

6 files changed

Lines changed: 46 additions & 6 deletions

File tree

src/@types/vscode.proposed.chatSessionsProvider.d.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
declare module 'vscode' {
7+
/**
8+
* Represents the status of a chat session.
9+
*/
10+
export enum ChatSessionStatus {
11+
/**
12+
* The chat session failed to complete.
13+
*/
14+
Failed = 0,
15+
16+
/**
17+
* The chat session completed successfully.
18+
*/
19+
Completed = 1,
20+
21+
/**
22+
* The chat session is currently in progress.
23+
*/
24+
InProgress = 2
25+
}
26+
727
/**
828
* Provides a list of information about chat sessions.
929
*/
@@ -46,6 +66,21 @@ declare module 'vscode' {
4666
* An icon for the participant shown in UI.
4767
*/
4868
iconPath?: IconPath;
69+
70+
/**
71+
* An optional description that provides additional context about the chat session.
72+
*/
73+
description?: string | MarkdownString;
74+
75+
/**
76+
* An optional status indicating the current state of the session.
77+
*/
78+
status?: ChatSessionStatus;
79+
80+
/**
81+
* The tooltip text when you hover over this item.
82+
*/
83+
tooltip?: string | MarkdownString;
4984
}
5085

5186
export interface ChatSession {

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ async function deferredActivate(context: vscode.ExtensionContext, showPRControll
413413

414414
Logger.debug('Creating tree view.', 'Activation');
415415

416-
const copilotRemoteAgentManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry);
416+
const copilotRemoteAgentManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry, context);
417417
context.subscriptions.push(copilotRemoteAgentManager);
418418
if (vscode.chat?.registerChatSessionItemProvider) {
419419
const provider = new class implements vscode.ChatSessionContentProvider, vscode.ChatSessionItemProvider {

src/github/copilotRemoteAgent.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { GitHubRemote } from '../common/remote';
1616
import { CODING_AGENT, CODING_AGENT_AUTO_COMMIT_AND_PUSH } from '../common/settingKeys';
1717
import { ITelemetry } from '../common/telemetry';
1818
import { DataUri, toOpenPullRequestWebviewUri } from '../common/uri';
19+
import { dateFromNow } from '../common/utils';
1920
import { getIconForeground, getListErrorForeground, getListWarningForeground, getNotebookStatusSuccessIconForeground } from '../view/theme';
2021
import { IAPISessionLogs, ICopilotRemoteAgentCommandArgs, ICopilotRemoteAgentCommandResponse, OctokitCommon, RemoteAgentResult, RepoInfo } from './common';
2122
import { ChatSessionWithPR, CopilotApi, getCopilotApi, RemoteAgentJobPayload, SessionInfo, SessionSetupStep } from './copilotApi';
@@ -26,6 +27,7 @@ import { CredentialStore } from './credentials';
2627
import { ReposManagerState } from './folderRepositoryManager';
2728
import { GitHubRepository } from './githubRepository';
2829
import { GithubItemStateEnum } from './interface';
30+
import { issueMarkdown } from './markdownUtils';
2931
import { PullRequestModel } from './pullRequestModel';
3032
import { RepositoriesManager } from './repositoriesManager';
3133

@@ -56,7 +58,7 @@ export class CopilotRemoteAgentManager extends Disposable {
5658

5759
private readonly gitOperationsManager: GitOperationsManager;
5860

59-
constructor(private credentialStore: CredentialStore, public repositoriesManager: RepositoriesManager, private telemetry: ITelemetry) {
61+
constructor(private credentialStore: CredentialStore, public repositoriesManager: RepositoriesManager, private telemetry: ITelemetry, private context: vscode.ExtensionContext) {
6062
super();
6163
this.gitOperationsManager = new GitOperationsManager(CopilotRemoteAgentManager.ID);
6264
this._register(this.credentialStore.onDidChangeSessions((e: vscode.AuthenticationSessionsChangeEvent) => {
@@ -658,11 +660,14 @@ export class CopilotRemoteAgentManager extends Disposable {
658660
});
659661
this._register(disposable);
660662
}
663+
const tooltip = await issueMarkdown(session, this.context, this.repositoriesManager);
661664
return {
662665
id: `${session.number}`,
663666
label: session.title || `Session ${session.number}`,
664667
iconPath: this.getIconForSession(status),
665-
pullRequest: session
668+
description: `${dateFromNow(session.createdAt)}`,
669+
pullRequest: session,
670+
tooltip,
666671
};
667672
}));
668673
} catch (error) {

src/test/github/copilotRemoteAgent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('CopilotRemoteAgentManager', function () {
6262

6363
mockRepo = new MockGitHubRepository(remote, credentialStore, telemetry, sinon);
6464

65-
manager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry);
65+
manager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry, context);
6666
Resource.initialize(context);
6767
});
6868

src/test/view/prsTree.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('GitHub Pull Requests view', function () {
5858
telemetry,
5959
);
6060
credentialStore = new CredentialStore(telemetry, context);
61-
copilotManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry);
61+
copilotManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry, context);
6262
provider = new PullRequestsTreeDataProvider(telemetry, context, reposManager, copilotManager);
6363
createPrHelper = new CreatePullRequestHelper();
6464

src/test/view/reviewCommentController.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('ReviewCommentController', function () {
7878
repository = new MockRepository();
7979
repository.addRemote('origin', 'git@github.com:aaa/bbb');
8080
reposManager = new RepositoriesManager(credentialStore, telemetry);
81-
copilotManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry);
81+
copilotManager = new CopilotRemoteAgentManager(credentialStore, reposManager, telemetry, context);
8282
provider = new PullRequestsTreeDataProvider(telemetry, context, reposManager, copilotManager);
8383
const activePrViewCoordinator = new WebviewViewCoordinator(context);
8484
const createPrHelper = new CreatePullRequestHelper();

0 commit comments

Comments
 (0)