I’m stuck on Stage Multiple completions #WH6.
As suggested in Builtin completion #QP2 I am using the readline NuGet package. And I am having trouble with one of the test ("$ custom ”. Autocomplete with 1 found match).
The main issue is I am struggling to replicate it on my local:

This is my code:
public string[] GetSuggestions(string text, int index)
{
if (string.IsNullOrWhiteSpace(text))
return null!;
var matches = _commands
.Concat(FileExecuter.FindExecutablesAtPath())
.Where(c => c.StartsWith(text, StringComparison.OrdinalIgnoreCase))
.Distinct()
.OrderBy(c => c)
.ToList();
if (matches.Count == 0)
{
_tabCount = 0;
Console.Write("\x07");
return null!;
}
if (matches.Count == 1)
{
_tabCount = 0;
return [$"{matches[0]} "];
}
...
The failing test:
[tester::#GY5] ✓ Received prompt ($ )
[tester::#GY5] Typed "custom"
[tester::#GY5] ✓ Prompt line matches "$ custom"
[tester::#GY5] Pressed "<TAB>" (expecting autocomplete to "custom_exe_5432")
[your-program] $ custom
[tester::#GY5] ^ Line does not match expected value.
[tester::#GY5] Expected: "$ custom_exe_5432 "
[tester::#GY5] Received: "$ custom"
[tester::#GY5] Assertion failed.
[tester::#GY5] Test failed
But if I update my code:
if (matches.Count == 1)
{
Console.WriteLine(matches[0]); // <- new line added
_tabCount = 0;
return [$"{matches[0]} "];
}
[tester::#GY5] ✓ Received prompt ($ )
[tester::#GY5] Typed "custom"
[tester::#GY5] ✓ Prompt line matches "$ custom"
[tester::#GY5] Pressed "<TAB>" (expecting autocomplete to "custom_exe_6608")
[your-program] $ customcustom_exe_6608
[tester::#GY5] ^ Line does not match expected value.
[tester::#GY5] Expected: "$ custom_exe_6608 "
[tester::#GY5] Received: "$ customcustom_exe_6608"
[tester::#GY5] Assertion failed.
[tester::#GY5] Test failed
Showing that matches[0] does contain custom_exe_6608, it just isn’t showing in the test. Maybe it’s not showing in time? Any help would be appreciated! I’m sure I’m missing something silly ![]()




