warning - extreme stupid levels detected

(98%)  ■■■■■■■■■□
This commit is contained in:
Mike Griese
2025-08-07 16:09:57 -05:00
parent 73bc438042
commit 906602090d
3 changed files with 24 additions and 3 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -374,5 +374,9 @@ namespace Microsoft.CommandPalette.Extensions
void InitializeWithHost(IExtensionHost host);
};
[contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)]
interface ICommandProvider2 requires ICommandProvider
{
Object[] GetApiExtensionStubs();
};
}