-
Notifications
You must be signed in to change notification settings - Fork 196
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
Create some simple tests for the RoslynWorkspace EA #8607
Conversation
@@ -11,15 +10,12 @@ public class RazorWorkspaceListener : IDisposable | |||
private static readonly TimeSpan s_debounceTime = TimeSpan.FromMilliseconds(100); | |||
|
|||
private string? _projectRazorJsonFileName; | |||
private readonly Dictionary<string, TaskDelayScheduler> _workQueues; | |||
private readonly Dictionary<ProjectId, TaskDelayScheduler> _workQueues; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the key here to make testing easier, but also strictly speaking the previous code wouldn't have worked for multi targetting, should that ever be something someone wants to do.
{ | ||
scheduler = new TaskDelayScheduler(s_debounceTime, CancellationToken.None); | ||
_workQueues.Add(project.Id, scheduler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stupid bug here. I wasn't actually adding anything to the map 🤦♂️
case WorkspaceChangeKind.SolutionChanged: | ||
case WorkspaceChangeKind.SolutionReloaded: | ||
foreach (var project in e.OldSolution.Projects) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figured now that we're using IDs, its better to be a bit more strict with removal so we're not holding stale data in the map. Not a big deal though, as removing and re-adding the same project is essentially the same as queuing an update anyway, and any stale projects here will just be an instance of the TaskDelayScheduler that does nothing.
No description provided.