Skip to content

Commit 22b2f00

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 5a1fbb6 commit 22b2f00

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
@@ -6,6 +6,7 @@ import {
66
} from "vscode-languageclient";
77
import { IFeature } from "../feature";
88
import { Logger } from "../logging";
9+
import * as Settings from "../settings";
910

1011
/**
1112
* Defines a grammar file that is in a VS Code Extension
@@ -498,6 +499,12 @@ export class FoldingFeature implements IFeature {
498499
* @param documentSelector documentSelector object for this Folding Provider
499500
*/
500501
constructor(private logger: Logger, documentSelector: DocumentSelector) {
502+
// Hide the syntax folding behind a feature flag
503+
const settings = Settings.load();
504+
if (settings.developer && settings.developer.featureFlags) {
505+
if (settings.developer.featureFlags.indexOf("syntax-folding") === -1) { return; }
506+
}
507+
501508
const grammar: IGrammar = this.grammar(logger);
502509

503510
// If the PowerShell grammar is not available for some reason, don't register a folding provider,

0 commit comments

Comments
 (0)