diff --git a/extensions/void/package.json b/extensions/void/package.json index 1147f7e0..719bc480 100644 --- a/extensions/void/package.json +++ b/extensions/void/package.json @@ -63,6 +63,16 @@ { "command": "void.discardDiff", "title": "Discard Diff" + }, + { + "command": "void.newChat", + "title": "New chat", + "icon": "$(add)" + }, + { + "command": "void.prevChats", + "title": "Previous chats", + "icon": "$(history)" } ], "viewsContainers": { @@ -94,7 +104,21 @@ "key": "ctrl+k", "mac": "cmd+k" } - ] + ], + "menus": { + "view/title": [ + { + "command": "void.newChat", + "when": "view == 'void.viewnumberone'", + "group": "navigation" + }, + { + "command": "void.prevChats", + "when": "view == 'void.viewnumberone'", + "group": "navigation" + } + ] + } }, "scripts": { "vscode:prepublish": "npm run compile", diff --git a/extensions/void/src/extension.ts b/extensions/void/src/extension.ts index 953e89e4..0580058f 100644 --- a/extensions/void/src/extension.ts +++ b/extensions/void/src/extension.ts @@ -83,6 +83,14 @@ export function activate(context: vscode.ExtensionContext) { webviewProvider.webview.then( webview => { + // top navigation bar commands + context.subscriptions.push(vscode.commands.registerCommand('void.newChat', async () => { + webview.postMessage({ type: 'startNewChat' } satisfies WebviewMessage) + })) + context.subscriptions.push(vscode.commands.registerCommand('void.prevChats', async () => { + webview.postMessage({ type: 'showPreviousChats' } satisfies WebviewMessage) + })) + // when config changes, send it to the sidebar vscode.workspace.onDidChangeConfiguration(e => { if (e.affectsConfiguration('void')) { diff --git a/extensions/void/src/shared_types.ts b/extensions/void/src/shared_types.ts index 563f3ec8..6ea0790e 100644 --- a/extensions/void/src/shared_types.ts +++ b/extensions/void/src/shared_types.ts @@ -36,6 +36,12 @@ type WebviewMessage = ( // sidebar -> editor | { type: 'updateThread', thread: ChatThread } + // editor -> sidebar + | { type: 'startNewChat' } + + // editor -> sidebar + | { type: 'showPreviousChats' } + ) type Command = WebviewMessage['type']