@@ -20,13 +20,29 @@ public static void Init(PluginInitContext context, Settings settings)
20
20
Settings = settings ;
21
21
}
22
22
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
+
23
38
internal static Result CreateFolderResult ( string title , string subtitle , string path , Query query , int score = 0 , bool showIndexState = false , bool windowsIndexed = false )
24
39
{
25
40
return new Result
26
41
{
27
42
Title = title ,
28
43
IcoPath = path ,
29
44
SubTitle = subtitle ,
45
+ AutoCompleteText = GetPathWithActionKeyword ( path , ResultType . Folder ) ,
30
46
TitleHighlightData = StringMatcher . FuzzySearch ( query . Search , title ) . MatchData ,
31
47
Action = c =>
32
48
{
@@ -43,13 +59,9 @@ internal static Result CreateFolderResult(string title, string subtitle, string
43
59
return false ;
44
60
}
45
61
}
46
- // one of it is enabled
47
- var keyword = Settings . SearchActionKeywordEnabled ? Settings . SearchActionKeyword : Settings . PathSearchActionKeyword ;
48
-
49
- keyword = keyword == Query . GlobalPluginWildcardSign ? string . Empty : keyword + " " ;
50
62
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
+
53
65
return false ;
54
66
} ,
55
67
Score = score ,
@@ -97,6 +109,7 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn
97
109
Title = title ,
98
110
SubTitle = $ "Use > to search within { subtitleFolderName } , " +
99
111
$ "* to search for file extensions or >* to combine both searches.",
112
+ AutoCompleteText = GetPathWithActionKeyword ( retrievedDirectoryPath , ResultType . Folder ) ,
100
113
IcoPath = retrievedDirectoryPath ,
101
114
Score = 500 ,
102
115
Action = c =>
@@ -123,6 +136,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score
123
136
Title = Path . GetFileName ( filePath ) ,
124
137
SubTitle = filePath ,
125
138
IcoPath = filePath ,
139
+ AutoCompleteText = GetPathWithActionKeyword ( filePath , ResultType . File ) ,
126
140
TitleHighlightData = StringMatcher . FuzzySearch ( query . Search , Path . GetFileName ( filePath ) ) . MatchData ,
127
141
Score = score ,
128
142
Action = c =>
0 commit comments