@@ -85,7 +85,6 @@ export class OmniSharpServer {
8585 private _launchTarget : LaunchTarget ;
8686 private _requestQueue : RequestQueueCollection ;
8787 private _serverProcess : ChildProcess ;
88- private _options : Options ;
8988
9089 private _omnisharpManager : OmnisharpManager ;
9190 private updateProjectDebouncer = new Subject < ObservableEvents . ProjectModified > ( ) ;
@@ -237,7 +236,7 @@ export class OmniSharpServer {
237236
238237 // --- start, stop, and connect
239238
240- private async _start ( launchTarget : LaunchTarget ) : Promise < void > {
239+ private async _start ( launchTarget : LaunchTarget , options : Options ) : Promise < void > {
241240
242241 let disposables = new CompositeDisposable ( ) ;
243242
@@ -292,25 +291,24 @@ export class OmniSharpServer {
292291
293292 const solutionPath = launchTarget . target ;
294293 const cwd = path . dirname ( solutionPath ) ;
295- this . _options = Options . Read ( ) ;
296294
297295 let args = [
298296 '-s' , solutionPath ,
299297 '--hostPID' , process . pid . toString ( ) ,
300298 '--stdio' ,
301299 'DotNet:enablePackageRestore=false' ,
302300 '--encoding' , 'utf-8' ,
303- '--loglevel' , this . _options . loggingLevel
301+ '--loglevel' , options . loggingLevel
304302 ] ;
305303
306- if ( this . _options . waitForDebugger === true ) {
304+ if ( options . waitForDebugger === true ) {
307305 args . push ( '--debug' ) ;
308306 }
309307
310308 let launchInfo : LaunchInfo ;
311309 try {
312310 let extensionPath = utils . getExtensionPath ( ) ;
313- launchInfo = await this . _omnisharpManager . GetOmniSharpLaunchInfo ( this . packageJSON . defaults . omniSharp , this . _options . path , serverUrl , latestVersionFileServerPath , installPath , extensionPath ) ;
311+ launchInfo = await this . _omnisharpManager . GetOmniSharpLaunchInfo ( this . packageJSON . defaults . omniSharp , options . path , serverUrl , latestVersionFileServerPath , installPath , extensionPath ) ;
314312 }
315313 catch ( error ) {
316314 this . eventStream . post ( new ObservableEvents . OmnisharpFailure ( `Error occured in loading omnisharp from omnisharp.path\nCould not start the server due to ${ error . toString ( ) } ` , error ) ) ;
@@ -321,15 +319,15 @@ export class OmniSharpServer {
321319 this . _fireEvent ( Events . BeforeServerStart , solutionPath ) ;
322320
323321 try {
324- let launchResult = await launchOmniSharp ( cwd , args , launchInfo , this . platformInfo ) ;
322+ let launchResult = await launchOmniSharp ( cwd , args , launchInfo , this . platformInfo , options ) ;
325323 this . eventStream . post ( new ObservableEvents . OmnisharpLaunch ( launchResult . monoVersion , launchResult . command , launchResult . process . pid ) ) ;
326324
327325 this . _serverProcess = launchResult . process ;
328326 this . _delayTrackers = { } ;
329327 this . _setState ( ServerState . Started ) ;
330328 this . _fireEvent ( Events . ServerStart , solutionPath ) ;
331329
332- await this . _doConnect ( ) ;
330+ await this . _doConnect ( options ) ;
333331
334332 this . _telemetryIntervalId = setInterval ( ( ) => this . _reportTelemetry ( ) , TelemetryReportingDelay ) ;
335333 this . _requestQueue . drain ( ) ;
@@ -417,7 +415,10 @@ export class OmniSharpServer {
417415 public async restart ( launchTarget : LaunchTarget = this . _launchTarget ) : Promise < void > {
418416 if ( launchTarget ) {
419417 await this . stop ( ) ;
420- await this . _start ( launchTarget ) ;
418+
419+ const options = Options . Read ( this . vscode ) ;
420+
421+ await this . _start ( launchTarget , options ) ;
421422 }
422423 }
423424
@@ -503,7 +504,7 @@ export class OmniSharpServer {
503504 } ) ;
504505 }
505506
506- private async _doConnect ( ) : Promise < void > {
507+ private async _doConnect ( options : Options ) : Promise < void > {
507508
508509 this . _serverProcess . stderr . on ( 'data' , ( data : any ) => {
509510 this . _fireEvent ( 'stderr' , String ( data ) ) ;
@@ -519,7 +520,7 @@ export class OmniSharpServer {
519520 let listener : Disposable ;
520521
521522 // Convert the timeout from the seconds to milliseconds, which is required by setTimeout().
522- const timeoutDuration = this . _options . projectLoadTimeout * 1000 ;
523+ const timeoutDuration = options . projectLoadTimeout * 1000 ;
523524
524525 // timeout logic
525526 const handle = setTimeout ( ( ) => {
0 commit comments