@@ -2045,18 +2045,34 @@ private void RefreshCommandSuggestions()
20452045 private string [ ] GetCommandSuggestions ( string text )
20462046 {
20472047 // Get a list of command names that could fill in the missing text
2048+ // Store alias suggestions separately and add on end later (so the result contains real commands before aliases)
20482049 List < string > suggestions = new List < string > ( ) ;
2050+ List < string > aliasSuggestions = new List < string > ( ) ;
20492051 string textToLower = text . ToLower ( ) ;
2050- foreach ( string commandName in _commands . Keys )
2052+
2053+ foreach ( Command command in _commands . Values )
20512054 {
2052- if ( ! commandName . StartsWith ( textToLower ) )
2055+ // Check if the command name matches the text
2056+ if ( command . Name . StartsWith ( textToLower ) )
20532057 {
2054- continue ;
2058+ // Combine current input with suggestion so capitalisation remains
2059+ // Add to suggestions list
2060+ suggestions . Add ( text + command . Name . Substring ( text . Length ) ) ;
20552061 }
20562062
2057- // Combine current input with suggestion so capitalisation remains
2058- suggestions . Add ( text + commandName . Substring ( text . Length ) ) ;
2063+ // Iterate over the command aliases
2064+ foreach ( string alias in command . Aliases )
2065+ {
2066+ // Check if this command alias matches the text
2067+ if ( alias . StartsWith ( textToLower ) )
2068+ {
2069+ // Combine current input with suggestion so capitalisation remains
2070+ // Add to alias suggestions list
2071+ aliasSuggestions . Add ( text + alias . Substring ( text . Length ) ) ;
2072+ }
2073+ }
20592074 }
2075+ suggestions . AddRange ( aliasSuggestions ) ;
20602076 return suggestions . ToArray ( ) ;
20612077 }
20622078
0 commit comments