Skip to content

Commit e988b14

Browse files
committed
[release] src/config: fix initConfig and WrappedConfiguration
workspaceIsTrusted is a function, not a variable. Make sure the properties to be overriden by WrappedConfiguration are what we want, by not copying them in the constructor. Change-Id: Ia88c31651005f0bb6c95e8316b955f4fcb63d8dc Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/284586 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Suzy Mueller <[email protected]> (cherry picked from commit a267fff) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/284794 TryBot-Result: kokoro <[email protected]>
1 parent d0d360a commit e988b14

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const SECURITY_SENSITIVE_CONFIG: string[] = [
1616
// the user has to explicitly opt in to trust the workspace.
1717
export async function initConfig(ctx: vscode.ExtensionContext) {
1818
const isTrusted = getFromWorkspaceState(WORKSPACE_IS_TRUSTED_KEY, false);
19-
if (isTrusted !== defaultConfig.workspaceIsTrusted) {
19+
if (isTrusted !== defaultConfig.workspaceIsTrusted()) {
2020
defaultConfig.toggleWorkspaceIsTrusted();
2121
}
2222
ctx.subscriptions.push(
@@ -81,7 +81,6 @@ export class Configuration {
8181
if (section !== 'go' || this._workspaceIsTrusted) {
8282
return cfg;
8383
}
84-
8584
return new WrappedConfiguration(cfg);
8685
}
8786

@@ -103,7 +102,9 @@ class WrappedConfiguration implements vscode.WorkspaceConfiguration {
103102
// set getters for direct setting access (e.g. cfg.gopath), but don't overwrite _wrapped.
104103
const desc = Object.getOwnPropertyDescriptors(_wrapped);
105104
for (const prop in desc) {
106-
if (typeof prop === 'string' && prop !== '_wrapped') {
105+
// TODO(hyangah): find a better way to exclude WrappedConfiguration's members.
106+
// These methods are defined by WrappedConfiguration.
107+
if (typeof prop === 'string' && !['get', 'has', 'inspect', 'update', '_wrapped'].includes(prop)) {
107108
const d = desc[prop];
108109
if (SECURITY_SENSITIVE_CONFIG.includes(prop)) {
109110
const inspect = this._wrapped.inspect(prop);

0 commit comments

Comments
 (0)