@@ -5,20 +5,23 @@ import * as vscode from 'vscode'
55import * as path from 'path'
66import { WorkspaceProvider } from '@/context/providers/workspace-provider'
77import { natural_sort } from '@/utils/natural-sort'
8+ import { dictionary } from '@shared/constants/dictionary'
89
910const at_sign_quick_pick = async ( params : {
1011 workspace_provider : WorkspaceProvider
1112 search_value ?: string
1213} ) : Promise < string | undefined > => {
1314 const checked_paths = params . workspace_provider . get_all_checked_paths ( )
1415 if ( checked_paths . length == 0 ) {
15- vscode . window . showWarningMessage ( 'Nothing is selected in context.' )
16+ vscode . window . showWarningMessage (
17+ dictionary . warning_message . NOTHING_SELECTED_IN_CONTEXT
18+ )
1619 return
1720 }
1821
1922 const workspace_roots = params . workspace_provider . getWorkspaceRoots ( )
2023
21- const quick_pick_items = checked_paths
24+ const all_quick_pick_items = checked_paths
2225 . filter ( ( p ) => {
2326 try {
2427 return fs . existsSync ( p ) && fs . statSync ( p ) . isFile ( )
@@ -47,19 +50,31 @@ const at_sign_quick_pick = async (params: {
4750 fullPath : normalized_path
4851 }
4952 } )
50- . filter ( ( item ) => {
51- if ( params . search_value ) {
52- const search_lower = params . search_value . toLowerCase ( )
53- const full_path_lower = item . fullPath . toLowerCase ( )
54- return full_path_lower . includes ( search_lower )
55- }
56- return true
53+
54+ let quick_pick_items_to_show = all_quick_pick_items
55+
56+ if ( params . search_value ) {
57+ const filtered_items = all_quick_pick_items . filter ( ( item ) => {
58+ const search_lower = params . search_value ! . toLowerCase ( )
59+ const filename_lower = item . label . toLowerCase ( )
60+ return filename_lower . includes ( search_lower )
5761 } )
5862
59- quick_pick_items . sort ( ( a , b ) => natural_sort ( a . fullPath , b . fullPath ) )
63+ if ( filtered_items . length > 0 ) {
64+ quick_pick_items_to_show = filtered_items
65+ } else {
66+ vscode . window . showWarningMessage (
67+ dictionary . warning_message . NO_RESULTS_FOR_SEARCH_SHOWING_ALL (
68+ params . search_value
69+ )
70+ )
71+ }
72+ }
73+
74+ quick_pick_items_to_show . sort ( ( a , b ) => natural_sort ( a . fullPath , b . fullPath ) )
6075
6176 const selected_path_item = await vscode . window . showQuickPick (
62- quick_pick_items ,
77+ quick_pick_items_to_show ,
6378 {
6479 placeHolder : 'Select a path to place in the input field' ,
6580 matchOnDescription : true
0 commit comments