mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-10-27 02:51:17 +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 readonly HttpClient _httpClient;
|
||||||
private const string Prefix = "completion/";
|
private const string Prefix = "completion/";
|
||||||
private readonly ConcurrentBag<string> DiscoveredExecutables = new ConcurrentBag<string>();
|
private readonly ConcurrentBag<string> DiscoveredExecutables = new ConcurrentBag<string>();
|
||||||
|
private const int SearchMaxResults = 200;
|
||||||
|
|
||||||
public Completion(ResourceServer server, HttpClient httpClient)
|
public Completion(ResourceServer server, HttpClient httpClient)
|
||||||
{
|
{
|
||||||
|
|
@ -45,7 +46,7 @@ namespace WelsonJS.Launcher.ResourceTools
|
||||||
{
|
{
|
||||||
List<CompletionItem> completionItems = DiscoveredExecutables.ToList()
|
List<CompletionItem> completionItems = DiscoveredExecutables.ToList()
|
||||||
.Where(exec => exec.IndexOf(word, 0, StringComparison.OrdinalIgnoreCase) > -1)
|
.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
|
.Select(exec => new CompletionItem
|
||||||
{
|
{
|
||||||
Label = Path.GetFileName(exec),
|
Label = Path.GetFileName(exec),
|
||||||
|
|
@ -162,8 +163,9 @@ namespace WelsonJS.Launcher.ResourceTools
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var executableFiles = Directory.GetFiles(path, "*.exe", searchOption)
|
var executableFiles = Directory.GetFiles(path, "*.exe", searchOption)
|
||||||
.OrderByDescending(f => new FileInfo(f).Length)
|
.Take(SearchMaxResults)
|
||||||
.ToList();
|
.OrderByDescending(f => new FileInfo(f).Length)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
AddDiscoveredExecutables(executableFiles);
|
AddDiscoveredExecutables(executableFiles);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user