Skip to content

Commit c7c6978

Browse files
committed
Merge branch 'dev'
2 parents e8a3cac + 16f156a commit c7c6978

12 files changed

Lines changed: 113 additions & 68 deletions

File tree

‎packages/shared/src/constants/dictionary.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ export const dictionary = {
271271
'An error occurred during refactor task. See console for details.',
272272
CONFIGURATION_ALREADY_EXISTS:
273273
'A configuration with these properties already exists.',
274-
CONFIGURATION_NOT_FOUND: 'Configuration not found.'
274+
CONFIGURATION_NOT_FOUND: 'Configuration not found.',
275+
APPLYING_CHANGES_GENERIC_ERROR: (msg: string) =>
276+
`An error occurred while applying changes: ${msg}`
275277
}
276278
}

‎packages/ui/src/components/editor/panel/ResponsePreview/ResponsePreview.tsx‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ type Props = {
2525
}
2626

2727
export const ResponsePreview: FC<Props> = (props) => {
28-
const [last_clicked_file_index, set_last_clicked_file_index] = useState(0)
28+
const [last_clicked_file_index, set_last_clicked_file_index] = useState(
29+
props.items.findIndex((i) => i.type == 'file')
30+
)
2931
const [expanded_text_items, set_expanded_text_items] = useState<Set<number>>(
3032
new Set()
3133
)
@@ -201,18 +203,6 @@ export const ResponsePreview: FC<Props> = (props) => {
201203
}}
202204
/>
203205
)}
204-
<IconButton
205-
codicon_icon="diff-single"
206-
title="Open Changes"
207-
on_click={(e) => {
208-
e.stopPropagation()
209-
set_last_clicked_file_index(index)
210-
props.on_focus_file({
211-
file_path: file.file_path,
212-
workspace_name: file.workspace_name
213-
})
214-
}}
215-
/>
216206
<IconButton
217207
codicon_icon="go-to-file"
218208
title="Go To File"

‎packages/ui/src/components/editor/panel/ResponsePreview/components/TextItem.module.scss‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
padding: 2px 4px;
2323
border-radius: 3px;
2424
}
25+
26+
pre {
27+
display: flex;
28+
overflow: auto;
29+
}
2530
}
2631

2732
.hidden {

‎packages/ui/src/components/editor/panel/ResponsePreview/components/TextItem.tsx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ export const TextItem: FC<Props> = ({ content, is_expanded, on_toggle }) => {
2323
<ReactMarkdown disallowedElements={['hr']}>{content}</ReactMarkdown>
2424
</div>
2525
) : (
26-
<div ref={ref} className={styles.hidden}>
26+
<div
27+
ref={ref}
28+
className={styles.hidden}
29+
onClick={() => ref.current && on_toggle(ref.current)}
30+
>
2731
<div className={styles.line} />
28-
<IconButton
29-
codicon_icon="list-flat"
30-
on_click={() => ref.current && on_toggle(ref.current)}
31-
title="Show text"
32-
/>
32+
<IconButton codicon_icon="list-selection" title="Show text" />
3333
<div className={styles.line} />
3434
</div>
3535
)}

‎packages/vscode/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
44
"description": "AI coding without agents (CWC)",
5-
"version": "1.521.0",
5+
"version": "1.522.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
88
"vscode:prepublish": "rimraf out && npm run compile",

‎packages/vscode/src/commands/apply-chat-response-command/apply-chat-response-command.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export const apply_chat_response_command = (
218218
}
219219
} catch (err: any) {
220220
vscode.window.showErrorMessage(
221-
`An error occurred while applying changes: ${err.message}`
221+
dictionary.error_message.APPLYING_CHANGES_GENERIC_ERROR(err.message)
222222
)
223223
} finally {
224224
in_progress = false

‎packages/vscode/src/constants/state-keys.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ export const PINNED_HISTORY_NO_CONTEXT_STATE_KEY = 'pinned-history-no-context'
5858

5959
export const RECENT_DONATIONS_VISIBLE_STATE_KEY = 'recent-donations-visible'
6060

61-
export const PRESETS_COLLAPSED_STATE_KEY = 'presets-collapsed'
62-
export const CONFIGURATIONS_COLLAPSED_STATE_KEY = 'configurations-collapsed'
61+
export const get_presets_collapsed_state_key = (web_mode: string) =>
62+
`presets-collapsed-${web_mode}`
63+
export const get_configurations_collapsed_state_key = (api_mode: string) =>
64+
`configurations-collapsed-${api_mode}`
6365

6466
export const get_last_group_or_preset_choice_state_key = (web_mode: string) =>
6567
`last-group-or-preset-choice-${web_mode}`

‎packages/vscode/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ const perform_context_editing = async (params: {
423423
if (result) {
424424
vscode.commands.executeCommand('codeWebChat.applyChatResponse', {
425425
response: result.response,
426-
raw_instructions: instructions
426+
raw_instructions: instructions,
427+
edit_format
427428
})
428429
return
429430
} else {

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

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ import {
6464
INSTRUCTIONS_CODE_COMPLETIONS_STATE_KEY,
6565
INSTRUCTIONS_EDIT_CONTEXT_STATE_KEY,
6666
INSTRUCTIONS_NO_CONTEXT_STATE_KEY,
67+
get_configurations_collapsed_state_key,
6768
get_last_group_or_preset_choice_state_key,
6869
get_last_selected_group_state_key,
6970
get_last_selected_preset_key,
7071
LAST_APPLIED_CHANGES_STATE_KEY,
7172
LAST_APPLIED_CLIPBOARD_CONTENT_STATE_KEY,
7273
LAST_SELECTED_CODE_COMPLETION_CONFIG_ID_STATE_KEY,
7374
LAST_SELECTED_EDIT_CONTEXT_CONFIG_ID_STATE_KEY,
74-
PRESETS_COLLAPSED_STATE_KEY,
75-
CONFIGURATIONS_COLLAPSED_STATE_KEY,
75+
get_presets_collapsed_state_key,
7676
RECENT_DONATIONS_VISIBLE_STATE_KEY,
7777
WEB_MODE_STATE_KEY
7878
} from '@/constants/state-keys'
@@ -110,8 +110,6 @@ export class PanelProvider implements vscode.WebviewViewProvider {
110110
public intelligent_update_cancel_token_sources: CancelTokenSource[] = []
111111
public api_call_cancel_token_source: CancelTokenSource | null = null
112112
public commit_was_staged_by_script: boolean = false
113-
public presets_collapsed: boolean = false
114-
public configurations_collapsed: boolean = false
115113

116114
constructor(
117115
public readonly extension_uri: vscode.Uri,
@@ -130,15 +128,6 @@ export class PanelProvider implements vscode.WebviewViewProvider {
130128
}
131129
})
132130

133-
this.presets_collapsed = this.context.globalState.get<boolean>(
134-
PRESETS_COLLAPSED_STATE_KEY,
135-
false
136-
)
137-
this.configurations_collapsed = this.context.globalState.get<boolean>(
138-
CONFIGURATIONS_COLLAPSED_STATE_KEY,
139-
false
140-
)
141-
142131
this.edit_instructions = this.context.workspaceState.get<string>(
143132
INSTRUCTIONS_EDIT_CONTEXT_STATE_KEY,
144133
''
@@ -180,22 +169,37 @@ export class PanelProvider implements vscode.WebviewViewProvider {
180169
RECENT_DONATIONS_VISIBLE_STATE_KEY,
181170
false
182171
)
172+
const WEB_MODES: WebMode[] = [
173+
'ask',
174+
'edit-context',
175+
'code-completions',
176+
'no-context'
177+
]
178+
const API_MODES: ApiMode[] = ['edit-context', 'code-completions']
183179
this.send_message({
184180
command: 'DONATIONS_VISIBILITY',
185181
is_visible: are_donations_visible
186182
})
187-
this.presets_collapsed = this.context.globalState.get<boolean>(
188-
PRESETS_COLLAPSED_STATE_KEY,
189-
false
190-
)
191-
this.configurations_collapsed = this.context.globalState.get<boolean>(
192-
CONFIGURATIONS_COLLAPSED_STATE_KEY,
193-
false
194-
)
195183
this.send_message({
196184
command: 'COLLAPSED_STATES',
197-
presets_collapsed: this.presets_collapsed,
198-
configurations_collapsed: this.configurations_collapsed
185+
presets_collapsed_by_web_mode: Object.fromEntries(
186+
WEB_MODES.map((mode) => [
187+
mode,
188+
this.context.globalState.get<boolean>(
189+
get_presets_collapsed_state_key(mode),
190+
false
191+
)
192+
])
193+
),
194+
configurations_collapsed_by_api_mode: Object.fromEntries(
195+
API_MODES.map((mode) => [
196+
mode,
197+
this.context.globalState.get<boolean>(
198+
get_configurations_collapsed_state_key(mode),
199+
false
200+
)
201+
])
202+
)
199203
})
200204
}
201205
})
@@ -565,22 +569,43 @@ export class PanelProvider implements vscode.WebviewViewProvider {
565569
section
566570
)
567571
} else if (message.command == 'GET_COLLAPSED_STATES') {
572+
const WEB_MODES: WebMode[] = [
573+
'ask',
574+
'edit-context',
575+
'code-completions',
576+
'no-context'
577+
]
578+
const API_MODES: ApiMode[] = ['edit-context', 'code-completions']
568579
this.send_message({
569580
command: 'COLLAPSED_STATES',
570-
presets_collapsed: this.presets_collapsed,
571-
configurations_collapsed: this.configurations_collapsed
581+
presets_collapsed_by_web_mode: Object.fromEntries(
582+
WEB_MODES.map((mode) => [
583+
mode,
584+
this.context.globalState.get<boolean>(
585+
get_presets_collapsed_state_key(mode),
586+
false
587+
)
588+
])
589+
),
590+
configurations_collapsed_by_api_mode: Object.fromEntries(
591+
API_MODES.map((mode) => [
592+
mode,
593+
this.context.globalState.get<boolean>(
594+
get_configurations_collapsed_state_key(mode),
595+
false
596+
)
597+
])
598+
)
572599
})
573600
} else if (message.command == 'SAVE_COMPONENT_COLLAPSED_STATE') {
574601
if (message.component == 'presets') {
575-
this.presets_collapsed = message.is_collapsed
576602
await this.context.globalState.update(
577-
PRESETS_COLLAPSED_STATE_KEY,
603+
get_presets_collapsed_state_key(message.mode as WebMode),
578604
message.is_collapsed
579605
)
580606
} else if (message.component == 'configurations') {
581-
this.configurations_collapsed = message.is_collapsed
582607
await this.context.globalState.update(
583-
CONFIGURATIONS_COLLAPSED_STATE_KEY,
608+
get_configurations_collapsed_state_key(message.mode as ApiMode),
584609
message.is_collapsed
585610
)
586611
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const Home: React.FC<Props> = (props) => {
6262
<div className={styles['inner__buttons']}>
6363
<Enter
6464
label="Open View: New chat"
65-
description="Send message with chatbot"
65+
description="Send messages with chatbots"
6666
on_click={props.on_new_chat}
6767
/>
6868
<Enter

0 commit comments

Comments
 (0)