[PT Run] [Settings plugin] Add new settings (#13746)

* Add entries for settings tools (#13741)

* Add UAC entry (#13743)

* fix typo

* Add entries for environment vars (#13734)

* fix typos

* fixes

* Improvements

* fix resource strings

* Fix merge conflicts

* update system env vars command

* fix json schema

* Update settings

* fix typo

* add firstResultScore

* fix typos
This commit is contained in:
Heiko
2021-11-10 17:38:27 +01:00
committed by GitHub
parent fb97ce040b
commit 2c9b86d873
8 changed files with 2079 additions and 1824 deletions

View File

@@ -146,6 +146,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
var lowScore = 1_000;
var mediumScore = 5_000;
var highScore = 10_000;
var firstResultScore = 10_500;
foreach (var result in resultList)
{
@@ -158,43 +159,44 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
if (windowsSetting.Name.StartsWith(query, StringComparison.CurrentCultureIgnoreCase))
{
result.Score = highScore--;
result.Score = !windowsSetting.ShowAsFirstResult ? highScore-- : firstResultScore--;
continue;
}
// If query starts with second or next word of name, set score.
if (windowsSetting.Name.Contains($" {query}", StringComparison.CurrentCultureIgnoreCase))
{
result.Score = mediumScore--;
result.Score = !windowsSetting.ShowAsFirstResult ? mediumScore-- : firstResultScore--;
continue;
}
if (windowsSetting.Areas is null)
{
result.Score = lowScore--;
result.Score = !windowsSetting.ShowAsFirstResult ? lowScore-- : firstResultScore--;
continue;
}
if (windowsSetting.Areas.Any(x => x.StartsWith(query, StringComparison.CurrentCultureIgnoreCase)))
{
result.Score = lowScore--;
result.Score = !windowsSetting.ShowAsFirstResult ? lowScore-- : firstResultScore--;
continue;
}
if (windowsSetting.AltNames is null)
{
result.Score = lowScore--;
result.Score = !windowsSetting.ShowAsFirstResult ? lowScore-- : firstResultScore--;
continue;
}
if (windowsSetting.AltNames.Any(x => x.StartsWith(query, StringComparison.CurrentCultureIgnoreCase)))
{
result.Score = mediumScore--;
result.Score = !windowsSetting.ShowAsFirstResult ? mediumScore-- : firstResultScore--;
continue;
}
}
result.Score = lowScore--;
// On empty queries
result.Score = !windowsSetting.ShowAsFirstResult ? lowScore-- : firstResultScore--;
}
}