Skip to content

Commit 832f50f

Browse files
committed
Update UI state to reflect default configuration changes for CODE_AT_CURSOR, INTELLIGENT_UPDATE, and COMMIT_MESSAGES tools
1 parent c25ed45 commit 832f50f

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

‎apps/editor/src/views/settings/frontend/hooks/use-settings.ts‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,65 @@ export const use_settings = (vscode: any) => {
252252
tool_name: string,
253253
configuration_id: string
254254
) => {
255+
if (tool_name == 'CODE_AT_CURSOR' && code_at_cursor_configs) {
256+
set_code_at_cursor_configs(
257+
code_at_cursor_configs.map((c) => ({
258+
...c,
259+
is_default: c.id == configuration_id
260+
}))
261+
)
262+
} else if (
263+
tool_name == 'INTELLIGENT_UPDATE' &&
264+
intelligent_update_configs
265+
) {
266+
set_intelligent_update_configs(
267+
intelligent_update_configs.map((c) => ({
268+
...c,
269+
is_default: c.id == configuration_id
270+
}))
271+
)
272+
} else if (tool_name == 'COMMIT_MESSAGES' && commit_messages_configs) {
273+
set_commit_messages_configs(
274+
commit_messages_configs.map((c) => ({
275+
...c,
276+
is_default: c.id == configuration_id
277+
}))
278+
)
279+
}
280+
255281
post_message(vscode, {
256282
command: `SET_DEFAULT_${tool_name}_CONFIGURATION`,
257283
configuration_id
258284
} as FrontendMessage)
259285
}
260286

261287
const handle_unset_default_config = (tool_name: string) => {
288+
if (tool_name == 'CODE_AT_CURSOR' && code_at_cursor_configs) {
289+
set_code_at_cursor_configs(
290+
code_at_cursor_configs.map((c) => ({
291+
...c,
292+
is_default: false
293+
}))
294+
)
295+
} else if (
296+
tool_name == 'INTELLIGENT_UPDATE' &&
297+
intelligent_update_configs
298+
) {
299+
set_intelligent_update_configs(
300+
intelligent_update_configs.map((c) => ({
301+
...c,
302+
is_default: false
303+
}))
304+
)
305+
} else if (tool_name == 'COMMIT_MESSAGES' && commit_messages_configs) {
306+
set_commit_messages_configs(
307+
commit_messages_configs.map((c) => ({
308+
...c,
309+
is_default: false
310+
}))
311+
)
312+
}
313+
262314
post_message(vscode, {
263315
command: `SET_DEFAULT_${tool_name}_CONFIGURATION`,
264316
configuration_id: null

0 commit comments

Comments
 (0)