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

Remove build-only diagnostics functionality no longer used in product #72941

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner April 8, 2024 19:44
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 8, 2024
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
=> new BuildOnlyDiagnosticsService(workspaceServices.Workspace);

private sealed class BuildOnlyDiagnosticsService : IBuildOnlyDiagnosticsService
{
private readonly object _gate = new();
private readonly Dictionary<DocumentId, ImmutableArray<DiagnosticData>> _documentDiagnostics = [];
private readonly Dictionary<ProjectId, ImmutableArray<DiagnosticData>> _projectDiagnostics = [];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data in this was never read in any product code. only in a single test. remove it, and updated codepaths affected by it.

@@ -61,18 +56,12 @@ private void OnWorkspaceChanged(object? sender, WorkspaceChangeEventArgs e)
}
}

public void AddBuildOnlyDiagnostics(Solution solution, ProjectId? projectId, DocumentId? documentId, ImmutableArray<DiagnosticData> diagnostics)
public void AddBuildOnlyDiagnostics(DocumentId documentId, ImmutableArray<DiagnosticData> diagnostics)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since nothing was reading the project side, we only need to call this for teh document side of things.

foreach (var documentId in project.DocumentIds)
_documentDiagnostics.Remove(documentId);
}
}

public void ClearBuildOnlyDiagnostics(Solution solution, ProjectId? projectId, DocumentId? documentId)
public void ClearBuildOnlyDiagnostics(Project project, DocumentId? documentId)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passing in a project-id here meant 'clear out project diags, and all diags for any document in this project'. So, maintaining that logic here.

}
}

public ImmutableArray<DiagnosticData> GetBuildOnlyDiagnostics(ProjectId projectId)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only called in a single test method, no other product code called this.

@CyrusNajmabadi
Copy link
Member Author

@ToddGrun @dibarbet ptal.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@CyrusNajmabadi CyrusNajmabadi merged commit 4218188 into dotnet:main Apr 8, 2024
27 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 8, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the simplifyDiagnostics branch April 8, 2024 22:12
@dibarbet dibarbet modified the milestones: Next, 17.11 P1 Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants