File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 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 {
186186 } ;
187187}
188188
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 > {
190190 const configuration : vscode . WorkspaceConfiguration =
191191 vscode . workspace . getConfiguration (
192192 utils . PowerShellLanguageId ) ;
193193
194- return configuration . update ( settingName , newValue , global ) ;
194+ await configuration . update ( settingName , newValue , global ) ;
195195}
196196
197197function 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