Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.

Commit fb84674

Browse files
authored
Add command to set session title (#4758)
* Add set title command so the title can be set from the sessions app * use the item * do not show in command palette
1 parent 383ce4d commit fb84674

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,6 +2191,11 @@
21912191
"icon": "$(edit)",
21922192
"category": "Copilot CLI"
21932193
},
2194+
{
2195+
"command": "github.copilot.cli.sessions.setTitle",
2196+
"title": "%github.copilot.command.cli.sessions.setTitle%",
2197+
"category": "Copilot CLI"
2198+
},
21942199
{
21952200
"command": "github.copilot.claude.sessions.rename",
21962201
"title": "%github.copilot.command.claude.sessions.rename%",
@@ -5141,6 +5146,10 @@
51415146
"command": "github.copilot.claude.sessions.rename",
51425147
"when": "false"
51435148
},
5149+
{
5150+
"command": "github.copilot.cli.sessions.setTitle",
5151+
"when": "false"
5152+
},
51445153
{
51455154
"command": "github.copilot.cli.sessions.openRepository",
51465155
"when": "false"

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@
432432
"github.copilot.command.deleteAgentSession": "Delete...",
433433
"github.copilot.command.cli.sessions.resumeInTerminal": "Resume in Terminal",
434434
"github.copilot.command.cli.sessions.rename": "Rename...",
435+
"github.copilot.command.cli.sessions.setTitle": "Set Title",
435436
"github.copilot.command.cli.compact.description": "Free up context by compacting the conversation history.",
436437
"github.copilot.command.claude.sessions.rename": "Rename...",
437438
"github.copilot.command.cli.sessions.openRepository": "Open Repository",

src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,17 @@ export function registerCLIChatCommands(
19101910
}
19111911
}
19121912
}));
1913+
disposableStore.add(vscode.commands.registerCommand('github.copilot.cli.sessions.setTitle', async (sessionItem?: vscode.ChatSessionItem, title?: string) => {
1914+
if (!sessionItem?.resource || !title) {
1915+
return;
1916+
}
1917+
const trimmedTitle = title.trim();
1918+
if (trimmedTitle) {
1919+
const id = SessionIdForCLI.parse(sessionItem.resource);
1920+
await copilotCLISessionService.renameSession(id, trimmedTitle);
1921+
await contentProvider.refreshSession({ reason: 'update', sessionId: id });
1922+
}
1923+
}));
19131924

19141925
const createCopilotCLITerminal = async (location: TerminalOpenLocation = 'editor', name?: string, cwd?: string): Promise<void> => {
19151926
// TODO@rebornix should be set by CLI

src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,18 @@ export function registerCLIChatCommands(
19681968
}
19691969
}
19701970
}));
1971+
disposableStore.add(vscode.commands.registerCommand('github.copilot.cli.sessions.setTitle', async (sessionItem?: vscode.ChatSessionItem, title?: string) => {
1972+
if (!sessionItem?.resource || !title) {
1973+
return;
1974+
}
1975+
const trimmedTitle = title.trim();
1976+
if (trimmedTitle) {
1977+
const id = SessionIdForCLI.parse(sessionItem.resource);
1978+
const sessionId = copilotcliSessionItemProvider.untitledSessionIdMapping.get(id) ?? id;
1979+
await copilotCLISessionService.renameSession(sessionId, trimmedTitle);
1980+
copilotcliSessionItemProvider.notifySessionsChange();
1981+
}
1982+
}));
19711983
disposableStore.add(vscode.commands.registerCommand('github.copilot.cli.newSession', async () => {
19721984
await copilotcliSessionItemProvider.createCopilotCLITerminal('editor', l10n.t('Copilot CLI'));
19731985
}));

0 commit comments

Comments
 (0)