add new toolbar + commands

This commit is contained in:
Aneta Jastrzębska
2024-09-22 11:03:42 +02:00
parent 8a80f0b269
commit 9498c2c57b
3 changed files with 39 additions and 1 deletions
+25 -1
View File
@@ -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",
+8
View File
@@ -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')) {
+6
View File
@@ -36,6 +36,12 @@ type WebviewMessage = (
// sidebar -> editor
| { type: 'updateThread', thread: ChatThread }
// editor -> sidebar
| { type: 'startNewChat' }
// editor -> sidebar
| { type: 'showPreviousChats' }
)
type Command = WebviewMessage['type']