Skip to content

Commit 553c7a0

Browse files
committed
Rename codeWebChat.includePromptsInCommitMessages configuration to codeWebChat.attachAllPromptsInCommitMessagesByDefault
- when [Fragment] is false, is the user shown the quick pick to let them select by hand? It should. - rename 'include prompts in commit messages' to 'attach all prompts in commit messages by default'
1 parent cb9b8c9 commit 553c7a0

12 files changed

Lines changed: 107 additions & 91 deletions

File tree

‎apps/editor/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@
848848
"type": "string",
849849
"scope": "resource"
850850
},
851-
"codeWebChat.includePromptsInCommitMessages": {
851+
"codeWebChat.attachAllPromptsInCommitMessagesByDefault": {
852852
"type": "boolean",
853853
"scope": "resource",
854854
"default": true

‎apps/editor/src/commands/generate-commit-message-command/generate-commit-message-command.ts‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ export const generate_commit_message_command = (
150150
path.relative(workspace_root, change.uri.fsPath).replace(/\\/g, '/')
151151
)
152152

153-
const include_prompts_setting = vscode.workspace
153+
const attach_prompts_setting = vscode.workspace
154154
.getConfiguration('codeWebChat')
155-
.get<boolean>('includePromptsInCommitMessages', true)
155+
.get<boolean>('attachAllPromptsInCommitMessagesByDefault', true)
156156

157157
const relevant_prompts = all_prompts
158158
.filter((p) => p.files.some((file) => staged_files.includes(file)))
@@ -214,7 +214,7 @@ export const generate_commit_message_command = (
214214
}
215215

216216
if (edited_message) {
217-
let selected_prompts = relevant_prompts
217+
let selected_prompts = attach_prompts_setting ? relevant_prompts : []
218218

219219
if (relevant_prompts.length > 0) {
220220
const picked = await new Promise<
@@ -225,11 +225,9 @@ export const generate_commit_message_command = (
225225
label: simplify_prompt_symbols({ prompt: p.prompt }),
226226
prompt: p
227227
}))
228-
if (include_prompts_setting) {
229-
quick_pick.selectedItems = quick_pick.items
230-
} else {
231-
quick_pick.selectedItems = []
232-
}
228+
quick_pick.selectedItems = attach_prompts_setting
229+
? quick_pick.items
230+
: []
233231
quick_pick.canSelectMany = true
234232
quick_pick.title = 'Accepted Prompts'
235233
quick_pick.placeholder =
@@ -293,7 +291,7 @@ export const generate_commit_message_command = (
293291
}
294292
} else {
295293
const prompts_text =
296-
include_prompts_setting && relevant_prompts.length > 0
294+
attach_prompts_setting && relevant_prompts.length > 0
297295
? '\n\n' +
298296
relevant_prompts
299297
.map(

‎apps/editor/src/services/git-discard-file-watcher.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ export const setup_git_discard_file_watcher = (
5454

5555
repo_states.set(workspace_root, current_changes)
5656

57-
const include_prompts_setting = vscode.workspace
57+
const attach_prompts_setting = vscode.workspace
5858
.getConfiguration('codeWebChat')
59-
.get<boolean>('includePromptsInCommitMessages', true)
59+
.get<boolean>('attachAllPromptsInCommitMessagesByDefault', true)
6060

6161
let relevant_prompts_text = ''
6262

63-
if (include_prompts_setting) {
63+
if (attach_prompts_setting) {
6464
const all_prompts =
6565
PromptsForCommitMessagesUtils.load_all(context)[workspace_root] ||
6666
[]

‎apps/editor/src/views/settings/backend/message-handlers/handle-get-include-prompts-in-commit-messages.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ export const handle_get_include_prompts_in_commit_messages = async (
55
provider: SettingsProvider
66
): Promise<void> => {
77
const config = vscode.workspace.getConfiguration('codeWebChat')
8-
const enabled = config.get<boolean>('includePromptsInCommitMessages', true)
8+
const enabled = config.get<boolean>(
9+
'attachAllPromptsInCommitMessagesByDefault',
10+
true
11+
)
912
provider.postMessage({
10-
command: 'INCLUDE_PROMPTS_IN_COMMIT_MESSAGES',
13+
command: 'ATTACH_ALL_PROMPTS_IN_COMMIT_MESSAGES_BY_DEFAULT',
1114
enabled
1215
})
1316
}

‎apps/editor/src/views/settings/backend/message-handlers/handle-update-include-prompts-in-commit-messages.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as vscode from 'vscode'
2-
import { UpdateIncludePromptsInCommitMessagesMessage } from '@/views/settings/types/messages'
2+
import { UpdateAttachAllPromptsInCommitMessagesByDefaultMessage } from '@/views/settings/types/messages'
33

44
export const handle_update_include_prompts_in_commit_messages = async (
5-
message: UpdateIncludePromptsInCommitMessagesMessage
5+
message: UpdateAttachAllPromptsInCommitMessagesByDefaultMessage
66
): Promise<void> => {
77
await vscode.workspace
88
.getConfiguration('codeWebChat')
99
.update(
10-
'includePromptsInCommitMessages',
10+
'attachAllPromptsInCommitMessagesByDefault',
1111
message.enabled,
1212
vscode.ConfigurationTarget.Global
1313
)

‎apps/editor/src/views/settings/backend/settings-provider.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,13 @@ export class SettingsProvider {
176176
} else if (message.command == 'UPDATE_COMMIT_MESSAGE_INSTRUCTIONS') {
177177
await handle_update_commit_message_instructions(message)
178178
} else if (
179-
message.command == 'GET_INCLUDE_PROMPTS_IN_COMMIT_MESSAGES'
179+
message.command ==
180+
'GET_ATTACH_ALL_PROMPTS_IN_COMMIT_MESSAGES_BY_DEFAULT'
180181
) {
181182
await handle_get_include_prompts_in_commit_messages(this)
182183
} else if (
183-
message.command == 'UPDATE_INCLUDE_PROMPTS_IN_COMMIT_MESSAGES'
184+
message.command ==
185+
'UPDATE_ATTACH_ALL_PROMPTS_IN_COMMIT_MESSAGES_BY_DEFAULT'
184186
) {
185187
await handle_update_include_prompts_in_commit_messages(message)
186188
} else if (message.command == 'GET_CONTEXT_SIZE_WARNING_THRESHOLD') {

‎apps/editor/src/views/settings/frontend/Home/Home.tsx‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ type Props = {
113113
edit_files_system_instructions: string
114114
find_relevant_files_instructions: string
115115
commit_message_instructions: string
116-
include_prompts_in_commit_messages: boolean
116+
attach_all_prompts_in_commit_messages_by_default: boolean
117117
context_size_warning_threshold: number
118118
gemini_user_id: number | null
119119
ai_studio_user_id: number | null
@@ -132,7 +132,9 @@ type Props = {
132132
threshold: number | undefined
133133
) => void
134134
on_commit_instructions_change: (instructions: string) => void
135-
on_include_prompts_in_commit_messages_change: (enabled: boolean) => void
135+
on_attach_all_prompts_in_commit_messages_by_default_change: (
136+
enabled: boolean
137+
) => void
136138
on_edit_format_instructions_change: (
137139
instructions: EditFormatInstructions
138140
) => void
@@ -420,11 +422,11 @@ export const Home: React.FC<Props> = (props) => {
420422
props.on_open_allow_patterns_settings
421423
}
422424
on_open_keybindings={props.on_open_keybindings}
423-
include_prompts_in_commit_messages={
424-
props.include_prompts_in_commit_messages
425+
attach_all_prompts_in_commit_messages_by_default={
426+
props.attach_all_prompts_in_commit_messages_by_default
425427
}
426-
on_include_prompts_in_commit_messages_change={
427-
props.on_include_prompts_in_commit_messages_change
428+
on_attach_all_prompts_in_commit_messages_by_default_change={
429+
props.on_attach_all_prompts_in_commit_messages_by_default_change
428430
}
429431
commit_instructions={commit_instructions}
430432
set_commit_instructions={set_commit_instructions}

‎apps/editor/src/views/settings/frontend/Home/sections/GeneralSection.tsx‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ type Props = {
4949
on_open_allow_patterns_settings: () => void
5050
on_open_keybindings: (search?: string) => void
5151
set_section_ref: (id: NavItem, el: HTMLDivElement | null) => void
52-
include_prompts_in_commit_messages: boolean
53-
on_include_prompts_in_commit_messages_change: (enabled: boolean) => void
52+
attach_all_prompts_in_commit_messages_by_default: boolean
53+
on_attach_all_prompts_in_commit_messages_by_default_change: (
54+
enabled: boolean
55+
) => void
5456
commit_instructions: string
5557
set_commit_instructions: (instructions: string) => void
5658
on_commit_instructions_blur: () => void
@@ -360,14 +362,18 @@ export const GeneralSection = forwardRef<HTMLDivElement, Props>(
360362
>
361363
<UiGroup title={t('general.commit-messages.title')}>
362364
<UiItem
363-
title={t('general.include-prompts-in-commit-messages.title')}
365+
title={t(
366+
'general.attach-all-prompts-in-commit-messages-by-default.title'
367+
)}
364368
description={t(
365-
'general.include-prompts-in-commit-messages.description'
369+
'general.attach-all-prompts-in-commit-messages-by-default.description'
366370
)}
367371
slot_right={
368372
<UiToggler
369-
is_on={props.include_prompts_in_commit_messages}
370-
on_toggle={props.on_include_prompts_in_commit_messages_change}
373+
is_on={props.attach_all_prompts_in_commit_messages_by_default}
374+
on_toggle={
375+
props.on_attach_all_prompts_in_commit_messages_by_default_change
376+
}
371377
/>
372378
}
373379
/>

‎apps/editor/src/views/settings/frontend/Settings.tsx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export const Settings = () => {
5454
settings_hook.edit_files_system_instructions !== undefined &&
5555
settings_hook.find_relevant_files_instructions !== undefined &&
5656
settings_hook.commit_message_instructions !== undefined &&
57-
settings_hook.include_prompts_in_commit_messages !== undefined &&
57+
settings_hook.attach_all_prompts_in_commit_messages_by_default !==
58+
undefined &&
5859
settings_hook.context_size_warning_threshold !== undefined &&
5960
settings_hook.edit_format_instructions !== undefined &&
6061
settings_hook.are_automatic_checkpoints_disabled !== undefined &&
@@ -98,8 +99,8 @@ export const Settings = () => {
9899
context_size_warning_threshold={
99100
settings_hook.context_size_warning_threshold!
100101
}
101-
include_prompts_in_commit_messages={
102-
settings_hook.include_prompts_in_commit_messages!
102+
attach_all_prompts_in_commit_messages_by_default={
103+
settings_hook.attach_all_prompts_in_commit_messages_by_default!
103104
}
104105
commit_message_instructions={settings_hook.commit_message_instructions!}
105106
edit_format_instructions={settings_hook.edit_format_instructions!}
@@ -124,8 +125,8 @@ export const Settings = () => {
124125
on_commit_instructions_change={
125126
settings_hook.handle_commit_instructions_change
126127
}
127-
on_include_prompts_in_commit_messages_change={
128-
settings_hook.handle_include_prompts_in_commit_messages_change
128+
on_attach_all_prompts_in_commit_messages_by_default_change={
129+
settings_hook.handle_attach_all_prompts_in_commit_messages_by_default_change
129130
}
130131
on_edit_files_system_instructions_change={
131132
settings_hook.handle_edit_files_system_instructions_change

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export const use_settings = (vscode: any) => {
2323
const [commit_message_instructions, set_commit_message_instructions] =
2424
useState<string | undefined>(undefined)
2525
const [
26-
include_prompts_in_commit_messages,
27-
set_include_prompts_in_commit_messages
26+
attach_all_prompts_in_commit_messages_by_default,
27+
set_attach_all_prompts_in_commit_messages_by_default
2828
] = useState<boolean | undefined>(undefined)
2929
const [edit_files_system_instructions, set_edit_files_system_instructions] =
3030
useState<string | undefined>(undefined)
@@ -73,7 +73,9 @@ export const use_settings = (vscode: any) => {
7373
post_message(vscode, { command: 'GET_EDIT_FILES_SYSTEM_INSTRUCTIONS' })
7474
post_message(vscode, { command: 'GET_FIND_RELEVANT_FILES_INSTRUCTIONS' })
7575
post_message(vscode, { command: 'GET_COMMIT_MESSAGE_INSTRUCTIONS' })
76-
post_message(vscode, { command: 'GET_INCLUDE_PROMPTS_IN_COMMIT_MESSAGES' })
76+
post_message(vscode, {
77+
command: 'GET_ATTACH_ALL_PROMPTS_IN_COMMIT_MESSAGES_BY_DEFAULT'
78+
})
7779
post_message(vscode, { command: 'GET_CONTEXT_SIZE_WARNING_THRESHOLD' })
7880
post_message(vscode, { command: 'GET_EDIT_FORMAT_INSTRUCTIONS' })
7981
post_message(vscode, { command: 'GET_ARE_AUTOMATIC_CHECKPOINTS_DISABLED' })
@@ -103,8 +105,10 @@ export const use_settings = (vscode: any) => {
103105
set_find_relevant_files_instructions(message.instructions)
104106
} else if (message.command == 'COMMIT_MESSAGE_INSTRUCTIONS') {
105107
set_commit_message_instructions(message.instructions)
106-
} else if (message.command == 'INCLUDE_PROMPTS_IN_COMMIT_MESSAGES') {
107-
set_include_prompts_in_commit_messages(message.enabled)
108+
} else if (
109+
message.command == 'ATTACH_ALL_PROMPTS_IN_COMMIT_MESSAGES_BY_DEFAULT'
110+
) {
111+
set_attach_all_prompts_in_commit_messages_by_default(message.enabled)
108112
} else if (message.command == 'CONTEXT_SIZE_WARNING_THRESHOLD') {
109113
set_context_size_warning_threshold(message.threshold)
110114
} else if (message.command == 'EDIT_FORMAT_INSTRUCTIONS') {
@@ -241,12 +245,12 @@ export const use_settings = (vscode: any) => {
241245
instructions
242246
})
243247

244-
const handle_include_prompts_in_commit_messages_change = (
248+
const handle_attach_all_prompts_in_commit_messages_by_default_change = (
245249
enabled: boolean
246250
) => {
247-
set_include_prompts_in_commit_messages(enabled)
251+
set_attach_all_prompts_in_commit_messages_by_default(enabled)
248252
post_message(vscode, {
249-
command: 'UPDATE_INCLUDE_PROMPTS_IN_COMMIT_MESSAGES',
253+
command: 'UPDATE_ATTACH_ALL_PROMPTS_IN_COMMIT_MESSAGES_BY_DEFAULT',
250254
enabled
251255
})
252256
}
@@ -381,7 +385,7 @@ export const use_settings = (vscode: any) => {
381385
set_web_configurations,
382386
defaults,
383387
commit_message_instructions,
384-
include_prompts_in_commit_messages,
388+
attach_all_prompts_in_commit_messages_by_default,
385389
edit_files_system_instructions,
386390
find_relevant_files_instructions,
387391
context_size_warning_threshold,
@@ -407,7 +411,7 @@ export const use_settings = (vscode: any) => {
407411
handle_add_web_configuration,
408412
handle_delete_web_configuration,
409413
handle_commit_instructions_change,
410-
handle_include_prompts_in_commit_messages_change,
414+
handle_attach_all_prompts_in_commit_messages_by_default_change,
411415
handle_edit_files_system_instructions_change,
412416
handle_find_relevant_files_instructions_change,
413417
handle_open_editor_settings,

0 commit comments

Comments
 (0)