Skip to content

Commit e068d52

Browse files
committed
Implement configuration and UI support for controlling the behavior of the "Clear Checks" action in the Workspace view
1 parent 6093e92 commit e068d52

8 files changed

Lines changed: 109 additions & 6 deletions

File tree

‎packages/vscode/package.json‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
},
158158
{
159159
"command": "codeWebChat.clearChecks",
160-
"title": "Clear All Checks",
160+
"title": "Clear Checks",
161161
"category": "Code Web Chat",
162162
"icon": "$(clear-all)"
163163
},
@@ -175,7 +175,7 @@
175175
},
176176
{
177177
"command": "codeWebChat.clearChecksOpenEditors",
178-
"title": "Clear All Checks",
178+
"title": "Clear Checks",
179179
"category": "Code Web Chat",
180180
"icon": "$(clear-all)"
181181
},
@@ -542,6 +542,15 @@
542542
"default": 60000,
543543
"description": "Threshold for the context size to show a warning."
544544
},
545+
"codeWebChat.clearChecksInWorkspace": {
546+
"type": "string",
547+
"enum": [
548+
"ignore-open-editors",
549+
"uncheck-all"
550+
],
551+
"default": "ignore-open-editors",
552+
"description": "Controls the behavior of the 'Clear Checks' action in the Workspace view."
553+
},
545554
"codeWebChat.ignorePatterns": {
546555
"type": "array",
547556
"description": "List of glob patterns to ignore files and folders in the context.",

‎packages/vscode/src/views/settings/backend/settings-provider.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,24 @@ export class SettingsProvider {
222222
case 'UPDATE_CONTEXT_SIZE_WARNING_THRESHOLD':
223223
await handle_update_context_size_warning_threshold(this, message)
224224
break
225+
case 'GET_CLEAR_CHECKS_IN_WORKSPACE': {
226+
const config = vscode.workspace.getConfiguration('codeWebChat')
227+
const value = config.get<'ignore-open-editors' | 'uncheck-all'>(
228+
'clearChecksInWorkspace',
229+
'ignore-open-editors'
230+
)
231+
this.postMessage({ command: 'CLEAR_CHECKS_IN_WORKSPACE', value })
232+
break
233+
}
234+
case 'UPDATE_CLEAR_CHECKS_IN_WORKSPACE':
235+
await vscode.workspace
236+
.getConfiguration('codeWebChat')
237+
.update(
238+
'clearChecksInWorkspace',
239+
message.value,
240+
vscode.ConfigurationTarget.Global
241+
)
242+
break
225243
case 'GET_GEMINI_USER_ID': {
226244
const config = vscode.workspace.getConfiguration('codeWebChat')
227245
const geminiUserId =
@@ -261,6 +279,16 @@ export class SettingsProvider {
261279
void handle_get_edit_context_configurations(this)
262280
void handle_get_intelligent_update_configurations(this)
263281
void handle_get_context_size_warning_threshold(this)
282+
{
283+
const config = vscode.workspace.getConfiguration('codeWebChat')
284+
this.postMessage({
285+
command: 'CLEAR_CHECKS_IN_WORKSPACE',
286+
value:
287+
config.get<'ignore-open-editors' | 'uncheck-all'>(
288+
'clearChecksInWorkspace'
289+
) ?? 'ignore-open-editors'
290+
})
291+
}
264292
{
265293
const config = vscode.workspace.getConfiguration('codeWebChat')
266294
this.postMessage({

‎packages/vscode/src/views/settings/frontend/Home/Home.tsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type Props = {
6060
commit_message_instructions: string
6161
context_size_warning_threshold: number
6262
gemini_user_id: number | null
63+
clear_checks_in_workspace: 'ignore-open-editors' | 'uncheck-all'
6364

6465
// handlers
6566
set_providers: (providers: ProviderForClient[]) => void
@@ -70,6 +71,9 @@ type Props = {
7071
on_context_size_warning_threshold_change: (threshold: number) => void
7172
on_commit_instructions_change: (instructions: string) => void
7273
on_gemini_user_id_change: (id: number | null) => void
74+
on_clear_checks_in_workspace_change: (
75+
value: 'ignore-open-editors' | 'uncheck-all'
76+
) => void
7377
on_open_editor_settings: () => void
7478
on_add_provider: () => void
7579
on_delete_provider: (provider_name: string) => void
@@ -233,6 +237,10 @@ export const Home: React.FC<Props> = (props) => {
233237
on_context_size_warning_threshold_change={
234238
props.on_context_size_warning_threshold_change
235239
}
240+
clear_checks_in_workspace={props.clear_checks_in_workspace}
241+
on_clear_checks_in_workspace_change={
242+
props.on_clear_checks_in_workspace_change
243+
}
236244
on_open_editor_settings={props.on_open_editor_settings}
237245
on_stuck_change={general_on_stuck_change}
238246
/>

‎packages/vscode/src/views/settings/frontend/Home/sections/GeneralSection.tsx‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { TextButton } from '@ui/components/editor/settings/TextButton'
66

77
type Props = {
88
context_size_warning_threshold: number
9+
clear_checks_in_workspace: 'ignore-open-editors' | 'uncheck-all'
910
on_context_size_warning_threshold_change: (threshold: number) => void
11+
on_clear_checks_in_workspace_change: (
12+
value: 'ignore-open-editors' | 'uncheck-all'
13+
) => void
1014
on_open_editor_settings: () => void
1115
on_stuck_change: (is_stuck: boolean) => void
1216
}
@@ -60,7 +64,6 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
6064
<Item
6165
title="Context Size Warning Threshold"
6266
description="Set the token count threshold for showing a warning about large context sizes."
63-
slot_placement="below"
6467
slot={
6568
<Input
6669
type="number"
@@ -70,6 +73,23 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
7073
/>
7174
}
7275
/>
76+
<Item
77+
title="Clear Checks in Workspace"
78+
description="Behavior of the 'Clear Checks' command in the Workspace view."
79+
slot={
80+
<select
81+
value={props.clear_checks_in_workspace}
82+
onChange={(e) =>
83+
props.on_clear_checks_in_workspace_change(
84+
e.target.value as 'ignore-open-editors' | 'uncheck-all'
85+
)
86+
}
87+
>
88+
<option value="ignore-open-editors">Ignore Open Editors</option>
89+
<option value="uncheck-all">Uncheck All</option>
90+
</select>
91+
}
92+
/>
7393
</Section>
7494
)
7595
}

‎packages/vscode/src/views/settings/frontend/Home/sections/PresetsSection.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export const PresetsSection = forwardRef<HTMLDivElement, Props>(
5757
<Item
5858
title="Gemini User ID"
5959
description="Run Gemini chatbot as non-default user. Check URL for ID. For example: https://gemini.google.com/u/2/app -> ID is 2."
60-
slot_placement="below"
6160
slot={
6261
<Input
6362
type="number"

‎packages/vscode/src/views/settings/frontend/Settings.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export const Settings = () => {
2929
settings_hook.intelligent_update_configs !== undefined &&
3030
settings_hook.commit_message_instructions !== undefined &&
3131
settings_hook.context_size_warning_threshold !== undefined &&
32-
settings_hook.gemini_user_id !== undefined
32+
settings_hook.gemini_user_id !== undefined &&
33+
settings_hook.clear_checks_in_workspace !== undefined
3334
)
3435
}, [settings_hook])
3536

@@ -59,6 +60,7 @@ export const Settings = () => {
5960
}
6061
commit_message_instructions={settings_hook.commit_message_instructions!}
6162
gemini_user_id={settings_hook.gemini_user_id!}
63+
clear_checks_in_workspace={settings_hook.clear_checks_in_workspace!}
6264
set_providers={settings_hook.set_providers}
6365
set_code_completions_configs={settings_hook.set_code_completions_configs}
6466
set_commit_messages_configs={settings_hook.set_commit_messages_configs}
@@ -72,6 +74,9 @@ export const Settings = () => {
7274
on_commit_instructions_change={
7375
settings_hook.handle_commit_instructions_change
7476
}
77+
on_clear_checks_in_workspace_change={
78+
settings_hook.handle_clear_checks_in_workspace_change
79+
}
7580
on_gemini_user_id_change={settings_hook.handle_gemini_user_id_change}
7681
on_open_editor_settings={settings_hook.handle_open_editor_settings}
7782
on_reorder_providers={settings_hook.handle_reorder_providers}

‎packages/vscode/src/views/settings/frontend/hooks/use-settings.ts‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export const use_settings = (vscode: any) => {
3030
const [gemini_user_id, set_gemini_user_id] = useState<
3131
number | null | undefined
3232
>(undefined)
33+
const [clear_checks_in_workspace, set_clear_checks_in_workspace] = useState<
34+
'ignore-open-editors' | 'uncheck-all' | undefined
35+
>(undefined)
3336

3437
useEffect(() => {
3538
// Request initial data
@@ -41,6 +44,7 @@ export const use_settings = (vscode: any) => {
4144
post_message(vscode, { command: 'GET_COMMIT_MESSAGE_INSTRUCTIONS' })
4245
post_message(vscode, { command: 'GET_CONTEXT_SIZE_WARNING_THRESHOLD' })
4346
post_message(vscode, { command: 'GET_GEMINI_USER_ID' })
47+
post_message(vscode, { command: 'GET_CLEAR_CHECKS_IN_WORKSPACE' })
4448
}, [vscode])
4549

4650
useEffect(() => {
@@ -71,6 +75,9 @@ export const use_settings = (vscode: any) => {
7175
case 'GEMINI_USER_ID':
7276
set_gemini_user_id(message.geminiUserId)
7377
break
78+
case 'CLEAR_CHECKS_IN_WORKSPACE':
79+
set_clear_checks_in_workspace(message.value)
80+
break
7481
}
7582
}
7683

@@ -187,6 +194,14 @@ export const use_settings = (vscode: any) => {
187194
geminiUserId
188195
})
189196

197+
const handle_clear_checks_in_workspace_change = (
198+
value: 'ignore-open-editors' | 'uncheck-all'
199+
) =>
200+
post_message(vscode, {
201+
command: 'UPDATE_CLEAR_CHECKS_IN_WORKSPACE',
202+
value
203+
})
204+
190205
return {
191206
providers,
192207
set_providers,
@@ -201,6 +216,7 @@ export const use_settings = (vscode: any) => {
201216
commit_message_instructions,
202217
context_size_warning_threshold,
203218
gemini_user_id,
219+
clear_checks_in_workspace,
204220
handle_reorder_providers,
205221
handle_add_provider,
206222
handle_delete_provider,
@@ -215,6 +231,7 @@ export const use_settings = (vscode: any) => {
215231
handle_commit_instructions_change,
216232
handle_open_editor_settings,
217233
handle_context_size_warning_threshold_change,
218-
handle_gemini_user_id_change
234+
handle_gemini_user_id_change,
235+
handle_clear_checks_in_workspace_change
219236
}
220237
}

‎packages/vscode/src/views/settings/types/messages.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ export interface UpdateGeminiUserIdMessage {
185185
geminiUserId: number | null
186186
}
187187

188+
export interface GetClearChecksInWorkspaceMessage {
189+
command: 'GET_CLEAR_CHECKS_IN_WORKSPACE'
190+
}
191+
192+
export interface UpdateClearChecksInWorkspaceMessage {
193+
command: 'UPDATE_CLEAR_CHECKS_IN_WORKSPACE'
194+
value: 'ignore-open-editors' | 'uncheck-all'
195+
}
196+
188197
export type FrontendMessage =
189198
| GetModelProvidersMessage
190199
| ReorderModelProvidersMessage
@@ -222,6 +231,8 @@ export type FrontendMessage =
222231
| UpdateContextSizeWarningThresholdMessage
223232
| GetGeminiUserIdMessage
224233
| UpdateGeminiUserIdMessage
234+
| GetClearChecksInWorkspaceMessage
235+
| UpdateClearChecksInWorkspaceMessage
225236
| OpenEditorSettingsMessage
226237

227238
// === FROM BACKEND TO FRONTEND ===
@@ -262,6 +273,11 @@ export interface GeminiUserIdMessage {
262273
geminiUserId: number | null
263274
}
264275

276+
export interface ClearChecksInWorkspaceMessage {
277+
command: 'CLEAR_CHECKS_IN_WORKSPACE'
278+
value: 'ignore-open-editors' | 'uncheck-all'
279+
}
280+
265281
export interface ShowSectionMessage {
266282
command: 'SHOW_SECTION'
267283
section: string
@@ -276,4 +292,5 @@ export type BackendMessage =
276292
| CommitMessageInstructionsMessage
277293
| ContextSizeWarningThresholdMessage
278294
| GeminiUserIdMessage
295+
| ClearChecksInWorkspaceMessage
279296
| ShowSectionMessage

0 commit comments

Comments
 (0)