Skip to content

Commit e6d18eb

Browse files
committed
Rename RETURN_HOME command to REQUEST_RETURN_HOME and move its invocation to the start of the return_home_and_switch_to_edit_context method
- we noticed frontend sends backend message: [Fragment] it should be a separate frontend-type message - translate "[Fragment]"
1 parent 80d313f commit e6d18eb

5 files changed

Lines changed: 27 additions & 5 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ export class PanelProvider implements vscode.WebviewViewProvider {
275275
}
276276

277277
public async return_home_and_switch_to_edit_context() {
278+
this.send_message({ command: 'RETURN_HOME' })
278279
if (this.mode == MODE.WEB) {
279280
this.web_prompt_type = 'edit-context'
280281
await this.context.workspaceState.update(
@@ -298,7 +299,6 @@ export class PanelProvider implements vscode.WebviewViewProvider {
298299
}
299300
this.update_providers_shrink_mode()
300301
this.update_providers_context_state()
301-
this.send_message({ command: 'RETURN_HOME' })
302302
}
303303

304304
public async send_checkpoints() {
@@ -1006,7 +1006,7 @@ export class PanelProvider implements vscode.WebviewViewProvider {
10061006
await handle_voice_input(this, message)
10071007
} else if (message.command == 'GET_SETUP_PROGRESS') {
10081008
await this.send_setup_progress()
1009-
} else if (message.command == 'RETURN_HOME') {
1009+
} else if (message.command == 'REQUEST_RETURN_HOME') {
10101010
await this.return_home_and_switch_to_edit_context()
10111011
} else if (
10121012
message.command == 'GET_FIND_RELEVANT_FILES_SHRINK_SOURCE_CODE'

‎apps/editor/src/views/panel/frontend/Main/MainView/MainView.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export const MainView: React.FC<Props> = (props) => {
225225
id="shrink-source-code"
226226
/>
227227
<label htmlFor="shrink-source-code">
228-
Remove function bodies and comments
228+
{t('home.shrink-source-code')}
229229
</label>
230230
</div>
231231
)}

‎apps/editor/src/views/panel/frontend/Panel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ export const Panel = () => {
326326
}}
327327
is_connected={is_connected}
328328
on_show_home={() => {
329-
post_message(vscode, { command: 'RETURN_HOME' })
329+
post_message(vscode, { command: 'REQUEST_RETURN_HOME' })
330330
}}
331331
ask_instructions={
332332
ask_about_context_instructions.instructions[

‎apps/editor/src/views/panel/frontend/i18n/translations/home.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,23 @@ export const home = {
125125
cs: 'Copyright © {year} {link}',
126126
hu: 'Szerzői jog © {year} {link}',
127127
bg: 'Авторско право © {year} {link}'
128+
},
129+
'home.shrink-source-code': {
130+
en: 'Strip function bodies and comments',
131+
pl: 'Usuń ciała funkcji i komentarze',
132+
'zh-cn': '剥离函数体和注释',
133+
ja: '関数本体とコメントを取り除く',
134+
'zh-tw': '剝離函數主體和註釋',
135+
de: 'Funktionskörper und Kommentare entfernen',
136+
es: 'Eliminar cuerpos de funciones y comentarios',
137+
fr: 'Supprimer les corps de fonction et les commentaires',
138+
'pt-br': 'Remover corpos de funções e comentários',
139+
ru: 'Удалить тела функций и комментарии',
140+
ko: '함수 본문 및 주석 제거',
141+
it: 'Rimuovi corpi di funzioni e commenti',
142+
tr: 'İşlev gövdelerini ve yorumları kaldır',
143+
cs: 'Odstranit těla funkcí a komentáře',
144+
hu: 'Függvénytestek és megjegyzések eltávolítása',
145+
bg: 'Премахване на телата на функциите и коментарите'
128146
}
129147
} as const

‎apps/editor/src/views/panel/types/messages.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,10 @@ export interface SetupProgressMessage {
571571
setup_progress: SetupProgress
572572
}
573573

574+
export interface RequestReturnHomeMessage extends BaseMessage {
575+
command: 'REQUEST_RETURN_HOME'
576+
}
577+
574578
export interface InsertSymbolAtCursorMessage extends BaseMessage {
575579
command: 'INSERT_SYMBOL_AT_CURSOR'
576580
text: string
@@ -671,7 +675,7 @@ export type FrontendMessage =
671675
| GetFindRelevantFilesShrinkSourceCodeMessage
672676
| SaveFindRelevantFilesShrinkSourceCodeMessage
673677
| GetSetupProgressMessage
674-
| ReturnHomeMessage
678+
| RequestReturnHomeMessage
675679

676680
// === FROM BACKEND TO FRONTEND ===
677681
export interface InstructionsMessage extends BaseMessage {

0 commit comments

Comments
 (0)