mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
Rename SidebarProvider to ClaudeDevProvider
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
"claude-dev-ActivityBar": [
|
||||
{
|
||||
"type": "webview",
|
||||
"id": "claude-dev.SidebarProvider",
|
||||
"id": "claude-dev.ClaudeDevProvider",
|
||||
"name": ""
|
||||
}
|
||||
]
|
||||
@@ -67,17 +67,17 @@
|
||||
{
|
||||
"command": "claude-dev.plusButtonTapped",
|
||||
"group": "navigation",
|
||||
"when": "view == claude-dev.SidebarProvider"
|
||||
"when": "view == claude-dev.ClaudeDevProvider"
|
||||
},
|
||||
{
|
||||
"command": "claude-dev.popoutButtonTapped",
|
||||
"group": "navigation",
|
||||
"when": "view == claude-dev.SidebarProvider"
|
||||
"when": "view == claude-dev.ClaudeDevProvider"
|
||||
},
|
||||
{
|
||||
"command": "claude-dev.settingsButtonTapped",
|
||||
"group": "navigation",
|
||||
"when": "view == claude-dev.SidebarProvider"
|
||||
"when": "view == claude-dev.ClaudeDevProvider"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ import * as path from "path"
|
||||
import { serializeError } from "serialize-error"
|
||||
import { DEFAULT_MAX_REQUESTS_PER_TASK } from "./shared/Constants"
|
||||
import { Tool, ToolName } from "./shared/Tool"
|
||||
import { ClaudeAsk, ClaudeSay, ClaudeSayTool, ExtensionMessage } from "./shared/ExtensionMessage"
|
||||
import { ClaudeAsk, ClaudeSay, ClaudeSayTool } from "./shared/ExtensionMessage"
|
||||
import * as vscode from "vscode"
|
||||
import pWaitFor from "p-wait-for"
|
||||
import { ClaudeAskResponse } from "./shared/WebviewMessage"
|
||||
import { SidebarProvider } from "./providers/SidebarProvider"
|
||||
import { ClaudeDevProvider } from "./providers/SidebarProvider"
|
||||
import { ClaudeRequestResult } from "./shared/ClaudeRequestResult"
|
||||
import os from "os"
|
||||
|
||||
@@ -183,10 +183,10 @@ export class ClaudeDev {
|
||||
private requestCount = 0
|
||||
private askResponse?: ClaudeAskResponse
|
||||
private askResponseText?: string
|
||||
private providerRef: WeakRef<SidebarProvider>
|
||||
private providerRef: WeakRef<ClaudeDevProvider>
|
||||
abort: boolean = false
|
||||
|
||||
constructor(provider: SidebarProvider, task: string, apiKey: string, maxRequestsPerTask?: number) {
|
||||
constructor(provider: ClaudeDevProvider, task: string, apiKey: string, maxRequestsPerTask?: number) {
|
||||
this.providerRef = new WeakRef(provider)
|
||||
this.client = new Anthropic({ apiKey })
|
||||
this.maxRequestsPerTask = maxRequestsPerTask ?? DEFAULT_MAX_REQUESTS_PER_TASK
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// The module 'vscode' contains the VS Code extensibility API
|
||||
// Import the module and reference it with the alias vscode in your code below
|
||||
import * as vscode from "vscode"
|
||||
import { SidebarProvider } from "./providers/SidebarProvider"
|
||||
import { ClaudeDevProvider } from "./providers/SidebarProvider"
|
||||
|
||||
/*
|
||||
Built using https://github.com/microsoft/vscode-webview-ui-toolkit
|
||||
@@ -29,10 +29,10 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
// })
|
||||
// context.subscriptions.push(disposable)
|
||||
|
||||
const sidebarProvider = new SidebarProvider(context)
|
||||
const sidebarProvider = new ClaudeDevProvider(context)
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.window.registerWebviewViewProvider(SidebarProvider.viewType, sidebarProvider, {
|
||||
vscode.window.registerWebviewViewProvider(ClaudeDevProvider.viewType, sidebarProvider, {
|
||||
webviewOptions: { retainContextWhenHidden: true },
|
||||
})
|
||||
)
|
||||
@@ -51,10 +51,10 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
vscode.commands.registerCommand("claude-dev.popoutButtonTapped", async () => {
|
||||
// (this example uses webviewProvider activation event which is necessary to deserialize cached webview, but since we use retainContextWhenHidden, we don't need to use that event)
|
||||
// https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/src/extension.ts
|
||||
const editorProvider = new SidebarProvider(context)
|
||||
const tabProvider = new ClaudeDevProvider(context)
|
||||
const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined
|
||||
const panel = vscode.window.createWebviewPanel(
|
||||
SidebarProvider.viewType,
|
||||
ClaudeDevProvider.viewType,
|
||||
"Claude Dev",
|
||||
column || vscode.ViewColumn.One,
|
||||
{
|
||||
@@ -66,7 +66,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
// TODO: use better svg icon with light and dark variants (see https://stackoverflow.com/questions/58365687/vscode-extension-iconpath)
|
||||
panel.iconPath = vscode.Uri.joinPath(context.extensionUri, "icon.png")
|
||||
|
||||
editorProvider.resolveWebviewView(panel)
|
||||
tabProvider.resolveWebviewView(panel)
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ type ExtensionSecretKey = "apiKey"
|
||||
type ExtensionGlobalStateKey = "didOpenOnce" | "maxRequestsPerTask"
|
||||
type ExtensionWorkspaceStateKey = "claudeMessages"
|
||||
|
||||
export class SidebarProvider implements vscode.WebviewViewProvider {
|
||||
public static readonly viewType = "claude-dev.SidebarProvider"
|
||||
export class ClaudeDevProvider implements vscode.WebviewViewProvider {
|
||||
public static readonly viewType = "claude-dev.ClaudeDevProvider"
|
||||
private disposables: vscode.Disposable[] = []
|
||||
private view?: vscode.WebviewView | vscode.WebviewPanel
|
||||
private claudeDev?: ClaudeDev
|
||||
@@ -310,14 +310,14 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
|
||||
Now that we use retainContextWhenHidden, we don't have to store a cache of claude messages in the user's workspace state. Instead, we can just use this provider instance to keep track of the messages. However in the future when we implement Task history
|
||||
we will need to store the messages and conversation history in the workspace state.
|
||||
|
||||
- We have to be careful of what state is shared between SidebarProvider instances since there could be multiple instances of the extension running at once. For example when we cached claude messages using the same key, two instances of the extension could end up using the same key and overwriting each other's messages.
|
||||
- We have to be careful of what state is shared between ClaudeDevProvider instances since there could be multiple instances of the extension running at once. For example when we cached claude messages using the same key, two instances of the extension could end up using the same key and overwriting each other's messages.
|
||||
- Some state does need to be shared between the instances, i.e. the API key--however there doesn't seem to be a good way to notfy the other instances that the API key has changed.
|
||||
- For the interim we'll use a local variable to cache the claude messages that lives as long as the SidebarProvider (so a property of this class), but in the future we'll implement a more robust solution that uses workspace state so that the user can look at task history and pick up on old conversations.
|
||||
- For the interim we'll use a local variable to cache the claude messages that lives as long as the ClaudeDevProvider (so a property of this class), but in the future we'll implement a more robust solution that uses workspace state so that the user can look at task history and pick up on old conversations.
|
||||
|
||||
In the future we'll cache these messages in the workspace state alongside the conversation history in order to reduce memory footprint in long conversations.
|
||||
*/
|
||||
|
||||
// We need to use a unique identifier for each SidebarProvider instance's message cache since we could be running several instances of the extension outside of just the sidebar i.e. in editor panels.
|
||||
// We need to use a unique identifier for each ClaudeDevProvider instance's message cache since we could be running several instances of the extension outside of just the sidebar i.e. in editor panels.
|
||||
// private startTsIdentifier = Date.now()
|
||||
|
||||
// getClaudeMessagesWorkspaceStateKey() {
|
||||
|
||||
Reference in New Issue
Block a user