Skip to content

Commit 27c1aea

Browse files
committed
Require file selection before triggering searches in quick pick menus and standardize notification messages
- place feature.search-files.info.no-files-selected in common (rename properly), use also by `apps/editor/src/commands/select-referencing-files-commands/select-referencing-files-commands.ts` - 'select imported files' should also use common.info.select-files-to-search └── apps └── editor └── src ├── commands │ ├── search-files-commands │ │ ├── index.ts │ │ ├── search-files-commands.ts │ │ └── utils │ │ ├── get-target-folder-path.ts │ │ └── prompt-for-provided-results.ts │ ├── select-imported-files-commands │ │ ├── index.ts │ │ ├── select-imported-files-commands.ts │ │ └── utils │ │ ├── is-valid-uri.ts │ │ └── prompt-for-imported-files.ts │ └── select-referencing-files-commands │ ├── index.ts │ ├── select-referencing-files-commands.ts │ └── utils │ ├── get-referencing-files-for-position.ts │ ├── get-referencing-files-for-uris.ts │ └── prompt-for-referencing-files.ts ├── features │ └── search-files │ └── utils │ ├── prompt-for-intelligent-search-results.ts │ └── prompt-for-search-results.ts └── i18n └── translations ├── commands │ └── select-imported-files.ts ├── common.ts └── features └── search-files.ts
1 parent 9b712a7 commit 27c1aea

9 files changed

Lines changed: 39 additions & 27 deletions

File tree

‎apps/editor/src/commands/search-files-commands/utils/prompt-for-provided-results.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const prompt_for_provided_results = async (params: {
116116

117117
if (selected.length == 0) {
118118
vscode.window.showInformationMessage(
119-
t('feature.search-files.info.no-files-selected')
119+
t('common.info.select-files-to-search')
120120
)
121121
return
122122
}

‎apps/editor/src/commands/select-imported-files-commands/select-imported-files-commands.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const select_imported_files_commands = (
6565
async () => {
6666
const checked_files = workspace_provider.get_checked_files()
6767

68-
if (checked_files.length === 0) {
68+
if (checked_files.length == 0) {
6969
vscode.window.showInformationMessage(
7070
t('command.select-imported-files.no-valid-files')
7171
)

‎apps/editor/src/commands/select-imported-files-commands/utils/prompt-for-imported-files.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ export const prompt_for_imported_files = async (params: {
281281
quick_pick.hide()
282282
} else if (button === search_button) {
283283
current_selected_items = [...quick_pick.selectedItems]
284+
if (current_selected_items.length == 0) {
285+
vscode.window.showInformationMessage(
286+
t('common.info.select-files-to-search')
287+
)
288+
return
289+
}
284290
resolve('search')
285291
quick_pick.hide()
286292
} else if (button === deep_search_button) {

‎apps/editor/src/commands/select-referencing-files-commands/select-referencing-files-commands.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export const select_referencing_files_commands = (
205205
try {
206206
const checked_files = workspace_provider.get_checked_files()
207207

208-
if (checked_files.length === 0) {
208+
if (checked_files.length == 0) {
209209
vscode.window.showInformationMessage(
210210
t('command.select-referencing-files.no-files')
211211
)

‎apps/editor/src/commands/select-referencing-files-commands/utils/prompt-for-referencing-files.ts‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,17 @@ export const prompt_for_referencing_files = async (params: {
124124
if (button === close_button) {
125125
resolve(undefined)
126126
quick_pick.hide()
127-
} else if (button === search_button) {
128-
current_selected_items = [...quick_pick.selectedItems]
129-
resolve('search')
130-
quick_pick.hide()
127+
} else if (button === search_button) {
128+
current_selected_items = [...quick_pick.selectedItems]
129+
if (current_selected_items.length == 0) {
130+
vscode.window.showInformationMessage(
131+
t('common.info.select-files-to-search')
132+
)
133+
return
131134
}
135+
resolve('search')
136+
quick_pick.hide()
137+
}
132138
})
133139

134140
quick_pick.onDidAccept(() => {

‎apps/editor/src/features/search-files/utils/prompt-for-intelligent-search-results.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export const prompt_for_intelligent_search_results = async (params: {
189189

190190
if (selected.length == 0) {
191191
vscode.window.showInformationMessage(
192-
t('feature.search-files.info.no-files-selected')
192+
t('common.info.select-files-to-search')
193193
)
194194
return
195195
}

‎apps/editor/src/features/search-files/utils/prompt-for-search-results.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export const prompt_for_search_results = async (params: {
174174

175175
if (selected.length == 0) {
176176
vscode.window.showInformationMessage(
177-
t('feature.search-files.info.no-files-selected')
177+
t('common.info.select-files-to-search')
178178
)
179179
return
180180
}

‎apps/editor/src/i18n/translations/common.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,5 +504,23 @@ export const translations = {
504504
cs: 'Nebyly nalezeny žádné konfigurace pro volání API. Přidejte v nastavení.',
505505
hu: 'Nem találhatók API hívási konfigurációk. Adja hozzá a beállításokban.',
506506
bg: 'Не са намерени конфигурации за API извиквания. Добавете в настройките.'
507+
},
508+
'common.info.select-files-to-search': {
509+
en: 'Please select files to search.',
510+
pl: 'Proszę wybrać pliki do przeszukania.',
511+
'zh-cn': '请选择要搜索的文件。',
512+
ja: '検索するファイルを選択してください。',
513+
'zh-tw': '請選擇要搜尋的檔案。',
514+
de: 'Bitte wählen Sie Dateien für die Suche aus.',
515+
es: 'Por favor, seleccione los archivos para buscar.',
516+
fr: 'Veuillez sélectionner les fichiers à rechercher.',
517+
'pt-br': 'Por favor, selecione os arquivos para pesquisar.',
518+
ru: 'Пожалуйста, выберите файлы для поиска.',
519+
ko: '검색할 파일을 선택하세요.',
520+
it: 'Seleziona i file da cercare.',
521+
tr: 'Lütfen aranacak dosyaları seçin.',
522+
cs: 'Vyberte soubory, ve kterých chcete hledat.',
523+
hu: 'Kérjük, válassza ki a keresendő fájlokat.',
524+
bg: 'Моля, изберете файлове за търсене.'
507525
}
508526
} as const

‎apps/editor/src/i18n/translations/features/search-files.ts‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -970,23 +970,5 @@ export const translations = {
970970
cs: 'Neodpovídající vybrané soubory',
971971
hu: 'Nem egyező kiválasztott fájlok',
972972
bg: 'Несъвпадащи избрани файлове'
973-
},
974-
'feature.search-files.info.no-files-selected': {
975-
en: 'Please select results search in.',
976-
pl: 'Proszę wybrać wyniki do przeszukania.',
977-
'zh-cn': '请选择要搜索的结果。',
978-
ja: '検索する結果を選択してください。',
979-
'zh-tw': '請選擇要搜尋的結果。',
980-
de: 'Bitte wählen Sie Ergebnisse für die Suche aus.',
981-
es: 'Por favor, seleccione los resultados en los que buscar.',
982-
fr: 'Veuillez sélectionner les résultats dans lesquels rechercher.',
983-
'pt-br': 'Por favor, selecione os resultados para pesquisar.',
984-
ru: 'Пожалуйста, выберите результаты для поиска.',
985-
ko: '검색할 결과를 선택하세요.',
986-
it: 'Seleziona i risultati in cui cercare.',
987-
tr: 'Lütfen arama yapılacak sonuçları seçin.',
988-
cs: 'Vyberte výsledky, ve kterých chcete hledat.',
989-
hu: 'Kérjük, válassza ki a keresendő eredményeket.',
990-
bg: 'Моля, изберете резултати, в които да търсите.'
991973
}
992974
} as const

0 commit comments

Comments
 (0)