From 1fb7a525e8fbec2345dc0876653e0bcfd280be3d Mon Sep 17 00:00:00 2001 From: Kelvin Schoofs Date: Thu, 2 Jun 2022 18:57:26 +0200 Subject: [PATCH] Add `subscribeToGlobalFlags` to use up-to-date global flags --- CHANGELOG.md | 10 +++++++++- src/config.ts | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 104e3c9..14fc488 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ -# Changelog +# + +## Unreleased + +### Changes +- Internally we now have a `subscribeToGlobalFlags` to use up-to-date global flags + - Currently, this makes it that changing the global flags can immediately have an effect for some flags + - Global flags are those defined in your User Settings or Workspace(Folder) Settings + - Mind that if you override those flags by specifying them in your SSH FS config, it'll keep using them ## v1.25.0 (2022-06-01) diff --git a/src/config.ts b/src/config.ts index f84b8a3..2095c3c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -377,6 +377,7 @@ function parseFlagList(list: string[] | undefined, origin: string): Record = [value: V, origin: string]; + +const globalFlagsSubscribers = new Set<() => void>(); +export function subscribeToGlobalFlags(listener: () => void): vscode.Disposable { + listener(); + globalFlagsSubscribers.add(listener); + return new vscode.Disposable(() => globalFlagsSubscribers.delete(listener)); +} + export const DEFAULT_FLAGS: string[] = []; let cachedFlags: Record = {}; function calculateFlags(): Record {