Skip to content

Commit

Permalink
Do not return nulls when getting documents by path
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Sep 9, 2021
1 parent 4f7ed0f commit 451ea48
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/OmniSharp.Roslyn/OmniSharpWorkspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public OmniSharpWorkspace(HostServicesAggregator aggregator, ILoggerFactory logg

private void OnDirectoryRemoved(string path, FileChangeType changeType)
{
if(changeType == FileChangeType.DirectoryDelete)
if (changeType == FileChangeType.DirectoryDelete)
{
var docs = CurrentSolution.Projects.SelectMany(x => x.Documents)
.Where(x => x.FilePath.StartsWith(path + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase));

foreach(var doc in docs)
foreach (var doc in docs)
{
OnDocumentRemoved(doc.Id);
}
Expand Down Expand Up @@ -340,7 +340,8 @@ public IEnumerable<Document> GetDocuments(string filePath)
{
return CurrentSolution
.GetDocumentIdsWithFilePath(filePath)
.Select(id => CurrentSolution.GetDocument(id));
.Select(id => CurrentSolution.GetDocument(id))
.OfType<Document>();
}

public Document GetDocument(string filePath)
Expand Down

0 comments on commit 451ea48

Please sign in to comment.