Skip to content

Commit 1690164

Browse files
committed
fix: don't log settings change from isValid()
isValid() works by reading/writing a setting on startup. This is noisy in the logs.
1 parent 2df1c49 commit 1690164

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/shared/settings.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import { ToolkitError } from './errors'
1616

1717
type Workspace = Pick<typeof vscode.workspace, 'getConfiguration' | 'onDidChangeConfiguration'>
1818

19+
/** Used by isValid(). Must be something that's defined in our package.json. */
20+
const testSetting = 'aws.samcli.lambdaTimeout'
21+
1922
/**
2023
* A class for manipulating VS Code user settings (from all extensions).
2124
*
@@ -93,7 +96,7 @@ export class Settings {
9396
* "recoverable" JSON syntax errors.
9497
*/
9598
public async isValid(): Promise<'ok' | 'invalid' | 'nowrite'> {
96-
const key = 'aws.samcli.lambdaTimeout'
99+
const key = testSetting
97100
const config = this.getConfig()
98101
const tempValOld = 1234 // Legacy temp value we are migrating from.
99102
const tempVal = 91234 // Temp value used to check that read/write works.
@@ -122,7 +125,7 @@ export class Settings {
122125
return 'nowrite'
123126
}
124127

125-
const logMsg = 'settings: invalid "settings.json": %s'
128+
const logMsg = 'settings: invalid settings.json: %s'
126129
getLogger().error(logMsg, err.message)
127130

128131
return 'invalid'
@@ -386,7 +389,9 @@ function createSettingsClass<T extends TypeDescriptor>(section: string, descript
386389
}
387390

388391
for (const key of props.filter(isDifferent)) {
389-
this.log('key "%s" changed', key)
392+
if (`${section}.${key}` !== testSetting) {
393+
this.log('key "%s" changed', key)
394+
}
390395
emitter.fire({ key })
391396
}
392397
})

0 commit comments

Comments
 (0)