@@ -207,7 +207,11 @@ export class RoslynLanguageServer {
207
207
this . _languageClient . onDidChangeState ( async ( state ) => {
208
208
if ( state . newState === State . Running ) {
209
209
await this . _languageClient ! . setTrace ( languageClientTraceLevel ) ;
210
- await this . sendOpenSolutionNotification ( ) ;
210
+ if ( this . _solutionFile ) {
211
+ await this . sendOpenSolutionNotification ( ) ;
212
+ } else {
213
+ await this . openDefaultSolution ( ) ;
214
+ }
211
215
await this . sendOrSubscribeForServiceBrokerConnection ( ) ;
212
216
this . _eventBus . emit ( RoslynLanguageServer . serverStateChangeEvent , ServerStateChange . Started ) ;
213
217
}
@@ -222,20 +226,6 @@ export class RoslynLanguageServer {
222
226
223
227
// Register Razor dynamic file info handling
224
228
this . registerRazor ( this . _languageClient ) ;
225
-
226
- // If Dev Kit isn't installed, then we are responsible for picking the solution to open, assuming the user hasn't explicitly
227
- // disabled it.
228
- if ( ! this . _wasActivatedWithCSharpDevkit && options . commonOptions . defaultSolution !== 'disable' && this . _solutionFile === undefined ) {
229
- if ( options . commonOptions . defaultSolution !== '' ) {
230
- this . openSolution ( vscode . Uri . file ( options . commonOptions . defaultSolution ) ) ;
231
- } else {
232
- // Auto open if there is just one solution target; if there's more the one we'll just let the user pick with the picker.
233
- const solutionUris = await vscode . workspace . findFiles ( '**/*.sln' , '**/node_modules/**' , 2 ) ;
234
- if ( solutionUris && solutionUris . length === 1 ) {
235
- this . openSolution ( solutionUris [ 0 ] ) ;
236
- }
237
- }
238
- }
239
229
}
240
230
241
231
public async stop ( ) : Promise < void > {
@@ -316,6 +306,24 @@ export class RoslynLanguageServer {
316
306
}
317
307
}
318
308
309
+ private async openDefaultSolution ( ) {
310
+ const options = this . optionProvider . GetLatestOptions ( ) ;
311
+
312
+ // If Dev Kit isn't installed, then we are responsible for picking the solution to open, assuming the user hasn't explicitly
313
+ // disabled it.
314
+ if ( ! this . _wasActivatedWithCSharpDevkit && options . commonOptions . defaultSolution !== 'disable' && this . _solutionFile === undefined ) {
315
+ if ( options . commonOptions . defaultSolution !== '' ) {
316
+ this . openSolution ( vscode . Uri . file ( options . commonOptions . defaultSolution ) ) ;
317
+ } else {
318
+ // Auto open if there is just one solution target; if there's more the one we'll just let the user pick with the picker.
319
+ const solutionUris = await vscode . workspace . findFiles ( '**/*.sln' , '**/node_modules/**' , 2 ) ;
320
+ if ( solutionUris && solutionUris . length === 1 ) {
321
+ this . openSolution ( solutionUris [ 0 ] ) ;
322
+ }
323
+ }
324
+ }
325
+ }
326
+
319
327
private async sendOrSubscribeForServiceBrokerConnection ( ) {
320
328
const csharpDevKitExtension = vscode . extensions . getExtension < CSharpDevKitExports > ( csharpDevkitExtensionId ) ;
321
329
if ( csharpDevKitExtension ) {
0 commit comments