Skip to content

Commit

Permalink
Stop trying to de-duplicate completion results (#3897)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxian-dbw committed Dec 11, 2023
1 parent ff4bbd5 commit f2207f4
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions PSReadLine/Completion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,31 +298,6 @@ private CommandCompletion GetCompletions()
var length = _tabCompletions.ReplacementLength;
if (start < 0 || start > _singleton._buffer.Length) return null;
if (length < 0 || length > (_singleton._buffer.Length - start)) return null;

if (_tabCompletions.CompletionMatches.Count > 1)
{
// Filter out apparent duplicates -- the 'ListItemText' is exactly the same.
var hashSet = new HashSet<string>();
var matches = _tabCompletions.CompletionMatches;
List<int> indices = null;

for (int i = 0; i < matches.Count; i++)
{
if (!hashSet.Add(matches[i].ListItemText))
{
indices ??= new List<int>();
indices.Add(i);
}
}

if (indices is not null)
{
for (int i = indices.Count - 1; i >= 0; i--)
{
matches.RemoveAt(indices[i]);
}
}
}
}
catch (Exception)
{
Expand Down

0 comments on commit f2207f4

Please sign in to comment.