From 87f4930597713f63ddf2698ce27839bed795f35d Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 20 Mar 2017 11:57:48 -0700 Subject: [PATCH] Add initial support for feature flags This change adds initial support for feature flags in the extension so that we can enable new experimental features conditionally while maintaining current behavior for most users. This introduces a new setting: `powershell.developer.featureFlags` --- package.json | 5 +++++ scripts/Start-EditorServices.ps1 | 3 +++ src/session.ts | 10 ++++++++-- src/settings.ts | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 93348aff9c..065ff87eaf 100644 --- a/package.json +++ b/package.json @@ -325,6 +325,11 @@ "default": "", "description": "Specifies the path to a PowerShell Script Analyzer settings file. Use either an absolute path (to override the default settings for all projects) or use a path relative to your workspace." }, + "powershell.developer.featureFlags": { + "type": "array", + "default": [], + "description": "An array of strings used to enable experimental features in the PowerShell extension." + }, "powershell.developer.powerShellExePath": { "type": "string", "default": "", diff --git a/scripts/Start-EditorServices.ps1 b/scripts/Start-EditorServices.ps1 index ce2545d0fa..0cd349789a 100644 --- a/scripts/Start-EditorServices.ps1 +++ b/scripts/Start-EditorServices.ps1 @@ -58,6 +58,9 @@ param( [string] $DebugServiceOnly, + [string[]] + $FeatureFlags, + [switch] $WaitForDebugger, diff --git a/src/session.ts b/src/session.ts index 28968c844f..f7808914e8 100644 --- a/src/session.ts +++ b/src/session.ts @@ -266,9 +266,15 @@ export class SessionManager { var editorServicesLogPath = this.log.getLogFilePath("EditorServices"); + var featureFlags = + this.sessionSettings.developer.featureFlags !== undefined + ? this.sessionSettings.developer.featureFlags.map(f => `'${f}'`).join(', ') + : ""; + startArgs += - "-LogPath '" + editorServicesLogPath + "' " + - "-SessionDetailsPath '" + utils.getSessionFilePath() + "' "; + `-LogPath '${editorServicesLogPath}' ` + + `-SessionDetailsPath '${utils.getSessionFilePath()}' ` + + `-FeatureFlags @(${featureFlags})` var powerShellArgs = [ "-NoProfile", diff --git a/src/settings.ts b/src/settings.ts index 56ba59bfe2..c18e60af22 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -23,6 +23,7 @@ export interface IScriptAnalysisSettings { } export interface IDeveloperSettings { + featureFlags?: string[]; powerShellExePath?: string; bundledModulesPath?: string; editorServicesLogLevel?: string; @@ -47,6 +48,7 @@ export function load(myPluginId: string): ISettings { }; let defaultDeveloperSettings: IDeveloperSettings = { + featureFlags: [], powerShellExePath: undefined, bundledModulesPath: undefined, editorServicesLogLevel: "Normal",