@@ -190,36 +190,26 @@ private function getConfigForExtension(ExtensionInterface $extension, ContainerB
190
190
public function complete (CompletionInput $ input , CompletionSuggestions $ suggestions ): void
191
191
{
192
192
if ($ input ->mustSuggestArgumentValuesFor ('name ' )) {
193
- $ suggestions ->suggestValues ($ this ->getAvailableBundles ());
193
+ $ suggestions ->suggestValues ($ this ->getAvailableBundles (! preg_match ( ' /^[A-Z]/ ' , $ input -> getCompletionValue ()) ));
194
194
195
195
return ;
196
196
}
197
197
198
198
if ($ input ->mustSuggestArgumentValuesFor ('path ' ) && null !== $ name = $ input ->getArgument ('name ' )) {
199
- $ path = $ input ->getArgument ('path ' );
200
- $ extension = $ this ->findExtension ($ name );
201
- $ extensionAlias = $ extension ->getAlias ();
202
- $ container = $ this ->compileContainer ();
203
-
204
199
try {
205
- $ config = $ this ->getConfigForPath ($ this ->getConfig ($ extension , $ container ), $ path , $ extensionAlias );
200
+ $ config = $ this ->getConfig ($ this ->findExtension ($ name ), $ this ->compileContainer ());
201
+ $ paths = array_keys (self ::buildPathsCompletion ($ config ));
202
+ $ suggestions ->suggestValues ($ paths );
206
203
} catch (LogicException $ e ) {
207
- $ config = [];
208
204
}
209
-
210
- $ suggestions ->suggestValues (array_keys ($ config ));
211
205
}
212
206
}
213
207
214
- private function getAvailableBundles (): array
208
+ private function getAvailable
10000
Bundles (bool $ alias ): array
215
209
{
216
210
$ availableBundles = [];
217
211
foreach ($ this ->getApplication ()->getKernel ()->getBundles () as $ bundle ) {
218
- $ availableBundles [] = $ bundle ->getName ();
219
-
220
- if ($ extension = $ bundle ->getContainerExtension ()) {
221
- $ availableBundles [] = $ extension ->getAlias ();
222
- }
212
+ $ availableBundles [] = $ alias ? $ bundle ->getContainerExtension ()->getAlias () : $ bundle ->getName ();
223
213
}
224
214
225
215
return $ availableBundles ;
@@ -233,4 +223,18 @@ private function getConfig(ExtensionInterface $extension, ContainerBuilder $cont
233
223
)
234
224
);
235
225
}
226
+
227
+ private static function buildPathsCompletion (array $ paths , string $ prefix = '' ): array
228
+ {
229
+ $ completionPaths = [];
230
+ foreach ($ paths as $ key => $ values ) {
231
+ if (\is_array ($ values )) {
232
+ $ completionPaths = $ completionPaths + self ::buildPathsCompletion ($ values , $ prefix . $ key . '. ' );
233
+ } else {
234
+ $ completionPaths [$ prefix .$ key ] = null ;
235
+ }
236
+ }
237
+
238
+ return $ completionPaths ;
239
+ }
236
240
}
0 commit comments