Add `subscribeToGlobalFlags` to use up-to-date global flags

pull/373/head
Kelvin Schoofs 2 years ago
parent cff37d08de
commit 1fb7a525e8

@ -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) ## v1.25.0 (2022-06-01)

@ -377,6 +377,7 @@ function parseFlagList(list: string[] | undefined, origin: string): Record<strin
- Enables debug logging in the ssh2 library (set at the start of each connection) - Enables debug logging in the ssh2 library (set at the start of each connection)
WINDOWS_COMMAND_SEPARATOR (boolean) (default=false) WINDOWS_COMMAND_SEPARATOR (boolean) (default=false)
- Makes it that commands are joined together using ` && ` instead of `; ` - Makes it that commands are joined together using ` && ` instead of `; `
- Automatically enabled when the remote shell is detected to be PowerShell or Command Prompt (cmd.exe)
CHECK_HOME (boolean) (default=true) CHECK_HOME (boolean) (default=true)
- Determines whether we check if the home directory exists during `createFileSystem` in the Manager - Determines whether we check if the home directory exists during `createFileSystem` in the Manager
- If `tryGetHome` fails while creating the connection, throw an error if this flag is set, otherwise default to `/` - If `tryGetHome` fails while creating the connection, throw an error if this flag is set, otherwise default to `/`
@ -391,6 +392,14 @@ function parseFlagList(list: string[] | undefined, origin: string): Record<strin
*/ */
export type FlagValue = string | boolean | null; export type FlagValue = string | boolean | null;
export type FlagCombo<V extends FlagValue = FlagValue> = [value: V, origin: string]; export type FlagCombo<V extends FlagValue = FlagValue> = [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[] = []; export const DEFAULT_FLAGS: string[] = [];
let cachedFlags: Record<string, FlagCombo> = {}; let cachedFlags: Record<string, FlagCombo> = {};
function calculateFlags(): Record<string, FlagCombo> { function calculateFlags(): Record<string, FlagCombo> {

Loading…
Cancel
Save