Skip to content

Commit 30690cc

Browse files
committed
Add check new files toggle with default enabled and standardize toggler transition duration
1 parent 2fac133 commit 30690cc

12 files changed

Lines changed: 109 additions & 17 deletions

File tree

‎packages/ui/src/components/editor/common/Toggler/Toggler.module.scss‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
left: 3px;
3333
bottom: 3px;
3434
background-color: var(--vscode-input-foreground);
35-
transition: 0.4s;
35+
transition: var(--transition-duration-150);
3636
border-radius: 50%;
3737
}
3838

‎packages/vscode/package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
44
"description": "Fast AI coding with chatbots/APIs (CWC)",
5-
"version": "1.736.0",
5+
"version": "1.737.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
88
"vscode:prepublish": "rimraf out && npm run compile",
@@ -633,11 +633,14 @@
633633
"scope": "resource",
634634
"default": false
635635
},
636+
"codeWebChat.checkNewFiles": {
637+
"type": "boolean",
638+
"default": true
639+
},
636640
"codeWebChat.sendWithShiftEnter": {
637641
"type": "boolean",
638642
"scope": "resource",
639-
"default": false,
640-
"description": "If enabled, use Shift+Enter to send messages and Enter to insert a new line."
643+
"default": false
641644
},
642645
"codeWebChat.clearChecksInWorkspaceBehavior": {
643646
"type": "string",

‎packages/vscode/src/context/providers/workspace/workspace-provider.ts‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -367,25 +367,31 @@ export class WorkspaceProvider
367367
// Ignore if file was deleted quickly
368368
}
369369

370+
const check_new_files = vscode.workspace
371+
.getConfiguration('codeWebChat')
372+
.get<boolean>('checkNewFiles')
373+
370374
if (
371375
!this.is_excluded(is_directory ? relative_path + '/' : relative_path) &&
372376
!this.is_ignored_by_patterns(created_file_path)
373377
) {
374-
this._checked_items.set(
375-
created_file_path,
376-
vscode.TreeItemCheckboxState.Checked
377-
)
378-
this._checked_timestamps.set(
379-
created_file_path,
380-
Math.floor(Date.now() / 1000)
381-
)
382-
383-
if (is_directory) {
384-
await this._update_directory_check_state(
378+
if (check_new_files) {
379+
this._checked_items.set(
385380
created_file_path,
386-
vscode.TreeItemCheckboxState.Checked,
387-
false
381+
vscode.TreeItemCheckboxState.Checked
388382
)
383+
this._checked_timestamps.set(
384+
created_file_path,
385+
Math.floor(Date.now() / 1000)
386+
)
387+
388+
if (is_directory) {
389+
await this._update_directory_check_state(
390+
created_file_path,
391+
vscode.TreeItemCheckboxState.Checked,
392+
false
393+
)
394+
}
389395
}
390396

391397
let dir_path = parent_dir
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as vscode from 'vscode'
2+
import { SettingsProvider } from '@/views/settings/backend/settings-provider'
3+
4+
export const handle_get_check_new_files = async (
5+
provider: SettingsProvider
6+
): Promise<void> => {
7+
const config = vscode.workspace.getConfiguration('codeWebChat')
8+
const enabled = config.get<boolean>('checkNewFiles', true)
9+
provider.postMessage({
10+
command: 'CHECK_NEW_FILES',
11+
enabled
12+
})
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as vscode from 'vscode'
2+
import { UpdateCheckNewFilesMessage } from '@/views/settings/types/messages'
3+
4+
export const handle_update_check_new_files = async (
5+
message: UpdateCheckNewFilesMessage
6+
): Promise<void> => {
7+
await vscode.workspace
8+
.getConfiguration('codeWebChat')
9+
.update('checkNewFiles', message.enabled, vscode.ConfigurationTarget.Global)
10+
}

‎packages/vscode/src/views/settings/backend/message-handlers/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ export * from './handle-open-ignore-patterns-settings'
4343
export * from './handle-open-allow-patterns-settings'
4444
export * from './handle-get-send-with-shift-enter'
4545
export * from './handle-update-send-with-shift-enter'
46+
export * from './handle-get-check-new-files'
47+
export * from './handle-update-check-new-files'

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
handle_delete_intelligent_update_configuration,
1313
handle_delete_model_provider,
1414
handle_edit_custom_model_provider,
15+
handle_get_check_new_files,
1516
handle_get_clear_checks_in_workspace_behavior,
1617
handle_get_are_automatic_checkpoints_disabled,
1718
handle_get_code_completions_configurations,
@@ -36,6 +37,7 @@ import {
3637
handle_set_default_code_completions_configuration,
3738
handle_set_default_commit_messages_configuration,
3839
handle_set_default_intelligent_update_configuration,
40+
handle_update_check_new_files,
3941
handle_update_clear_checks_in_workspace_behavior,
4042
handle_update_are_automatic_checkpoints_disabled,
4143
handle_update_commit_message_instructions,
@@ -214,6 +216,10 @@ export class SettingsProvider {
214216
await handle_get_send_with_shift_enter(this)
215217
} else if (message.command == 'UPDATE_SEND_WITH_SHIFT_ENTER') {
216218
await handle_update_send_with_shift_enter(message)
219+
} else if (message.command == 'GET_CHECK_NEW_FILES') {
220+
await handle_get_check_new_files(this)
221+
} else if (message.command == 'UPDATE_CHECK_NEW_FILES') {
222+
await handle_update_check_new_files(message)
217223
} else if (
218224
message.command == 'GET_ARE_AUTOMATIC_CHECKPOINTS_DISABLED'
219225
) {
@@ -263,6 +269,7 @@ export class SettingsProvider {
263269
void handle_get_gemini_user_id(this)
264270
void handle_get_ai_studio_user_id(this)
265271
void handle_get_send_with_shift_enter(this)
272+
void handle_get_check_new_files(this)
266273
}
267274
})
268275
)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ type Props = {
8080
gemini_user_id: number | null
8181
ai_studio_user_id: number | null
8282
send_with_shift_enter: boolean
83+
check_new_files: boolean
8384
are_automatic_checkpoints_disabled: boolean
8485
checkpoint_lifespan: number
8586
edit_format_instructions: EditFormatInstructions
@@ -103,6 +104,7 @@ type Props = {
103104
on_gemini_user_id_change: (id: number | null) => void
104105
on_ai_studio_user_id_change: (id: number | null) => void
105106
on_send_with_shift_enter_change: (enabled: boolean) => void
107+
on_check_new_files_change: (enabled: boolean) => void
106108
on_clear_checks_in_workspace_behavior_change: (
107109
value: 'ignore-open-editors' | 'uncheck-all'
108110
) => void
@@ -296,6 +298,8 @@ export const Home: React.FC<Props> = (props) => {
296298
on_send_with_shift_enter_change={
297299
props.on_send_with_shift_enter_change
298300
}
301+
check_new_files={props.check_new_files}
302+
on_check_new_files_change={props.on_check_new_files_change}
299303
clear_checks_in_workspace_behavior={
300304
props.clear_checks_in_workspace_behavior
301305
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ type Props = {
2020
context_size_warning_threshold: number
2121
are_automatic_checkpoints_disabled: boolean
2222
send_with_shift_enter: boolean
23+
check_new_files: boolean
2324
checkpoint_lifespan: number
2425
on_automatic_checkpoints_toggle: (disabled: boolean) => void
2526
on_send_with_shift_enter_change: (enabled: boolean) => void
27+
on_check_new_files_change: (enabled: boolean) => void
2628
on_checkpoint_lifespan_change: (hours: number) => void
2729
clear_checks_in_workspace_behavior: ClearChecksBehavior
2830
edit_format_instructions: EditFormatInstructions
@@ -139,6 +141,16 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
139141
/>
140142
}
141143
/>
144+
<Item
145+
title="Check New Files"
146+
description="Automatically include newly created files in context."
147+
slot_right={
148+
<Toggler
149+
is_on={props.check_new_files}
150+
on_toggle={props.on_check_new_files_change}
151+
/>
152+
}
153+
/>
142154
<Item
143155
title="Send with Shift+Enter"
144156
description="Use Shift+Enter to send messages and Enter to insert a new line."

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const Settings = () => {
3737
settings_hook.gemini_user_id !== undefined &&
3838
settings_hook.ai_studio_user_id !== undefined &&
3939
settings_hook.send_with_shift_enter !== undefined &&
40+
settings_hook.check_new_files !== undefined &&
4041
settings_hook.clear_checks_in_workspace_behavior !== undefined
4142
)
4243
}, [settings_hook])
@@ -80,6 +81,7 @@ export const Settings = () => {
8081
gemini_user_id={settings_hook.gemini_user_id!}
8182
ai_studio_user_id={settings_hook.ai_studio_user_id!}
8283
send_with_shift_enter={settings_hook.send_with_shift_enter!}
84+
check_new_files={settings_hook.check_new_files!}
8385
clear_checks_in_workspace_behavior={
8486
settings_hook.clear_checks_in_workspace_behavior!
8587
}
@@ -121,6 +123,7 @@ export const Settings = () => {
121123
on_send_with_shift_enter_change={
122124
settings_hook.handle_send_with_shift_enter_change
123125
}
126+
on_check_new_files_change={settings_hook.handle_check_new_files_change}
124127
on_open_editor_settings={settings_hook.handle_open_editor_settings}
125128
on_open_ignore_patterns_settings={
126129
settings_hook.handle_open_ignore_patterns_settings

0 commit comments

Comments
 (0)