@@ -20,13 +20,29 @@ public static void Init(PluginInitContext context, Settings settings)
2020 Settings = settings ;
2121 }
2222
23+ private static string GetPathWithActionKeyword ( string path , ResultType type )
24+ {
25+ // one of it is enabled
26+ var keyword = Settings . SearchActionKeywordEnabled ? Settings . SearchActionKeyword : Settings . PathSearchActionKeyword ;
27+
28+ keyword = keyword == Query . GlobalPluginWildcardSign ? string . Empty : keyword + " " ;
29+
30+ var formatted_path = path ;
31+
32+ if ( type == ResultType . Folder )
33+ formatted_path = path . EndsWith ( Constants . DirectorySeperator ) ? path : path + Constants . DirectorySeperator ;
34+
35+ return $ "{ keyword } { formatted_path } ";
36+ }
37+
2338 internal static Result CreateFolderResult ( string title , string subtitle , string path , Query query , int score = 0 , bool showIndexState = false , bool windowsIndexed = false )
2439 {
2540 return new Result
2641 {
2742 Title = title ,
2843 IcoPath = path ,
2944 SubTitle = subtitle ,
45+ AutoCompleteText = GetPathWithActionKeyword ( path , ResultType . Folder ) ,
3046 TitleHighlightData = StringMatcher . FuzzySearch ( query . Search , title ) . MatchData ,
3147 Action = c =>
3248 {
@@ -43,13 +59,9 @@ internal static Result CreateFolderResult(string title, string subtitle, string
4359 return false ;
4460 }
4561 }
46- // one of it is enabled
47- var keyword = Settings . SearchActionKeywordEnabled ? Settings . SearchActionKeyword : Settings . PathSearchActionKeyword ;
48-
49- keyword = keyword == Query . GlobalPluginWildcardSign ? string . Empty : keyword + " " ;
5062
51- string changeTo = path . EndsWith ( Constants . DirectorySeperator ) ? path : path + Constants . DirectorySeperator ;
52- Context . API . ChangeQuery ( $ " { keyword } { changeTo } " ) ;
63+ Context . API . ChangeQuery ( GetPathWithActionKeyword ( path , ResultType . Folder ) ) ;
64+
5365 return false ;
5466 } ,
5567 Score = score ,
@@ -97,6 +109,7 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn
97109 Title = title ,
98110 SubTitle = $ "Use > to search within { subtitleFolderName } , " +
99111 $ "* to search for file extensions or >* to combine both searches.",
112+ AutoCompleteText = GetPathWithActionKeyword ( retrievedDirectoryPath , ResultType . Folder ) ,
100113 IcoPath = retrievedDirectoryPath ,
101114 Score = 500 ,
102115 Action = c =>
@@ -123,6 +136,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score
123136 Title = Path . GetFileName ( filePath ) ,
124137 SubTitle = filePath ,
125138 IcoPath = filePath ,
139+ AutoCompleteText = GetPathWithActionKeyword ( filePath , ResultType . File ) ,
126140 TitleHighlightData = StringMatcher . FuzzySearch ( query . Search , Path . GetFileName ( filePath ) ) . MatchData ,
127141 Score = score ,
128142 Action = c =>
0 commit comments