File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -117,13 +117,30 @@ impl ScopeAutocompleter {
117117
118118 Ok ( scopes)
119119 }
120+
121+ fn get_config_scopes ( & self ) -> Vec < String > {
122+ self . config . commit_scopes . keys ( ) . cloned ( ) . collect ( )
123+ }
124+
125+ fn get_all_scopes ( & self ) -> Vec < String > {
126+ let mut scopes = self . get_config_scopes ( ) ;
127+ let existing_scopes = self . get_existing_scopes ( ) . unwrap_or_default ( ) ;
128+
129+ // Add existing scopes that aren't already in the config scopes
130+ for scope in existing_scopes {
131+ if !scopes. contains ( & scope) {
132+ scopes. push ( scope) ;
133+ }
134+ }
135+
136+ scopes
137+ }
120138}
121139
122140impl Autocomplete for ScopeAutocompleter {
123141 fn get_suggestions ( & mut self , input : & str ) -> Result < Vec < String > , CustomUserError > {
124- let existing_scopes = self . get_existing_scopes ( ) . unwrap_or_default ( ) ;
125-
126- Ok ( existing_scopes
142+ let all_scopes = self . get_all_scopes ( ) ;
143+ Ok ( all_scopes
127144 . iter ( )
128145 . filter ( |s| s. contains ( input) )
129146 . cloned ( )
You can’t perform that action at this time.
0 commit comments