From f477ed8cacc990beb5b194883859d0901227f7e1 Mon Sep 17 00:00:00 2001 From: Let Me Duck You Date: Sat, 5 Jul 2025 12:12:03 +0600 Subject: [PATCH 1/3] feat: Add setting to show all workspace tasks by preference --- packages/types/src/global-settings.ts | 1 + src/core/webview/ClineProvider.ts | 3 ++ .../webview/__tests__/ClineProvider.spec.ts | 1 + src/core/webview/webviewMessageHandler.ts | 5 +++ src/shared/ExtensionMessage.ts | 2 ++ src/shared/WebviewMessage.ts | 1 + .../src/components/history/HistoryView.tsx | 21 ++++++++---- .../history/__tests__/useTaskSearch.spec.tsx | 24 +++++++------- .../src/components/history/useTaskSearch.ts | 11 +++---- .../components/settings/GeneralSettings.tsx | 33 +++++++++++++++++++ .../src/components/settings/SettingsView.tsx | 22 +++++++++++++ .../src/context/ExtensionStateContext.tsx | 5 +++ .../__tests__/ExtensionStateContext.spec.tsx | 3 +- webview-ui/src/i18n/locales/ca/settings.json | 7 ++++ webview-ui/src/i18n/locales/de/settings.json | 7 ++++ webview-ui/src/i18n/locales/en/settings.json | 7 ++++ webview-ui/src/i18n/locales/es/settings.json | 7 ++++ webview-ui/src/i18n/locales/fr/settings.json | 7 ++++ webview-ui/src/i18n/locales/hi/settings.json | 7 ++++ webview-ui/src/i18n/locales/id/settings.json | 7 ++++ webview-ui/src/i18n/locales/it/settings.json | 7 ++++ webview-ui/src/i18n/locales/ja/settings.json | 7 ++++ webview-ui/src/i18n/locales/ko/settings.json | 7 ++++ webview-ui/src/i18n/locales/nl/settings.json | 7 ++++ webview-ui/src/i18n/locales/pl/settings.json | 7 ++++ .../src/i18n/locales/pt-BR/settings.json | 7 ++++ webview-ui/src/i18n/locales/ru/settings.json | 7 ++++ webview-ui/src/i18n/locales/tr/settings.json | 7 ++++ webview-ui/src/i18n/locales/vi/settings.json | 7 ++++ .../src/i18n/locales/zh-CN/settings.json | 7 ++++ .../src/i18n/locales/zh-TW/settings.json | 9 ++++- 31 files changed, 235 insertions(+), 25 deletions(-) create mode 100644 webview-ui/src/components/settings/GeneralSettings.tsx diff --git a/packages/types/src/global-settings.ts b/packages/types/src/global-settings.ts index 6a0dda1cf2..01037dd102 100644 --- a/packages/types/src/global-settings.ts +++ b/packages/types/src/global-settings.ts @@ -27,6 +27,7 @@ export const globalSettingsSchema = z.object({ lastShownAnnouncementId: z.string().optional(), customInstructions: z.string().optional(), taskHistory: z.array(historyItemSchema).optional(), + showAllWorkspacesTasks: z.boolean().optional(), condensingApiConfigId: z.string().optional(), customCondensingPrompt: z.string().optional(), diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index d8aca8fbcb..3b87c44c79 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1408,6 +1408,7 @@ export class ClineProvider profileThresholds, alwaysAllowFollowupQuestions, followupAutoApproveTimeoutMs, + showAllWorkspacesTasks, } = await this.getState() const telemetryKey = process.env.POSTHOG_API_KEY @@ -1520,6 +1521,7 @@ export class ClineProvider hasOpenedModeSelector: this.getGlobalState("hasOpenedModeSelector") ?? false, alwaysAllowFollowupQuestions: alwaysAllowFollowupQuestions ?? false, followupAutoApproveTimeoutMs: followupAutoApproveTimeoutMs ?? 60000, + showAllWorkspacesTasks: showAllWorkspacesTasks ?? false, } } @@ -1672,6 +1674,7 @@ export class ClineProvider codebaseIndexEmbedderModelId: "", }, profileThresholds: stateValues.profileThresholds ?? {}, + showAllWorkspacesTasks: stateValues.showAllWorkspacesTasks ?? false, } } diff --git a/src/core/webview/__tests__/ClineProvider.spec.ts b/src/core/webview/__tests__/ClineProvider.spec.ts index 801c6c4774..c7f45a1e07 100644 --- a/src/core/webview/__tests__/ClineProvider.spec.ts +++ b/src/core/webview/__tests__/ClineProvider.spec.ts @@ -491,6 +491,7 @@ describe("ClineProvider", () => { version: "1.0.0", clineMessages: [], taskHistory: [], + showAllWorkspacesTasks: false, shouldShowAnnouncement: false, apiConfiguration: { apiProvider: "openrouter", diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 1828e8ab5b..5ad2d3afa2 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -2060,5 +2060,10 @@ export const webviewMessageHandler = async ( } break } + + case "showAllWorkspacesTasks": + await updateGlobalState("showAllWorkspacesTasks", message.bool ?? false) + await provider.postStateToWebview() + break } } diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 9db0889c88..ffd8203f33 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -105,6 +105,7 @@ export interface ExtensionMessage { | "shareTaskSuccess" | "codeIndexSettingsSaved" | "codeIndexSecretStatus" + | "showAllWorkspacesTasks" text?: string payload?: any // Add a generic payload for now, can refine later action?: @@ -230,6 +231,7 @@ export type ExtensionState = Pick< version: string clineMessages: ClineMessage[] currentTaskItem?: HistoryItem + showAllWorkspacesTasks: boolean apiConfiguration?: ProviderSettings uriScheme?: string shouldShowAnnouncement: boolean diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index c8a787c1f2..bb1df3e809 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -185,6 +185,7 @@ export interface WebviewMessage { | "checkRulesDirectoryResult" | "saveCodeIndexSettingsAtomic" | "requestCodeIndexSecretStatus" + | "showAllWorkspacesTasks" text?: string tab?: "settings" | "history" | "mcp" | "modes" | "chat" | "marketplace" | "account" disabled?: boolean diff --git a/webview-ui/src/components/history/HistoryView.tsx b/webview-ui/src/components/history/HistoryView.tsx index 2f156d0418..001fcddb25 100644 --- a/webview-ui/src/components/history/HistoryView.tsx +++ b/webview-ui/src/components/history/HistoryView.tsx @@ -1,4 +1,6 @@ import React, { memo, useState } from "react" + +import { vscode } from "@/utils/vscode" import { DeleteTaskDialog } from "./DeleteTaskDialog" import { BatchDeleteTaskDialog } from "./BatchDeleteTaskDialog" import { Virtuoso } from "react-virtuoso" @@ -35,8 +37,8 @@ const HistoryView = ({ onDone }: HistoryViewProps) => { sortOption, setSortOption, setLastNonRelevantSort, - showAllWorkspaces, - setShowAllWorkspaces, + showAllWorkspacesTasks, + setShowAllWorkspacesTasks, } = useTaskSearch() const { t } = useAppTranslation() @@ -129,12 +131,19 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {