@@ -9,7 +9,7 @@ import TelemetryReporter, { TelemetryEventProperties, TelemetryEventMeasurements
9
9
import { Message } from "vscode-jsonrpc" ;
10
10
import { Logger } from "./logging" ;
11
11
import { PowerShellProcess } from "./process" ;
12
- import Settings = require ( "./settings" ) ;
12
+ import { ISettings , changeSetting , getSettings , getEffectiveConfigurationTarget , validateCwdSetting } from "./settings" ;
13
13
import utils = require( "./utils" ) ;
14
14
15
15
import {
@@ -102,7 +102,7 @@ export class SessionManager implements Middleware {
102
102
103
103
constructor (
104
104
private extensionContext : vscode . ExtensionContext ,
105
- private sessionSettings : Settings . ISettings ,
105
+ private sessionSettings : ISettings ,
106
106
private logger : Logger ,
107
107
private documentSelector : DocumentSelector ,
108
108
hostName : string ,
@@ -211,8 +211,8 @@ export class SessionManager implements Middleware {
211
211
await this . stop ( ) ;
212
212
213
213
// Re-load and validate the settings.
214
- await Settings . validateCwdSetting ( this . logger ) ;
215
- this . sessionSettings = Settings . load ( ) ;
214
+ await validateCwdSetting ( this . logger ) ;
215
+ this . sessionSettings = getSettings ( ) ;
216
216
217
217
await this . start ( exeNameOverride ) ;
218
218
}
@@ -234,7 +234,7 @@ export class SessionManager implements Middleware {
234
234
return vscode . Uri . joinPath ( this . sessionsFolder , `PSES-VSCode-${ process . env . VSCODE_PID } -${ uniqueId } .json` ) ;
235
235
}
236
236
237
- public async createDebugSessionProcess ( settings : Settings . ISettings ) : Promise < PowerShellProcess > {
237
+ public async createDebugSessionProcess ( settings : ISettings ) : Promise < PowerShellProcess > {
238
238
// NOTE: We only support one temporary Extension Terminal at a time. To
239
239
// support more, we need to track each separately, and tie the session
240
240
// for the event handler to the right process (and dispose of the event
@@ -343,12 +343,12 @@ export class SessionManager implements Middleware {
343
343
const configuration = vscode . workspace . getConfiguration ( utils . PowerShellLanguageId ) ;
344
344
const deprecatedSetting = "codeFormatting.whitespaceAroundPipe" ;
345
345
const newSetting = "codeFormatting.addWhitespaceAroundPipe" ;
346
- const configurationTargetOfNewSetting = Settings . getEffectiveConfigurationTarget ( newSetting ) ;
347
- const configurationTargetOfOldSetting = Settings . getEffectiveConfigurationTarget ( deprecatedSetting ) ;
346
+ const configurationTargetOfNewSetting = getEffectiveConfigurationTarget ( newSetting ) ;
347
+ const configurationTargetOfOldSetting = getEffectiveConfigurationTarget ( deprecatedSetting ) ;
348
348
if ( configurationTargetOfOldSetting !== undefined && configurationTargetOfNewSetting === undefined ) {
349
349
const value = configuration . get ( deprecatedSetting , configurationTargetOfOldSetting ) ;
350
- await Settings . change ( newSetting , value , configurationTargetOfOldSetting , this . logger ) ;
351
- await Settings . change ( deprecatedSetting , undefined , configurationTargetOfOldSetting , this . logger ) ;
350
+ await changeSetting ( newSetting , value , configurationTargetOfOldSetting , this . logger ) ;
351
+ await changeSetting ( deprecatedSetting , undefined , configurationTargetOfOldSetting , this . logger ) ;
352
352
}
353
353
}
354
354
@@ -372,7 +372,7 @@ export class SessionManager implements Middleware {
372
372
373
373
this . suppressRestartPrompt = true ;
374
374
try {
375
- await Settings . change ( "powerShellExePath" , undefined , true , this . logger ) ;
375
+ await changeSetting ( "powerShellExePath" , undefined , true , this . logger ) ;
376
376
} finally {
377
377
this . suppressRestartPrompt = false ;
378
378
}
@@ -384,7 +384,7 @@ export class SessionManager implements Middleware {
384
384
}
385
385
386
386
private async onConfigurationUpdated ( ) {
387
- const settings = Settings . load ( ) ;
387
+ const settings = getSettings ( ) ;
388
388
this . logger . updateLogLevel ( settings . developer . editorServicesLogLevel ) ;
389
389
390
390
// Detect any setting changes that would affect the session
@@ -578,9 +578,7 @@ Type 'help' to get help.
578
578
editorServicesArgs += "-WaitForDebugger " ;
579
579
}
580
580
581
- if ( this . sessionSettings . developer . editorServicesLogLevel ) {
582
- editorServicesArgs += `-LogLevel '${ this . sessionSettings . developer . editorServicesLogLevel } ' ` ;
583
- }
581
+ editorServicesArgs += `-LogLevel '${ this . sessionSettings . developer . editorServicesLogLevel } ' ` ;
584
582
585
583
return editorServicesArgs ;
586
584
}
@@ -808,7 +806,7 @@ Type 'help' to get help.
808
806
private async changePowerShellDefaultVersion ( exePath : IPowerShellExeDetails ) {
809
807
this . suppressRestartPrompt = true ;
810
808
try {
811
- await Settings . change ( "powerShellDefaultVersion" , exePath . displayName , true , this . logger ) ;
809
+ await changeSetting ( "powerShellDefaultVersion" , exePath . displayName , true , this . logger ) ;
812
810
} finally {
813
811
this . suppressRestartPrompt = false ;
814
812
}
0 commit comments