Skip to content

Commit 0058f76

Browse files
committed
Handle API search cancellation by returning to configuration quick pick instead of exiting
- cancelling intelligent search ongoing request should re-open quick pick appriopriately - Type '"cancel" | string[]' is not assignable to type 'string[]'. Type 'string' is not assignable to type 'string[]'.ts(2322) prompt-for-intelligent-search-results.ts(9, 3): The expected type comes from property 'extracted_files' which is declared here on type '{ files: string[]; extracted_files: string[]; analysis: FileAnalysisResult; workspace_provider: WorkspaceProvider; restored_selected_paths?: string[] | undefined; restored_unmatched_paths?: string[] | undefined; is_search_in_selected?: boolean | undefined; is_sub_search?: boolean | undefined; }' ⚠ Error (TS2322) | | | Type is not assignable to type . Type is not assignable to type . (property) extracted_files: string[] └── apps └── editor └── src ├── commands │ └── generate-commit-message-commands │ ├── actions │ │ ├── get-prompt-data.ts │ │ └── run-generate-action.ts │ ├── generate-commit-message-commands.ts │ ├── index.ts │ └── utils │ ├── build-commit-message-prompt.ts │ ├── generate-commit-message-with-api.ts │ ├── get-commit-message-config.ts │ └── strip-wrapping-quotes.ts ├── 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 │ └── shrink-file │ ├── index.ts │ ├── languages │ │ ├── c-style.ts │ │ ├── css.ts │ │ ├── html.ts │ │ ├── jsx.ts │ │ ├── python.ts │ │ ├── ruby.ts │ │ └── sql.ts │ └── shrink-file.ts ├── i18n │ └── translations │ └── commands │ └── search-files-command.ts └── utils ├── git-repository-utils.ts └── show-configurations-quick-pick.ts
1 parent 65e7d38 commit 0058f76

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ export const perform_intelligent_search_mode = async (params: {
494494
selected_api_configuration
495495
)
496496

497-
if (api_result === 'error') {
497+
if (api_result === 'error' || api_result === 'cancel') {
498498
show_quick_pick = true
499499
continue
500500
}
@@ -505,15 +505,13 @@ export const perform_intelligent_search_mode = async (params: {
505505
if (go_back_to_action) {
506506
continue
507507
}
508-
509-
if (api_result === 'cancel') return undefined
510508
if (api_result === 'error_no_files') {
511509
vscode.window.showWarningMessage(t('common.info.no-files-found'))
512510
go_back_to_term = true
513511
break
514512
}
515513

516-
if (api_result && api_result !== 'error') {
514+
if (Array.isArray(api_result)) {
517515
let go_back_to_term_from_results = false
518516
let restored_selected_paths: string[] | undefined = undefined
519517
let restored_unmatched_paths: string[] | undefined = undefined

0 commit comments

Comments
 (0)