MCPcopy
hub / github.com/PowerShell/vscode-powershell / getSetting

Function getSetting

src/settings.ts:155–172  ·  view source on GitHub ↗
(
    key: string | undefined,
    value: TSetting,
    configuration: vscode.WorkspaceConfiguration,
)

Source from the content-addressed store, hash-verified

153
154// This is a recursive function which unpacks a WorkspaceConfiguration into our settings.
155function getSetting<TSetting>(
156 key: string | undefined,
157 value: TSetting,
158 configuration: vscode.WorkspaceConfiguration,
159): TSetting {
160 // Base case where we're looking at a primitive type (or our special record).
161 if (key !== undefined && !(value instanceof PartialSettings)) {
162 return configuration.get<TSetting>(key, value);
163 }
164
165 // Otherwise we're looking at one of our interfaces and need to extract.
166 for (const property in value) {
167 const subKey = key !== undefined ? `${key}.${property}` : property;
168 value[property] = getSetting(subKey, value[property], configuration);
169 }
170
171 return value;
172}
173
174export function getSettings(): Settings {
175 const configuration: vscode.WorkspaceConfiguration =

Callers 1

getSettingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected