Skip to content

Commit dbc31f9

Browse files
committed
(PowerShellGH-1336) Hide syntax aware folding behind a feature flag
Previously the syntax folding was available for all users. However as this is a new feautre which depends on the grammar file which has been unreliable, it was decided to hide this feature behind a flag. The commit adds the logic to only active the syntax folding if the "syntax-folding" feature flag is set in the "powershell.developer.featureFlags" setting.
1 parent cd19f84 commit dbc31f9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/features/Folding.ts

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
LanguageClient,
66
} from "vscode-languageclient";
77
import { IFeature } from "../feature";
8+
import * as Settings from "../settings";
89

910
const tm = getCoreNodeModule("vscode-textmate");
1011
// Returns a node module installed with VSCode, or null if it fails.
@@ -394,6 +395,12 @@ export class FoldingFeature implements IFeature {
394395
private foldingProvider: FoldingProvider;
395396

396397
constructor(documentSelector: DocumentSelector) {
398+
// Hide the syntax folding behind a feature flag
399+
const settings = Settings.load();
400+
if (settings.developer && settings.developer.featureFlags) {
401+
if (settings.developer.featureFlags.indexOf("syntax-folding") === -1) { return; }
402+
}
403+
397404
this.foldingProvider = new FoldingProvider();
398405
vscode.languages.registerFoldingRangeProvider(
399406
documentSelector,

0 commit comments

Comments
 (0)