mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
warning - extreme stupid levels detected
(98%) ■■■■■■■■■□
This commit is contained in:
@@ -153,6 +153,19 @@ public sealed class CommandProviderWrapper
|
||||
// On a BG thread here
|
||||
fallbacks = model.FallbackCommands();
|
||||
|
||||
if (model is ICommandProvider2 two)
|
||||
{
|
||||
var apiExtensions = two.GetApiExtensionStubs();
|
||||
Logger.LogDebug($"Found extensions {apiExtensions.Select(a => a.ToString())}");
|
||||
foreach (var a in apiExtensions)
|
||||
{
|
||||
if (a is ICommand2 command2)
|
||||
{
|
||||
Logger.LogDebug($"Found an ICommand2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Id = model.Id;
|
||||
DisplayName = model.DisplayName;
|
||||
Icon = new(model.Icon);
|
||||
|
||||
@@ -9,7 +9,7 @@ using Windows.Foundation.Collections;
|
||||
|
||||
namespace SamplePagesExtension;
|
||||
|
||||
public partial class SamplePagesCommandsProvider : CommandProvider
|
||||
public partial class SamplePagesCommandsProvider : CommandProvider, ICommandProvider2
|
||||
{
|
||||
public SamplePagesCommandsProvider()
|
||||
{
|
||||
@@ -18,7 +18,6 @@ public partial class SamplePagesCommandsProvider : CommandProvider
|
||||
}
|
||||
|
||||
private readonly ICommandItem[] _commands = [
|
||||
new CommandItem(new SupportCommandsWithProperties()),
|
||||
new CommandItem(new SamplesListPage())
|
||||
{
|
||||
Title = "Sample Pages",
|
||||
@@ -31,6 +30,11 @@ public partial class SamplePagesCommandsProvider : CommandProvider
|
||||
return _commands;
|
||||
}
|
||||
|
||||
public object[] GetApiExtensionStubs()
|
||||
{
|
||||
return [new SupportCommandsWithProperties()];
|
||||
}
|
||||
|
||||
private sealed partial class SupportCommandsWithProperties : ICommand2
|
||||
{
|
||||
public IPropertySet OtherProperties => null;
|
||||
|
||||
@@ -374,5 +374,9 @@ namespace Microsoft.CommandPalette.Extensions
|
||||
void InitializeWithHost(IExtensionHost host);
|
||||
};
|
||||
|
||||
|
||||
[contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)]
|
||||
interface ICommandProvider2 requires ICommandProvider
|
||||
{
|
||||
Object[] GetApiExtensionStubs();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user