-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show a prompt if we have more than one solution file #6132
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -425,6 +425,32 @@ export class RoslynLanguageServer { | |
if (solutionUris) { | ||
if (solutionUris.length === 1) { | ||
this.openSolution(solutionUris[0]); | ||
} else if (solutionUris.length > 1) { | ||
// We have more than one solution, so we'll prompt the user to use the picker. | ||
const chosen = await vscode.window.showInformationMessage( | ||
vscode.l10n.t( | ||
'Your workspace has multiple Visual Studio Solution files; please select one to get full IntelliSense.' | ||
), | ||
{ title: vscode.l10n.t('Choose'), action: 'open' }, | ||
{ title: vscode.l10n.t('Choose and set default'), action: 'openAndSetDefault' }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. other option: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about that but decided to make it a bit clearer the second button is first button plus something more. But if we have to save room this would proably be where I'd do it. |
||
{ title: vscode.l10n.t('Do not load any'), action: 'disable' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other option: |
||
); | ||
|
||
if (chosen) { | ||
if (chosen.action === 'disable') { | ||
vscode.workspace.getConfiguration().update('dotnet.defaultSolution', 'disable', false); | ||
} else { | ||
const chosenSolution: vscode.Uri | undefined = await vscode.commands.executeCommand( | ||
'dotnet.openSolution' | ||
); | ||
if (chosen.action === 'openAndSetDefault' && chosenSolution) { | ||
const relativePath = vscode.workspace.asRelativePath(chosenSolution); | ||
vscode.workspace | ||
.getConfiguration() | ||
.update('dotnet.defaultSolution', relativePath, false); | ||
} | ||
} | ||
} | ||
} else if (solutionUris.length === 0) { | ||
// We have no solutions, so we'll enumerate what project files we have and just use those. | ||
const projectUris = await vscode.workspace.findFiles( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'm a bit late to the party. Since we are trying to improve this area, could we also show the solution picker if default solution can't be opened and there's other solution files in the hierarchy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@genlu We could, although I'm still curious how you got an error like that in the first place. 😄