Skip to content

Commit b47274f

Browse files
committed
Cleanup. Removed no longer used RDT save functionality.
1 parent a93675b commit b47274f

File tree

1 file changed

+3
-45
lines changed

1 file changed

+3
-45
lines changed

src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Rename/FileMoveNotificationListener.cs

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using Microsoft.VisualStudio.Threading;
1212
using Path = System.IO.Path;
1313
using static System.Diagnostics.Debug;
14-
//using System.Reflection;
1514

1615
namespace Microsoft.VisualStudio.ProjectSystem.VS.Rename
1716
{
@@ -29,7 +28,6 @@ internal class FileMoveNotificationListener : IFileMoveNotificationListener
2928
private readonly IVsService<SVsOperationProgress, IVsOperationProgressStatusService> _operationProgressService;
3029
private readonly IWaitIndicator _waitService;
3130
private readonly IRoslynServices _roslynServices;
32-
private readonly IServiceProvider _serviceProvider;
3331
private readonly IVsService<SVsSettingsPersistenceManager, ISettingsManager> _settingsManagerService;
3432

3533
private readonly Dictionary<string, Renamer.RenameDocumentActionSet> _renameActionSets = new();
@@ -45,9 +43,6 @@ public FileMoveNotificationListener(
4543
IVsService<SVsOperationProgress, IVsOperationProgressStatusService> operationProgressService,
4644
IWaitIndicator waitService,
4745
IRoslynServices roslynServices,
48-
#pragma warning disable RS0030 // Do not used banned APIs
49-
[Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
50-
#pragma warning restore RS0030 // Do not used banned APIs
5146
IVsService<SVsSettingsPersistenceManager, ISettingsManager> settingsManagerService)
5247
{
5348
_unconfiguredProject = unconfiguredProject;
@@ -57,7 +52,6 @@ public FileMoveNotificationListener(
5752
_operationProgressService = operationProgressService;
5853
_waitService = waitService;
5954
_roslynServices = roslynServices;
60-
_serviceProvider = serviceProvider;
6155
_settingsManagerService = settingsManagerService;
6256
}
6357

@@ -135,52 +129,29 @@ public async Task OnAfterFileMoveAsync()
135129

136130
_ = _threadingService.JoinableTaskFactory.RunAsync(async () =>
137131
{
132+
// The wait service requires the main thread to run.
138133
await _threadingService.SwitchToUIThread();
139-
RunningDocumentTable runningDocumentTable = new(_serviceProvider);
140-
141-
//await ApplyRenamesAsync(CancellationToken.None, runningDocumentTable);
142-
143134
// Displays a dialog showing the progress of updating the namespaces in the files.
144135
_waitService.Run(
145136
title: string.Empty,
146137
message: _renameMessage!,
147138
allowCancel: true,
148-
asyncMethod: context => ApplyRenamesAsync(context, runningDocumentTable),
139+
asyncMethod: ApplyRenamesAsync,
149140
totalSteps: _renameActionSets.Count);
150141
});
151142

152143
return;
153144

154-
async Task ApplyRenamesAsync(IWaitContext context, RunningDocumentTable runningDocumentTable)
155-
//async Task ApplyRenamesAsync(CancellationToken token, RunningDocumentTable runningDocumentTable)
145+
async Task ApplyRenamesAsync(IWaitContext context)
156146
{
157147
CancellationToken token = context.CancellationToken;
158-
159-
//await _threadingService.SwitchToUIThread(token);
160-
//foreach (string destinationPath in _renameActionSets.Keys)
161-
//{
162-
// // Save the current file to disk if it contains unsaved changes.
163-
// // This guarantees that Roslyn will update the correct document contents when the rename actions are applied to the solution.
164-
// // This must be done prior to acquiring the latest solution.
165-
// // For more details, see: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1595580
166-
// runningDocumentTable.SaveFileIfDirty(destinationPath);
167-
//}
168-
169148
await TaskScheduler.Default;
170149
// WORKAROUND: We don't yet have a way to wait for the changes to propagate to Roslyn, tracked by https://github.com/dotnet/project-system/issues/3425
171150
// Instead, we wait for the IntelliSense stage to finish for the entire solution.
172151
IVsOperationProgressStatusService statusService = await _operationProgressService.GetValueAsync(token);
173152
await statusService.GetStageStatus(CommonOperationProgressStageIds.Intellisense).WaitForCompletionAsync().WithCancellation(token);
174153
// After waiting, a "new" published Solution is available.
175154
Solution solution = _workspace.CurrentSolution;
176-
//_workspace.WorkspaceChanged += _workspace_WorkspaceChanged;
177-
178-
//await _threadingService.SwitchToUIThread(token);
179-
//dynamic test = _workspace;
180-
//test.ProcessQueuedWorkOnUIThread();
181-
182-
//await _threadingService.SwitchToUIThread(token);
183-
//typeof(Workspace).GetMethod("ProcessQueuedWorkOnUIThread").Invoke(_workspace, Array.Empty<object>());
184155

185156
for (int i = 0; i < _renameActionSets.Count; i++)
186157
{
@@ -192,13 +163,6 @@ async Task ApplyRenamesAsync(IWaitContext context, RunningDocumentTable runningD
192163
solution = await renameActionSet.UpdateSolutionAsync(solution, token);
193164
}
194165

195-
//await _threadingService.SwitchToUIThread(token);
196-
//dynamic test = _workspace;
197-
//test.ProcessQueuedWorkOnUIThread();
198-
199-
//Thread.Sleep(2000);
200-
//_workspace.WorkspaceChanged -= _workspace_WorkspaceChanged;
201-
202166
await _threadingService.SwitchToUIThread(token);
203167
bool areChangesApplied = _roslynServices.ApplyChangesToSolution(_workspace, solution);
204168
Assert(areChangesApplied, "ApplyChangesToSolution returned false");
@@ -229,11 +193,5 @@ async Task<bool> IsEnabledOrConfirmedAsync()
229193
return isConfirmed;
230194
}
231195
}
232-
233-
//private void _workspace_WorkspaceChanged(object sender, WorkspaceChangeEventArgs e)
234-
//{
235-
// var test = e.ProjectId;
236-
// Assert(false, "_workspace_WorkspaceChanged");
237-
//}
238196
}
239197
}

0 commit comments

Comments
 (0)