Skip to content

Commit

Permalink
refactor(vscode): refactor chat panel webview.
Browse files Browse the repository at this point in the history
  • Loading branch information
icycodes committed Dec 27, 2024
1 parent 362600d commit 07b5316
Show file tree
Hide file tree
Showing 18 changed files with 970 additions and 953 deletions.
4 changes: 4 additions & 0 deletions clients/tabby-chat-panel/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export interface OnLoadedParams {
apiVersion: string
}

// @deprecated
export interface ErrorMessage {
title?: string
content: string
Expand Down Expand Up @@ -219,8 +220,11 @@ export interface ServerApi {
*/
executeCommand: (command: ChatCommand) => Promise<void>

// @deprecated
showError: (error: ErrorMessage) => void
// @deprecated
cleanError: () => void

addRelevantContext: (context: EditorContext) => void
updateTheme: (style: string, themeClass: string) => void
updateActiveSelection: (context: EditorContext | null) => void
Expand Down
16 changes: 6 additions & 10 deletions clients/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,19 +394,13 @@
"command": "tabby.chat.addRelevantContext",
"key": "ctrl+l",
"mac": "cmd+l",
"when": "editorHasSelection && editorTextFocus && tabby.chatEnabled"
"when": "tabby.chatEnabled && editorTextFocus && editorHasSelection && tabby.chatSidePanelVisible"
},
{
"command": "tabby.chatView.focus",
"command": "tabby.chat.toggleFocus",
"key": "ctrl+l",
"mac": "cmd+l",
"when": "!editorHasSelection && editorTextFocus && tabby.chatEnabled"
},
{
"command": "workbench.action.focusActiveEditorGroup",
"key": "ctrl+l",
"mac": "cmd+l",
"when": "!editorFocus && focusedView == 'tabby.chatView'"
"when": "(tabby.chatEnabled && editorTextFocus && !tabby.chatSidePanelVisible) || ((!editorTextFocus || (editorTextFocus && !editorHasSelection)) && tabby.chatSidePanelVisible)"
}
],
"viewsContainers": {
Expand Down Expand Up @@ -449,14 +443,14 @@
"publish-prerelease": "pnpm run vscode:publish-prerelease && pnpm run ovsx:publish-prerelease"
},
"devDependencies": {
"tabby-threads": "workspace:*",
"@types/deep-equal": "^1.0.4",
"@types/diff": "^5.2.1",
"@types/fs-extra": "^11.0.1",
"@types/mocha": "^10.0.1",
"@types/node": "18.x",
"@types/object-hash": "^3.0.0",
"@types/semver": "^7.5.8",
"@types/uuid": "^9.0.0",
"@types/vscode": "^1.82.0",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
Expand All @@ -479,9 +473,11 @@
"semver": "^7.6.0",
"tabby-agent": "workspace:*",
"tabby-chat-panel": "workspace:*",
"tabby-threads": "workspace:*",
"tsc-watch": "^6.2.0",
"tsup": "^8.0.2",
"typescript": "^5.3.2",
"uuid": "^9.0.0",
"vscode-languageclient": "^9.0.1"
}
}
10 changes: 10 additions & 0 deletions clients/vscode/src/ContextVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class ContextVariables {
private chatEditInProgressValue = false;
private chatEditResolvingValue = false;
private inlineCompletionTriggerModeValue: "automatic" | "manual" = "automatic";
private chatSidePanelVisibleValue = false;

constructor(
private readonly client: Client,
Expand Down Expand Up @@ -84,4 +85,13 @@ export class ContextVariables {
commands.executeCommand("setContext", "tabby.inlineCompletionTriggerMode", value);
this.inlineCompletionTriggerModeValue = value;
}

get chatSidePanelVisible(): boolean {
return this.chatSidePanelVisibleValue;
}

set chatSidePanelVisible(value: boolean) {
commands.executeCommand("setContext", "tabby.chatSidePanelVisible", value);
this.chatSidePanelVisibleValue = value;
}
}
67 changes: 0 additions & 67 deletions clients/vscode/src/chat/ChatPanelViewProvider.ts

This file was deleted.

70 changes: 0 additions & 70 deletions clients/vscode/src/chat/ChatSideViewProvider.ts

This file was deleted.

Loading

0 comments on commit 07b5316

Please sign in to comment.