Skip to content

Commit

Permalink
Allow extracting param as resource-derived type (#15282)
Browse files Browse the repository at this point in the history
Fixes #15036 

I've implemented this so that I only show the option for
resource-derived types when extracting parameters when the
resource-derived type would not be a simple type. So in this case I just
show 'object' as an option.

![image](https://github.com/user-attachments/assets/80dba74f-b2ee-49dc-a830-5fc91a9f1d95)
 
Whereas here's an example where I do show the option:

![image](https://github.com/user-attachments/assets/b8c7efab-8de2-4a0b-80be-bffcd29b0cb6)
 
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/15282)
  • Loading branch information
StephenWeatherford authored Oct 21, 2024
1 parent 6dfa4ff commit 12531f1
Show file tree
Hide file tree
Showing 6 changed files with 879 additions and 142 deletions.
14 changes: 9 additions & 5 deletions src/Bicep.LangServer.IntegrationTests/CodeActionTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
using Bicep.Core.CodeAction;
using Bicep.Core.Diagnostics;
using Bicep.Core.Extensions;
using Bicep.Core.Intermediate;
using Bicep.Core.Parsing;
using Bicep.Core.Samples;
using Bicep.Core.Syntax;
using Bicep.Core.Text;
using Bicep.Core.UnitTests;
using Bicep.Core.UnitTests.Assertions;
using Bicep.Core.UnitTests.Features;
using Bicep.Core.UnitTests.PrettyPrintV2;
using Bicep.Core.UnitTests.Serialization;
using Bicep.Core.UnitTests.Utils;
Expand All @@ -39,7 +41,9 @@ public class CodeActionTestBase
private static SemaphoreSlim initialize = new(1);
private static bool isInitialized = false;

protected static ServiceBuilder Services => new();
private static FeatureProviderOverrides FeatureProviderOverrides => new() { ResourceDerivedTypesEnabled = true, ResourceTypedParamsAndOutputsEnabled = true };

protected static ServiceBuilder Services => new ServiceBuilder().WithFeatureOverrides(FeatureProviderOverrides);

protected static readonly SharedLanguageHelperManager DefaultServer = new();

Expand All @@ -61,10 +65,10 @@ public static void ClassInitialize(TestContext testContext)
if (!isInitialized)
{
isInitialized = true;
DefaultServer.Initialize(async () => await MultiFileLanguageServerHelper.StartLanguageServer(testContext));
ServerWithFileResolver.Initialize(async () => await MultiFileLanguageServerHelper.StartLanguageServer(testContext));
ServerWithBuiltInTypes.Initialize(async () => await MultiFileLanguageServerHelper.StartLanguageServer(testContext, services => services.WithNamespaceProvider(BuiltInTestTypes.Create())));
ServerWithNamespaceProvider.Initialize(async () => await MultiFileLanguageServerHelper.StartLanguageServer(testContext, services => services.WithNamespaceProvider(BicepTestConstants.NamespaceProvider)));
DefaultServer.Initialize(async () => await MultiFileLanguageServerHelper.StartLanguageServer(testContext, services => services.WithFeatureOverrides(FeatureProviderOverrides)));
ServerWithFileResolver.Initialize(async () => await MultiFileLanguageServerHelper.StartLanguageServer(testContext, services => services.WithFeatureOverrides(FeatureProviderOverrides)));
ServerWithBuiltInTypes.Initialize(async () => await MultiFileLanguageServerHelper.StartLanguageServer(testContext, services => services.WithNamespaceProvider(BuiltInTestTypes.Create()).WithFeatureOverrides(FeatureProviderOverrides)));
ServerWithNamespaceProvider.Initialize(async () => await MultiFileLanguageServerHelper.StartLanguageServer(testContext, services => services.WithNamespaceProvider(BicepTestConstants.NamespaceProvider).WithFeatureOverrides(FeatureProviderOverrides)));
}
}
finally
Expand Down
Loading

0 comments on commit 12531f1

Please sign in to comment.