Skip to content

Commit a4edd79

Browse files
Remove synchronous ProjectSnapshotManager.Update(...) methods
1 parent 347c105 commit a4edd79

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshotManager.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ internal interface IProjectSnapshotManager
2222
bool IsDocumentOpen(string documentFilePath);
2323
ImmutableArray<string> GetOpenDocuments();
2424

25-
void Update(Action<ProjectSnapshotManager.Updater> updater);
26-
void Update<TState>(Action<ProjectSnapshotManager.Updater, TState> updater, TState state);
27-
TResult Update<TResult>(Func<ProjectSnapshotManager.Updater, TResult> updater);
28-
TResult Update<TState, TResult>(Func<ProjectSnapshotManager.Updater, TState, TResult> updater, TState state);
29-
3025
Task UpdateAsync(Action<ProjectSnapshotManager.Updater> updater, CancellationToken cancellationToken);
3126
Task UpdateAsync<TState>(Action<ProjectSnapshotManager.Updater, TState> updater, TState state, CancellationToken cancellationToken);
3227
Task<TResult> UpdateAsync<TResult>(Func<ProjectSnapshotManager.Updater, TResult> updater, CancellationToken cancellationToken);

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -569,30 +569,6 @@ private bool TryChangeEntry_UsesLock(
569569
}
570570
}
571571

572-
public void Update(Action<Updater> updater)
573-
{
574-
_dispatcher.AssertRunningOnDispatcher();
575-
updater(new(this));
576-
}
577-
578-
public void Update<TState>(Action<Updater, TState> updater, TState state)
579-
{
580-
_dispatcher.AssertRunningOnDispatcher();
581-
updater(new(this), state);
582-
}
583-
584-
public TResult Update<TResult>(Func<Updater, TResult> updater)
585-
{
586-
_dispatcher.AssertRunningOnDispatcher();
587-
return updater(new(this));
588-
}
589-
590-
public TResult Update<TState, TResult>(Func<Updater, TState, TResult> updater, TState state)
591-
{
592-
_dispatcher.AssertRunningOnDispatcher();
593-
return updater(new(this), state);
594-
}
595-
596572
public Task UpdateAsync(Action<Updater> updater, CancellationToken cancellationToken)
597573
{
598574
return _dispatcher.RunAsync(

src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.CodeAnalysis;
1616
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
1717
using Microsoft.CodeAnalysis.Text;
18+
using Microsoft.VisualStudio.Threading;
1819
using Moq;
1920
using Xunit;
2021
using Xunit.Abstractions;
@@ -812,13 +813,13 @@ await _projectManager.UpdateAsync(updater =>
812813

813814
if (args.Kind == ProjectChangeKind.DocumentAdded)
814815
{
815-
_projectManager.Update(updater =>
816-
updater.DocumentOpened(s_hostProject.Key, s_documents[0].FilePath, _sourceText));
816+
_projectManager.UpdateAsync(updater =>
817+
updater.DocumentOpened(s_hostProject.Key, s_documents[0].FilePath, _sourceText)).Forget();
817818
}
818819
else if (args.Kind == ProjectChangeKind.DocumentChanged)
819820
{
820-
_projectManager.Update(updater =>
821-
updater.DocumentRemoved(s_hostProject.Key, s_documents[0]));
821+
_projectManager.UpdateAsync(updater =>
822+
updater.DocumentRemoved(s_hostProject.Key, s_documents[0])).Forget();
822823
}
823824
};
824825

0 commit comments

Comments
 (0)