Skip to content

Commit

Permalink
Merge pull request #7082 from dotnet/dev/jorobich/open-solution-filters
Browse files Browse the repository at this point in the history
List solution filter files (.slnf) in the 'Open Solution' command.
  • Loading branch information
JoeRobich authored May 1, 2024
2 parents f53131a + f07316e commit f588850
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lsptoolshost/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ async function openSolution(languageServer: RoslynLanguageServer): Promise<vscod
return undefined;
}

const solutionFiles = await vscode.workspace.findFiles('**/*.sln');
const solutionFiles = await vscode.workspace.findFiles('**/*.{sln,slnf}');
const launchTargets = solutionFiles.map(createLaunchTargetForSolution);
const launchTarget = await vscode.window.showQuickPick(launchTargets, {
matchOnDescription: true,
Expand Down
8 changes: 5 additions & 3 deletions src/shared/launchTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ export interface LaunchTarget {
}

export function createLaunchTargetForSolution(resource: vscode.Uri): LaunchTarget {
const dirname = path.dirname(resource.fsPath);
const directoryPath = path.dirname(resource.fsPath);
const relativePath = vscode.workspace.asRelativePath(directoryPath);
return {
label: path.basename(resource.fsPath),
description: vscode.workspace.asRelativePath(dirname),
// When the relativePath matches the directoryPath, it means we are in the root of the workspace.
description: directoryPath === relativePath ? '' : relativePath,
target: resource.fsPath,
directory: path.dirname(resource.fsPath),
directory: directoryPath,
workspaceKind: LaunchTargetKind.Solution,
};
}

0 comments on commit f588850

Please sign in to comment.