Skip to content

Commit d547538

Browse files
Show a prompt if we have more than one solution file
This prompt is pretty close to what DevKit does in this same case.
1 parent 19967db commit d547538

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

l10n/bundle.l10n.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@
118118
"View Debug Docs": "View Debug Docs",
119119
"Ignore": "Ignore",
120120
"Run and Debug: A valid browser is not installed": "Run and Debug: A valid browser is not installed",
121+
"Your workspace has multiple Visual Studio Solution files; please select one to get full IntelliSense.": "Your workspace has multiple Visual Studio Solution files; please select one to get full IntelliSense.",
122+
"Choose solution": "Choose solution",
123+
"Do not load solutions": "Do not load solutions",
121124
"Restart Language Server": "Restart Language Server",
122125
"pipeArgs must be a string or a string array type": "pipeArgs must be a string or a string array type",
123126
"Name not defined in current configuration.": "Name not defined in current configuration.",

src/lsptoolshost/roslynLanguageServer.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,23 @@ export class RoslynLanguageServer {
425425
if (solutionUris) {
426426
if (solutionUris.length === 1) {
427427
this.openSolution(solutionUris[0]);
428+
} else if (solutionUris.length > 1) {
429+
// We have more than one solution, so we'll prompt the user to use the picker.
430+
const chosen = await vscode.window.showInformationMessage(
431+
vscode.l10n.t(
432+
'Your workspace has multiple Visual Studio Solution files; please select one to get full IntelliSense.'
433+
),
434+
{ title: vscode.l10n.t('Choose solution'), open: true },
435+
{ title: vscode.l10n.t('Do not load solutions'), open: false }
436+
);
437+
438+
if (chosen) {
439+
if (chosen.open) {
440+
vscode.commands.executeCommand('dotnet.openSolution');
441+
} else {
442+
vscode.workspace.getConfiguration().update('dotnet.defaultSolution', 'disable', false);
443+
}
444+
}
428445
} else if (solutionUris.length === 0) {
429446
// We have no solutions, so we'll enumerate what project files we have and just use those.
430447
const projectUris = await vscode.workspace.findFiles(

0 commit comments

Comments
 (0)