Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit d7ab0a2

Browse files
committed
Skip private/anonymous types in TypeCompleter results
1 parent 1a01c74 commit d7ab0a2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/UI/Widgets/AutoComplete/TypeCompleter.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using HarmonyLib;
22
using System;
33
using System.Collections.Generic;
4+
using System.Linq;
45
using UniverseLib;
56
using UniverseLib.UI;
67
using UniverseLib.UI.Models;
@@ -67,7 +68,17 @@ public void CacheTypes()
6768
{
6869
allowedTypes = new();
6970
foreach (var entry in ReflectionUtility.AllTypes)
70-
allowedTypes.Add(entry.Value);
71+
{
72+
// skip <PrivateImplementationDetails> and <AnonymousClass> classes
73+
var type = entry.Value;
74+
if (type.FullName.Contains("PrivateImplementationDetails")
75+
|| type.FullName.Contains("DisplayClass")
76+
|| type.FullName.Contains('<'))
77+
{
78+
continue;
79+
}
80+
allowedTypes.Add(type);
81+
}
7182
}
7283
}
7384

0 commit comments

Comments
 (0)