File tree 2 files changed +24
-2
lines changed
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -186,12 +186,12 @@ export function load(): ISettings {
186
186
} ;
187
187
}
188
188
189
- export function change ( settingName : string , newValue : any , global : boolean = false ) : Thenable < void > {
189
+ export async function change ( settingName : string , newValue : any , global : boolean = false ) : Promise < void > {
190
190
const configuration : vscode . WorkspaceConfiguration =
191
191
vscode . workspace . getConfiguration (
192
192
utils . PowerShellLanguageId ) ;
193
193
194
- return configuration . update ( settingName , newValue , global ) ;
194
+ await configuration . update ( settingName , newValue , global ) ;
195
195
}
196
196
197
197
function getWorkspaceSettingsWithDefaults < TSettings > (
Original file line number Diff line number Diff line change
1
+ /*---------------------------------------------------------
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ *--------------------------------------------------------*/
4
+
5
+ import * as assert from "assert" ;
6
+ import Settings = require( "../src/settings" ) ;
7
+
8
+ suite ( "Settings module" , ( ) => {
9
+ test ( "Settings load without error" , ( ) => {
10
+ assert . doesNotThrow ( Settings . load ) ;
11
+ } ) ;
12
+
13
+ test ( "Settings update correctly" , async ( ) => {
14
+ // then syntax
15
+ Settings . change ( "powerShellExePath" , "dummypath1" , false ) . then ( ( ) =>
16
+ assert . strictEqual ( Settings . load ( ) . powerShellExePath , "dummypath1" ) ) ;
17
+
18
+ // async/await syntax
19
+ await Settings . change ( "powerShellExePath" , "dummypath2" , false ) ;
20
+ assert . strictEqual ( Settings . load ( ) . powerShellExePath , "dummypath2" ) ;
21
+ } ) ;
22
+ } ) ;
You can’t perform that action at this time.
0 commit comments