diff --git a/src/integrations/workspace/WorkspaceTracker.ts b/src/integrations/workspace/WorkspaceTracker.ts index 49d5708..57c7f7f 100644 --- a/src/integrations/workspace/WorkspaceTracker.ts +++ b/src/integrations/workspace/WorkspaceTracker.ts @@ -50,22 +50,7 @@ class WorkspaceTracker { this.disposables.push(watcher) - // Listen for tab changes this.disposables.push(vscode.window.tabGroups.onDidChangeTabs(() => this.workspaceDidUpdate())) - - // Listen for editor/selection changes - this.disposables.push(vscode.window.onDidChangeActiveTextEditor(() => this.workspaceDidUpdate())) - this.disposables.push(vscode.window.onDidChangeTextEditorSelection(() => this.workspaceDidUpdate())) - - /* - An event that is emitted when a workspace folder is added or removed. - **Note:** this event will not fire if the first workspace folder is added, removed or changed, - because in that case the currently executing extensions (including the one that listens to this - event) will be terminated and restarted so that the (deprecated) `rootPath` property is updated - to point to the first workspace folder. - */ - // In other words, we don't have to worry about the root workspace folder ([0]) changing since the extension will be restarted and our cwd will be updated to reflect the new workspace folder. (We don't care about non root workspace folders, since cline will only be working within the root folder cwd) - // this.disposables.push(vscode.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged.bind(this))) } private getOpenedTabsInfo() { @@ -83,20 +68,6 @@ class WorkspaceTracker { ) } - private getActiveSelectionInfo() { - const editor = vscode.window.activeTextEditor - if (!editor) return null - if (editor.selection.isEmpty) return null - - return { - file: toRelativePath(editor.document.uri.fsPath, cwd || ""), - selection: { - startLine: editor.selection.start.line, - endLine: editor.selection.end.line, - }, - } - } - private workspaceDidUpdate() { if (this.updateTimer) { clearTimeout(this.updateTimer) @@ -112,7 +83,6 @@ class WorkspaceTracker { type: "workspaceUpdated", filePaths: relativeFilePaths, openedTabs: this.getOpenedTabsInfo(), - activeSelection: this.getActiveSelectionInfo(), }) this.updateTimer = null }, 300) // Debounce for 300ms diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 4108937..bee51f6 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -62,13 +62,6 @@ export interface ExtensionMessage { isActive: boolean path?: string }> - activeSelection?: { - file: string - selection: { - startLine: number - endLine: number - } - } | null partialMessage?: ClineMessage glamaModels?: Record openRouterModels?: Record diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index 96a9f9c..6a7c05a 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -50,8 +50,7 @@ const ChatTextArea = forwardRef( }, ref, ) => { - const { filePaths, openedTabs, activeSelection, currentApiConfigName, listApiConfigMeta, customModes } = - useExtensionState() + const { filePaths, openedTabs, currentApiConfigName, listApiConfigMeta, customModes } = useExtensionState() const [gitCommits, setGitCommits] = useState([]) const [showDropdown, setShowDropdown] = useState(false) @@ -158,15 +157,8 @@ const ChatTextArea = forwardRef( })), ] - if (activeSelection) { - items.unshift({ - type: ContextMenuOptionType.OpenedFile, - value: `/${activeSelection.file}:${activeSelection.selection.startLine + 1}-${activeSelection.selection.endLine + 1}`, - }) - } - return items - }, [filePaths, openedTabs, activeSelection]) + }, [filePaths, openedTabs]) useEffect(() => { const handleClickOutside = (event: MouseEvent) => { diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index ecf59a3..47db6bf 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -28,10 +28,6 @@ export interface ExtensionStateContextType extends ExtensionState { mcpServers: McpServer[] filePaths: string[] openedTabs: Array<{ label: string; isActive: boolean; path?: string }> - activeSelection: { - file: string - selection: { startLine: number; endLine: number } - } | null setApiConfiguration: (config: ApiConfiguration) => void setCustomInstructions: (value?: string) => void setAlwaysAllowReadOnly: (value: boolean) => void @@ -122,10 +118,6 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode [glamaDefaultModelId]: glamaDefaultModelInfo, }) const [openedTabs, setOpenedTabs] = useState>([]) - const [activeSelection, setActiveSelection] = useState<{ - file: string - selection: { startLine: number; endLine: number } - } | null>(null) const [openRouterModels, setOpenRouterModels] = useState>({ [openRouterDefaultModelId]: openRouterDefaultModelInfo, }) @@ -188,11 +180,9 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode case "workspaceUpdated": { const paths = message.filePaths ?? [] const tabs = message.openedTabs ?? [] - const selection = message.activeSelection ?? null setFilePaths(paths) setOpenedTabs(tabs) - setActiveSelection(selection) break } case "partialMessage": { @@ -260,7 +250,6 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode mcpServers, filePaths, openedTabs, - activeSelection, soundVolume: state.soundVolume, fuzzyMatchThreshold: state.fuzzyMatchThreshold, writeDelayMs: state.writeDelayMs,