Skip to content

Commit 8fdedc9

Browse files
committed
Add Return Home navigation, enhance Find Relevant Files state management, and implement source code shrinking option
- in duplicate workspace, don't store or restore frf - when switching to frf context, clear it - once user accepts 'relevant files' and we switched to 'edit context' prompt type. Show auto-closing modal instead of [Fragment] - [Fragment] should also change page to "Home". Also rename the method appropriately. The message sent to the frontend should be named "RETURN_HOME" - when returning to home, use return_home_and_switch_to_edit_context - Move checkbox with text [Fragment] above [Fragment]
1 parent d8ffca2 commit 8fdedc9

16 files changed

Lines changed: 72 additions & 56 deletions

File tree

apps/editor/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": "Fast and safe way to code with AI (CWC)",
5-
"version": "1.874.0",
5+
"version": "1.875.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
88
"vscode:prepublish": "rimraf out && npm run compile",

apps/editor/src/commands/apply-chat-response-command/response-processor.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,14 @@ export const process_chat_response = async (
266266

267267
if (was_frf) {
268268
shared_state.switch_context_state(true)
269-
await workspace_provider.set_checked_files([])
270-
await panel_provider.switch_to_edit_context()
269+
await panel_provider.return_home_and_switch_to_edit_context()
271270
}
272271

273-
vscode.window.showInformationMessage(
274-
t('command.apply-chat-response.relevant-files.success')
275-
)
272+
panel_provider.send_message({
273+
command: 'SHOW_AUTO_CLOSING_MODAL',
274+
title: t('command.apply-chat-response.relevant-files.success'),
275+
type: 'success'
276+
})
276277
}
277278

278279
return null

apps/editor/src/commands/duplicate-workspace-command.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ export const duplicate_workspace_command = (
2020
const checked_files = export_state.regular.checked_files
2121
const checked_files_timestamps = export_state.regular.checked_timestamps
2222

23-
const checked_files_frf = export_state.frf.checked_files
24-
const checked_files_timestamps_frf = export_state.frf.checked_timestamps
25-
2623
const workspace_root_folders =
2724
vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath) ??
2825
[]
@@ -47,8 +44,6 @@ export const duplicate_workspace_command = (
4744
const context_to_save: DuplicateWorkspaceContext = {
4845
checked_files,
4946
checked_files_timestamps,
50-
checked_files_frf,
51-
checked_files_timestamps_frf,
5247
workspace_root_folders,
5348
timestamp: Date.now(),
5449
open_editors,

apps/editor/src/constants/state-keys.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ export const LAST_SEARCH_FILES_FOR_CONTEXT_QUERY_STATE_KEY =
8989
export type DuplicateWorkspaceContext = {
9090
checked_files: string[]
9191
checked_files_timestamps: Record<string, number>
92-
checked_files_frf: string[]
93-
checked_files_timestamps_frf: Record<string, number>
9492
timestamp: number
9593
workspace_root_folders: string[]
9694
open_editors?: { path: string; view_column?: number }[]

apps/editor/src/context/context-initialization.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ const restore_duplicated_workspace_context = async (
6565
CONTEXT_CHECKED_TIMESTAMPS_STATE_KEY,
6666
duplicated_context.checked_files_timestamps
6767
)
68-
await context.workspaceState.update(
69-
CONTEXT_CHECKED_PATHS_FRF_STATE_KEY,
70-
duplicated_context.checked_files_frf
71-
)
72-
await context.workspaceState.update(
73-
CONTEXT_CHECKED_TIMESTAMPS_FRF_STATE_KEY,
74-
duplicated_context.checked_files_timestamps_frf
75-
)
7668

7769
if (duplicated_context.ranges) {
7870
await context.workspaceState.update(

apps/editor/src/context/providers/open-editors/open-editors-provider.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ export class OpenEditorsProvider
5555
public switch_context_state(is_frf: boolean) {
5656
if (this._is_frf_mode == is_frf) return
5757
this._is_frf_mode = is_frf
58+
59+
if (is_frf) {
60+
this._checked_items.clear()
61+
}
62+
5863
this.refresh()
5964
this._dispatch_change_events()
6065
}

apps/editor/src/context/providers/workspace/workspace-provider.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ export class WorkspaceProvider
146146
public switch_context_state(is_frf: boolean) {
147147
if (this._is_frf_mode == is_frf) return
148148
this._is_frf_mode = is_frf
149+
150+
if (is_frf) {
151+
this._checked_items.clear()
152+
this._checked_timestamps.clear()
153+
this._partially_checked_dirs.clear()
154+
}
155+
149156
this._token_calculator.clear_selected_counts()
150157
this.refresh()
151158
this._dispatch_change_events()

apps/editor/src/context/shared-file-state.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ export class SharedFileState {
9999
this._open_editors_provider.switch_context_state(is_frf)
100100

101101
this._is_frf_mode = is_frf
102+
103+
if (is_frf) {
104+
this._unchecked_in_open_editors.clear()
105+
this._unchecked_in_workspace.clear()
106+
this._undo_stack = []
107+
this._redo_stack = []
108+
}
109+
102110
this.update_checked_files_set()
103111
this._on_did_change_checked_files.fire()
104112
} finally {

apps/editor/src/i18n/translations/commands/apply-chat-response.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,21 @@ export const apply_chat_response = {
9090
bg: 'Потвърдете файловете за включване в контекста'
9191
},
9292
'command.apply-chat-response.relevant-files.success': {
93-
en: 'Relevant files has been checked successfully.',
94-
pl: 'Pomyślnie znaleziono odpowiednie pliki.',
95-
'zh-cn': '成功找到相关文件。',
96-
ja: '関連ファイルが正常に見つかりました。',
97-
'zh-tw': '成功找到相關檔案。',
98-
de: 'Relevante Dateien erfolgreich gefunden.',
99-
es: 'Archivos relevantes encontrados exitosamente.',
100-
fr: 'Fichiers pertinents trouvés avec succès.',
101-
'pt-br': 'Arquivos relevantes encontrados com sucesso.',
102-
ru: 'Соответствующие файлы успешно найдены.',
103-
ko: '관련 파일을 성공적으로 찾았습니다.',
104-
it: 'File rilevanti trovati con successo.',
105-
tr: 'İlgili dosyalar başarıyla bulundu.',
106-
cs: 'Relevantní soubory úspěšně nalezeny.',
107-
hu: 'A releváns fájlok sikeresen megtalálva.',
108-
bg: 'Съответните файлове са намерени успешно.'
93+
en: 'Context has been updated',
94+
pl: 'Kontekst został zaktualizowany',
95+
'zh-cn': '上下文已更新',
96+
ja: 'コンテキストが更新されました',
97+
'zh-tw': '上下文已更新',
98+
de: 'Kontext wurde aktualisiert',
99+
es: 'El contexto ha sido actualizado',
100+
fr: 'Le contexte a été mis à jour',
101+
'pt-br': 'O contexto foi atualizado',
102+
ru: 'Контекст был обновлен',
103+
ko: '컨텍스트가 업데이트되었습니다',
104+
it: 'Il contesto è stato aggiornato',
105+
tr: 'Bağlam güncellendi',
106+
cs: 'Kontext byl aktualizován',
107+
hu: 'A kontextus frissítve lett',
108+
bg: 'Контекстът е актуализиран'
109109
}
110110
} as const

apps/editor/src/views/panel/backend/panel-provider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export class PanelProvider implements vscode.WebviewViewProvider {
274274
SharedFileState.get_instance().switch_context_state(is_find_relevant_files)
275275
}
276276

277-
public async switch_to_edit_context() {
277+
public async return_home_and_switch_to_edit_context() {
278278
if (this.mode == MODE.WEB) {
279279
this.web_prompt_type = 'edit-context'
280280
await this.context.workspaceState.update(
@@ -298,6 +298,7 @@ export class PanelProvider implements vscode.WebviewViewProvider {
298298
}
299299
this.update_providers_shrink_mode()
300300
this.update_providers_context_state()
301+
this.send_message({ command: 'RETURN_HOME' })
301302
}
302303

303304
public async send_checkpoints() {
@@ -1005,6 +1006,8 @@ export class PanelProvider implements vscode.WebviewViewProvider {
10051006
await handle_voice_input(this, message)
10061007
} else if (message.command == 'GET_SETUP_PROGRESS') {
10071008
await this.send_setup_progress()
1009+
} else if (message.command == 'RETURN_HOME') {
1010+
await this.return_home_and_switch_to_edit_context()
10081011
} else if (
10091012
message.command == 'GET_FIND_RELEVANT_FILES_SHRINK_SOURCE_CODE'
10101013
) {

0 commit comments

Comments
 (0)