Skip to content

Commit fd32c9b

Browse files
committed
Skip shrink prompt when token counts match in intelligent search and remove unused home.shrink-source-code translation
- should not show quick pick: send in full/strip bodies if both have the same amount of tokens ``` └── apps └── editor └── src └── features └── search-files ├── index.ts ├── search-files.ts ├── search-modes │ ├── perform-intelligent-search-mode.ts │ ├── perform-keywords-search-mode.ts │ └── perform-phrase-search-mode.ts └── utils ├── analyze-files.ts ├── check-matches-condition.ts ├── create-search-regex.ts ├── prompt-for-config.ts ├── prompt-for-intelligent-search-results.ts ├── prompt-for-keywords-match-mode.ts ├── prompt-for-keywords-target.ts ├── prompt-for-search-mode.ts ├── prompt-for-search-results.ts ├── prompt-for-search-term.ts ├── prompt-for-shrink-mode.ts ├── search-files-by-intelligent.ts ├── search-files-by-keywords.ts ├── search-files-by-phrase.ts └── show-search-results-quick-pick.ts ```
1 parent 6152c48 commit fd32c9b

2 files changed

Lines changed: 28 additions & 37 deletions

File tree

‎apps/editor/src/features/search-files/search-modes/perform-intelligent-search-mode.ts‎

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,27 +93,32 @@ export const perform_intelligent_search_mode = async (params: {
9393
let go_back_to_term = false
9494

9595
while (true) {
96-
const should_shrink =
97-
params.extension_context.workspaceState.get<boolean>(
96+
let shrink_result: boolean | 'back' | 'cancel' = false
97+
const skip_shrink = analysis.full_tokens == analysis.shrink_tokens
98+
99+
if (!skip_shrink) {
100+
const should_shrink =
101+
params.extension_context.workspaceState.get<boolean>(
102+
LAST_INTELLIGENT_FILE_SEARCH_SHRINK_STATE_KEY,
103+
false
104+
)
105+
shrink_result = await prompt_for_shrink_mode({
106+
should_shrink,
107+
full_tokens: analysis.full_tokens,
108+
shrink_tokens: analysis.shrink_tokens
109+
})
110+
111+
if (shrink_result == 'back') {
112+
go_back_to_term = true
113+
break
114+
}
115+
if (shrink_result == 'cancel') return undefined
116+
117+
await params.extension_context.workspaceState.update(
98118
LAST_INTELLIGENT_FILE_SEARCH_SHRINK_STATE_KEY,
99-
false
119+
shrink_result
100120
)
101-
const shrink_result = await prompt_for_shrink_mode({
102-
should_shrink,
103-
full_tokens: analysis.full_tokens,
104-
shrink_tokens: analysis.shrink_tokens
105-
})
106-
107-
if (shrink_result == 'back') {
108-
go_back_to_term = true
109-
break
110121
}
111-
if (shrink_result == 'cancel') return undefined
112-
113-
await params.extension_context.workspaceState.update(
114-
LAST_INTELLIGENT_FILE_SEARCH_SHRINK_STATE_KEY,
115-
shrink_result
116-
)
117122

118123
let go_back_to_shrink = false
119124

@@ -207,7 +212,11 @@ export const perform_intelligent_search_mode = async (params: {
207212
)
208213

209214
if (action == 'back') {
210-
go_back_to_shrink = true
215+
if (skip_shrink) {
216+
go_back_to_term = true
217+
} else {
218+
go_back_to_shrink = true
219+
}
211220
break
212221
}
213222
if (!action) return undefined

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,24 +107,6 @@ export const home = {
107107
hu: 'Szerzői jog © {year} {link}',
108108
bg: 'Авторско право © {year} {link}'
109109
},
110-
'home.shrink-source-code': {
111-
en: 'Strip function bodies',
112-
pl: 'Usuń ciała funkcji',
113-
'zh-cn': '剥离函数体',
114-
ja: '関数本体を取り除く',
115-
'zh-tw': '剝離函數主體',
116-
de: 'Funktionskörper entfernen',
117-
es: 'Eliminar cuerpos de funciones',
118-
fr: 'Supprimer les corps de fonction',
119-
'pt-br': 'Remover corpos de funções',
120-
ru: 'Удалить тела функций',
121-
ko: '함수 본문 제거',
122-
it: 'Rimuovi corpi di funzioni',
123-
tr: 'İşlev gövdelerini kaldır',
124-
cs: 'Odstranit těla funkcí',
125-
hu: 'Függvénytestek eltávolítása',
126-
bg: 'Премахване на телата на функциите'
127-
},
128110
'home.target.web.description': {
129111
en: 'Copy prompts',
130112
pl: 'Kopiuj prompty',

0 commit comments

Comments
 (0)