internal DocumentState?GetDocumentState(DocumentId documentId) => _projectState.GetDocumentState(documentId);
private ImmutableDictionary<string, ImmutableArray<DocumentId>> CreateLinkedFilesMapWithRemovedDocuments( ProjectState projectState, IEnumerable<DocumentId> documentIds) { var builder = _linkedFilesMap.ToBuilder(); foreach (var documentId in documentIds) { var filePath = projectState.GetDocumentState(documentId).FilePath; if (string.IsNullOrEmpty(filePath)) { continue; } ImmutableArray<DocumentId> documentIdsWithPath; if (!builder.TryGetValue(filePath, out documentIdsWithPath) || !documentIdsWithPath.Contains(documentId)) { throw new ArgumentException("The given documentId was not found in the linkedFilesMap."); } if (documentIdsWithPath.Length == 1) { builder.Remove(filePath); } else { builder[filePath] = documentIdsWithPath.Remove(documentId); } } return builder.ToImmutable(); }
internal DocumentState GetDocumentState(DocumentId documentId) { return(_projectState.GetDocumentState(documentId)); }
private ImmutableDictionary<string, ImmutableArray<DocumentId>> CreateLinkedFilesMapWithAddedDocuments(ProjectState projectState, IEnumerable<DocumentId> documentIds) { var builder = _linkedFilesMap.ToBuilder(); foreach (var documentId in documentIds) { var filePath = projectState.GetDocumentState(documentId).FilePath; if (string.IsNullOrEmpty(filePath)) { continue; } ImmutableArray<DocumentId> documentIdsWithPath; builder[filePath] = builder.TryGetValue(filePath, out documentIdsWithPath) ? documentIdsWithPath.Add(documentId) : ImmutableArray.Create(documentId); } return builder.ToImmutable(); }