提交 ff1e8f1c 编写于 作者: J Jason Malinowski

Remove UpdateSolutionForBatch's documentsToClose

This would have never worked: we would have been closing documents
after we had already removed them.
上级 ff46240b
...@@ -295,12 +295,11 @@ private void OnBatchScopeDisposed() ...@@ -295,12 +295,11 @@ private void OnBatchScopeDisposed()
var documentFileNamesAdded = ImmutableArray.CreateBuilder<string>(); var documentFileNamesAdded = ImmutableArray.CreateBuilder<string>();
var documentsToOpen = new List<(DocumentId, SourceTextContainer)>(); var documentsToOpen = new List<(DocumentId, SourceTextContainer)>();
var documentsToClose = new List<(DocumentId, TextLoader)>();
_workspace.ApplyBatchChangeToProject(Id, solution => _workspace.ApplyBatchChangeToProject(Id, solution =>
{ {
solution = _sourceFiles.UpdateSolutionForBatch(solution, documentFileNamesAdded, documentsToOpen, documentsToClose, (s, d) => s.AddDocument(d), (s, id) => s.RemoveDocument(id)); solution = _sourceFiles.UpdateSolutionForBatch(solution, documentFileNamesAdded, documentsToOpen, (s, d) => s.AddDocument(d), (s, id) => s.RemoveDocument(id));
solution = _additionalFiles.UpdateSolutionForBatch(solution, documentFileNamesAdded, documentsToOpen, documentsToClose, (s, d) => s.AddAdditionalDocument(d), (s, id) => s.RemoveAdditionalDocument(id)); solution = _additionalFiles.UpdateSolutionForBatch(solution, documentFileNamesAdded, documentsToOpen, (s, d) => s.AddAdditionalDocument(d), (s, id) => s.RemoveAdditionalDocument(id));
// Metadata reference adding... // Metadata reference adding...
if (_metadataReferencesAddedInBatch.Count > 0) if (_metadataReferencesAddedInBatch.Count > 0)
...@@ -389,11 +388,6 @@ private void OnBatchScopeDisposed() ...@@ -389,11 +388,6 @@ private void OnBatchScopeDisposed()
_workspace.ApplyChangeToWorkspace(w => w.OnDocumentOpened(documentId, textContainer)); _workspace.ApplyChangeToWorkspace(w => w.OnDocumentOpened(documentId, textContainer));
} }
foreach (var (documentId, textLoader) in documentsToClose)
{
_workspace.ApplyChangeToWorkspace(w => w.OnDocumentClosed(documentId, textLoader));
}
// Check for those files being opened to start wire-up if necessary // Check for those files being opened to start wire-up if necessary
_workspace.CheckForOpenDocuments(documentFileNamesAdded.ToImmutable()); _workspace.CheckForOpenDocuments(documentFileNamesAdded.ToImmutable());
} }
...@@ -1089,7 +1083,6 @@ public void ProcessFileChange(string fullFilePath) ...@@ -1089,7 +1083,6 @@ public void ProcessFileChange(string fullFilePath)
Solution solution, Solution solution,
ImmutableArray<string>.Builder documentFileNamesAdded, ImmutableArray<string>.Builder documentFileNamesAdded,
List<(DocumentId, SourceTextContainer)> documentsToOpen, List<(DocumentId, SourceTextContainer)> documentsToOpen,
List<(DocumentId, TextLoader)> documentsToClose,
Func<Solution, DocumentInfo, Solution> addDocument, Func<Solution, DocumentInfo, Solution> addDocument,
Func<Solution, DocumentId, Solution> removeDocument) Func<Solution, DocumentId, Solution> removeDocument)
{ {
...@@ -1112,12 +1105,6 @@ public void ProcessFileChange(string fullFilePath) ...@@ -1112,12 +1105,6 @@ public void ProcessFileChange(string fullFilePath)
foreach (var documentId in _documentsRemovedInBatch) foreach (var documentId in _documentsRemovedInBatch)
{ {
solution = solution.RemoveDocument(documentId); solution = solution.RemoveDocument(documentId);
if (_sourceTextContainersToDocumentIds.TryGetKey(documentId, out var textContainer))
{
// TODO: correct inputs here
documentsToClose.Add((documentId, new SourceTextLoader(textContainer, null)));
}
} }
ClearAndZeroCapacity(_documentsRemovedInBatch); ClearAndZeroCapacity(_documentsRemovedInBatch);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册