Skip to content

Commit 12afd9c

Browse files
committed
Add initial support for feature flags
This change adds initial support for feature flags in the EditorServicesHost so that we can enable new experimental features conditionally while maintaining current behavior for most users.
1 parent d8245f1 commit 12afd9c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

module/PowerShellEditorServices/PowerShellEditorServices.psm1

+6-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ function Start-EditorServicesHost {
5252
[string]
5353
$DebugServiceOnly,
5454

55+
[string[]]
56+
[ValidateNotNull()]
57+
$FeatureFlags = @(),
58+
5559
[switch]
5660
$WaitForDebugger
5761
)
@@ -65,7 +69,8 @@ function Start-EditorServicesHost {
6569
$hostDetails,
6670
$BundledModulesPath,
6771
$EnableConsoleRepl.IsPresent,
68-
$WaitForDebugger.IsPresent)
72+
$WaitForDebugger.IsPresent,
73+
$FeatureFlags)
6974

7075
# Build the profile paths using the root paths of the current $profile variable
7176
$profilePaths = New-Object Microsoft.PowerShell.EditorServices.Session.ProfilePaths @(

src/PowerShellEditorServices.Host/EditorServicesHost.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.PowerShell.EditorServices.Session;
99
using Microsoft.PowerShell.EditorServices.Utility;
1010
using System;
11+
using System.Collections.Generic;
1112
using System.Diagnostics;
1213
using System.Reflection;
1314
using System.Threading;
@@ -33,6 +34,7 @@ public class EditorServicesHost
3334
private HostDetails hostDetails;
3435
private string bundledModulesPath;
3536
private DebugAdapter debugAdapter;
37+
private HashSet<string> featureFlags;
3638
private LanguageServer languageServer;
3739

3840
#endregion
@@ -60,13 +62,15 @@ public EditorServicesHost(
6062
HostDetails hostDetails,
6163
string bundledModulesPath,
6264
bool enableConsoleRepl,
63-
bool waitForDebugger)
65+
bool waitForDebugger,
66+
string[] featureFlags)
6467
{
6568
Validate.IsNotNull(nameof(hostDetails), hostDetails);
6669

6770
this.hostDetails = hostDetails;
6871
this.enableConsoleRepl = enableConsoleRepl;
6972
this.bundledModulesPath = bundledModulesPath;
73+
this.featureFlags = new HashSet<string>(featureFlags ?? new string[0]);
7074

7175
#if DEBUG
7276
int waitsRemaining = 10;

0 commit comments

Comments
 (0)