mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-10-26 18:41:18 +00:00
Add the SearchMaxResults const
This commit is contained in:
parent
9b64204771
commit
c9b6c6a117
|
|
@ -19,6 +19,7 @@ namespace WelsonJS.Launcher.ResourceTools
|
|||
private readonly HttpClient _httpClient;
|
||||
private const string Prefix = "completion/";
|
||||
private readonly ConcurrentBag<string> DiscoveredExecutables = new ConcurrentBag<string>();
|
||||
private const int SearchMaxResults = 200;
|
||||
|
||||
public Completion(ResourceServer server, HttpClient httpClient)
|
||||
{
|
||||
|
|
@ -45,7 +46,7 @@ namespace WelsonJS.Launcher.ResourceTools
|
|||
{
|
||||
List<CompletionItem> completionItems = DiscoveredExecutables.ToList()
|
||||
.Where(exec => exec.IndexOf(word, 0, StringComparison.OrdinalIgnoreCase) > -1)
|
||||
.Take(100) // Limit the number of results
|
||||
.Take(SearchMaxResults) // Limit the number of results
|
||||
.Select(exec => new CompletionItem
|
||||
{
|
||||
Label = Path.GetFileName(exec),
|
||||
|
|
@ -162,8 +163,9 @@ namespace WelsonJS.Launcher.ResourceTools
|
|||
try
|
||||
{
|
||||
var executableFiles = Directory.GetFiles(path, "*.exe", searchOption)
|
||||
.OrderByDescending(f => new FileInfo(f).Length)
|
||||
.ToList();
|
||||
.Take(SearchMaxResults)
|
||||
.OrderByDescending(f => new FileInfo(f).Length)
|
||||
.ToList();
|
||||
|
||||
AddDiscoveredExecutables(executableFiles);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user