Skip to content

Clean up IDiagnosticService extension methods#60723

Merged
jasonmalinowski merged 2 commits intodotnet:mainfrom
jasonmalinowski:simplify-diagnostics
Apr 14, 2022
Merged

Clean up IDiagnosticService extension methods#60723
jasonmalinowski merged 2 commits intodotnet:mainfrom
jasonmalinowski:simplify-diagnostics

Conversation

@jasonmalinowski
Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski commented Apr 13, 2022

  1. The GetPushDiagnostics/GetPullDiagnostics extension methods called a common helper method passing in a boolean, only for that common helper to switch on that boolean again.
  2. The common helper worked via enumerating buckets and then calling other helpers to find diagnostics matching those buckets, when instead we can directly call the service and ask it for what we want.

@jasonmalinowski jasonmalinowski requested a review from a team as a code owner April 13, 2022 19:24
@ghost ghost added the Area-IDE label Apr 13, 2022
@jasonmalinowski jasonmalinowski self-assigned this Apr 13, 2022

var buckets = forPullDiagnostics
? service.GetPullDiagnosticBuckets(workspace, project?.Id, document?.Id, diagnosticMode, cancellationToken)
: service.GetPushDiagnosticBuckets(workspace, project?.Id, document?.Id, diagnosticMode, cancellationToken);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we still need to expose teh buckets now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There's some other code that is still asking for buckets and using the bucket extension methods so that's not obviously deletable. I might also be needing it for some other stuff, so that'll be left around for now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh I haven't seen that bucket meme in a long, long time...

This is now our default.
This code was a bit strange:

1. The GetPushDiagnostics/GetPullDiagnostics extension methods called
   a common helper method passing in a boolean, only for that common
   helper to switch on that boolean again.
2. The common helper worked via enumerating buckets and then calling
   other helpers to find diagnostics matching those buckets, when
   instead we can directly call the service and ask it for what we want.
@jasonmalinowski jasonmalinowski merged commit 3f615ac into dotnet:main Apr 14, 2022
@jasonmalinowski jasonmalinowski deleted the simplify-diagnostics branch April 14, 2022 20:54
@ghost ghost added this to the Next milestone Apr 14, 2022
@dibarbet dibarbet modified the milestones: Next, 17.3.P1 Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants