Skip to content

Commit 87f4930

Browse files
committed
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`
1 parent b0bd19d commit 87f4930

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@
325325
"default": "",
326326
"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."
327327
},
328+
"powershell.developer.featureFlags": {
329+
"type": "array",
330+
"default": [],
331+
"description": "An array of strings used to enable experimental features in the PowerShell extension."
332+
},
328333
"powershell.developer.powerShellExePath": {
329334
"type": "string",
330335
"default": "",

scripts/Start-EditorServices.ps1

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ param(
5858
[string]
5959
$DebugServiceOnly,
6060

61+
[string[]]
62+
$FeatureFlags,
63+
6164
[switch]
6265
$WaitForDebugger,
6366

src/session.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,15 @@ export class SessionManager {
266266

267267
var editorServicesLogPath = this.log.getLogFilePath("EditorServices");
268268

269+
var featureFlags =
270+
this.sessionSettings.developer.featureFlags !== undefined
271+
? this.sessionSettings.developer.featureFlags.map(f => `'${f}'`).join(', ')
272+
: "";
273+
269274
startArgs +=
270-
"-LogPath '" + editorServicesLogPath + "' " +
271-
"-SessionDetailsPath '" + utils.getSessionFilePath() + "' ";
275+
`-LogPath '${editorServicesLogPath}' ` +
276+
`-SessionDetailsPath '${utils.getSessionFilePath()}' ` +
277+
`-FeatureFlags @(${featureFlags})`
272278

273279
var powerShellArgs = [
274280
"-NoProfile",

src/settings.ts

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface IScriptAnalysisSettings {
2323
}
2424

2525
export interface IDeveloperSettings {
26+
featureFlags?: string[];
2627
powerShellExePath?: string;
2728
bundledModulesPath?: string;
2829
editorServicesLogLevel?: string;
@@ -47,6 +48,7 @@ export function load(myPluginId: string): ISettings {
4748
};
4849

4950
let defaultDeveloperSettings: IDeveloperSettings = {
51+
featureFlags: [],
5052
powerShellExePath: undefined,
5153
bundledModulesPath: undefined,
5254
editorServicesLogLevel: "Normal",

0 commit comments

Comments
 (0)