Skip to content
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

Report back the solution filter name in workspace updated event #2130

Merged
merged 1 commit into from Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/OmniSharp.MSBuild/ProjectSystem.cs
Expand Up @@ -135,14 +135,16 @@ private IEnumerable<(string, ProjectIdInfo)> GetInitialProjectPathsAndIds()
// If a solution was provided, use it.
if (!string.IsNullOrEmpty(_environment.SolutionFilePath))
{
return GetProjectPathsAndIdsFromSolutionOrFilter(_environment.SolutionFilePath, out _solutionFileOrRootPath);
_solutionFileOrRootPath = _environment.SolutionFilePath;
return GetProjectPathsAndIdsFromSolutionOrFilter(_environment.SolutionFilePath);
}

// Otherwise, assume that the path provided is a directory and look for a solution there.
var solutionFilePath = FindSolutionFilePath(_environment.TargetDirectory, _logger);
if (!string.IsNullOrEmpty(solutionFilePath))
{
return GetProjectPathsAndIdsFromSolutionOrFilter(solutionFilePath, out _solutionFileOrRootPath);
_solutionFileOrRootPath = solutionFilePath;
return GetProjectPathsAndIdsFromSolutionOrFilter(solutionFilePath);
}

// Finally, if there isn't a single solution immediately available,
Expand All @@ -156,11 +158,11 @@ private IEnumerable<(string, ProjectIdInfo)> GetInitialProjectPathsAndIds()
});
}

private IEnumerable<(string, ProjectIdInfo)> GetProjectPathsAndIdsFromSolutionOrFilter(string solutionOrFilterFilePath, out string solutionFilePath)
private IEnumerable<(string, ProjectIdInfo)> GetProjectPathsAndIdsFromSolutionOrFilter(string solutionOrFilterFilePath)
{
_logger.LogInformation($"Detecting projects in '{solutionOrFilterFilePath}'.");

solutionFilePath = solutionOrFilterFilePath;
var solutionFilePath = solutionOrFilterFilePath;

var projectFilter = ImmutableHashSet<string>.Empty;
if (SolutionFilterReader.IsSolutionFilterFilename(solutionOrFilterFilePath) &&
Expand Down
2 changes: 1 addition & 1 deletion tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs
Expand Up @@ -53,7 +53,7 @@ public async Task TestProjectAndSolutionFilter()
{
var workspaceInfo = await host.RequestMSBuildWorkspaceInfoAsync();

Assert.Equal("ProjectAndSolutionFilter.sln", Path.GetFileName(workspaceInfo.SolutionPath));
Assert.Equal("ProjectAndSolutionFilter.slnf", Path.GetFileName(workspaceInfo.SolutionPath));
Assert.NotNull(workspaceInfo.Projects);
var project = Assert.Single(workspaceInfo.Projects);

Expand Down