This commit is contained in:
Yu Leng (from Dev Box)
2025-08-21 14:41:48 +08:00
parent 1e517f2721
commit 4965a72a2e
4 changed files with 35 additions and 0 deletions

View File

@@ -42,6 +42,8 @@ public partial class SettingsModel : ObservableObject
public bool IgnoreShortcutWhenFullscreen { get; set; }
public bool IsePinYinInput { get; set; } = true;
public Dictionary<string, ProviderSettings> ProviderSettings { get; set; } = [];
public Dictionary<string, CommandAlias> Aliases { get; set; } = [];

View File

@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.CommandPalette.Extensions.Toolkit;
public enum MatchLanguage
{
English,
// CJK will be matched by the CJK language pack
Chinese,
Japanese,
Korean,
}

View File

@@ -22,4 +22,6 @@ public partial class MatchOption
public string Suffix { get; set; } = string.Empty;
public bool IgnoreCase { get; set; } = true;
public MatchLanguage Language { get; set; } = MatchLanguage.English;
}

View File

@@ -38,6 +38,16 @@ public partial class StringMatcher
return Instance.FuzzyMatch(query, stringToCompare);
}
public static MatchResult FuzzySearch(string query, string stringToCompare, MatchLanguage language)
{
var opt = new MatchOption
{
Language = language,
};
return Instance.FuzzyMatch(query, stringToCompare, opt);
}
public MatchResult FuzzyMatch(string query, string stringToCompare)
{
try