@@ -7,9 +7,10 @@ export type SearchCompletionItem = CompletionItem<
77 SearchCompletionOperator | SearchCompletionCommand | SearchCompletionValue
88> ;
99
10- export interface SearchCompletionCommand {
11- command : 'toggle-natural-language-mode' ;
12- }
10+ export type SearchCompletionCommand =
11+ | { command : 'toggle-natural-language-mode' }
12+ | { command : 'pick-author' | 'pick-file' ; multi ?: boolean }
13+ | { command : 'pick-folder' | 'pick-ref' ; multi ?: never } ;
1314
1415export interface SearchCompletionValue {
1516 /** The operator this value belongs to */
@@ -28,8 +29,10 @@ export const naturalLanguageSearchAutocompleteCommand: CompletionItem<SearchComp
2829} ;
2930
3031export interface SearchCompletionOperatorValue {
31- /** The value to suggest */
32- value : string ;
32+ /** The value to suggest or command to execute when this value is selected */
33+ value : string | SearchCompletionCommand ;
34+ /** Label to display in autocomplete */
35+ label : string ;
3336 /** Description of what this value does (shown in autocomplete list) */
3437 description : string ;
3538 /** Icon to display in autocomplete */
@@ -47,7 +50,7 @@ export interface SearchCompletionOperator {
4750 icon ?: string ;
4851 /** Example usage */
4952 example ?: TemplateResult ;
50- /** Predefined values to suggest for this operator */
53+ /** Predefined values to suggest for this operator (can include commands that help populate values) */
5154 values ?: SearchCompletionOperatorValue [ ] ;
5255}
5356
@@ -70,6 +73,14 @@ export const searchCompletionOperators: SearchCompletionOperator[] = [
7073 aliases : [ '@:' ] ,
7174 example : html `Use a name or email, e.g. < code > author:eamodio</ code > , < code > @:john</ code > , or
7275 < code > @me</ code > for your own commits` ,
76+ values : [
77+ {
78+ value : { command : 'pick-author' , multi : true } ,
79+ label : 'Choose authors\u2026' ,
80+ description : 'Select one or more contributors to filter by' ,
81+ icon : 'person' ,
82+ } ,
83+ ] ,
7384 } ,
7485 {
7586 operator : 'commit:' ,
@@ -85,6 +96,14 @@ export const searchCompletionOperators: SearchCompletionOperator[] = [
8596 aliases : [ '^:' ] ,
8697 example : html `Use a reference to filter, e.g. < code > ref:main</ code > or < code > ^:v1.0.0</ code > , or a range to
8798 compare, e.g. < code > ref:main..feature</ code > (commits in feature but not in main)` ,
99+ values : [
100+ {
101+ value : { command : 'pick-ref' } ,
102+ label : 'Choose a branch, tag, or range\u2026' ,
103+ description : 'Select a branch, tag, or range to filter by' ,
104+ icon : 'git-branch' ,
105+ } ,
106+ ] ,
88107 } ,
89108 {
90109 operator : 'type:' ,
@@ -95,11 +114,13 @@ export const searchCompletionOperators: SearchCompletionOperator[] = [
95114 values : [
96115 {
97116 value : 'stash' ,
117+ label : 'stash' ,
98118 description : 'Filter commits to only show stashes' ,
99119 icon : 'archive' ,
100120 } ,
101121 {
102122 value : 'tip' ,
123+ label : 'tip' ,
103124 description : 'Filter commits to only show commits pointed to by branches or tags' ,
104125 icon : 'git-branch' ,
105126 } ,
@@ -112,6 +133,20 @@ export const searchCompletionOperators: SearchCompletionOperator[] = [
112133 aliases : [ '?:' ] ,
113134 example : html `Use a path or filename, e.g. < code > file:package.json</ code > , or a glob, e.g.
114135 < code > ?:src/**/*.ts</ code > ` ,
136+ values : [
137+ {
138+ value : { command : 'pick-file' , multi : true } ,
139+ label : 'Choose files\u2026' ,
140+ description : 'Select one or more files to filter by' ,
141+ icon : 'file' ,
142+ } ,
143+ {
144+ value : { command : 'pick-folder' } ,
145+ label : 'Choose a folder\u2026' ,
146+ description : 'Select a folder to filter by' ,
147+ icon : 'folder' ,
148+ } ,
149+ ] ,
115150 } ,
116151 {
117152 operator : 'change:' ,
0 commit comments