mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
add new toolbar + commands
This commit is contained in:
parent
7269c4e582
commit
30b528402c
3 changed files with 39 additions and 1 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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')) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,12 @@ type WebviewMessage = (
|
|||
// sidebar -> editor
|
||||
| { type: 'updateThread', thread: ChatThread }
|
||||
|
||||
// editor -> sidebar
|
||||
| { type: 'startNewChat' }
|
||||
|
||||
// editor -> sidebar
|
||||
| { type: 'showPreviousChats' }
|
||||
|
||||
)
|
||||
|
||||
type Command = WebviewMessage['type']
|
||||
|
|
|
|||
Loading…
Reference in a new issue