Skip to content

Commit a1adb97

Browse files
committed
reload changed solution file presence
1 parent dc4c409 commit a1adb97

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/SharpIDE.Application/Features/SolutionDiscovery/SharpIdeSolutionModelExtensions.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,26 @@ private static void UpdateSlnFolderFromNew(this SharpIdeSolutionFolder existing,
3131
private static void DiffProjects(ObservableList<SharpIdeProjectModel> existing, ObservableList<SharpIdeProjectModel> updated)
3232
{
3333
// Projects whose Folder null-state changed: remove old, re-add new
34-
var folderChanged = existing
34+
var changedExistingProjects = existing
3535
.Join(updated, p => p.FilePath, np => np.FilePath, (p, np) => (Old: p, New: np))
3636
.Where(pair => (pair.Old.Folder is null) != (pair.New.Folder is null))
3737
.ToList();
38-
foreach (var (old, _) in folderChanged) existing.Remove(old);
39-
var toRemove = existing.ExceptBy(updated.Select(np => np.FilePath), p => p.FilePath).ToList();
40-
List<SharpIdeProjectModel> toAdd = [..updated.ExceptBy(existing.Select(p => p.FilePath), np => np.FilePath), ..folderChanged.Select(pair => pair.New)];
38+
39+
List<SharpIdeProjectModel> toRemove = [..existing.ExceptBy(updated.Select(np => np.FilePath), p => p.FilePath), ..changedExistingProjects.Select(pair => pair.Old)];
40+
List<SharpIdeProjectModel> toAdd = [..updated.ExceptBy(existing.Select(p => p.FilePath), np => np.FilePath), ..changedExistingProjects.Select(pair => pair.New)];
4141
foreach (var s in toRemove) existing.Remove(s);
4242
foreach (var s in toAdd) existing.Insert(GetInsertionPosition(existing, s), s);
4343
}
4444

4545
private static void DiffSlnFiles(ObservableList<SharpIdeSolutionFile> existing, ObservableList<SharpIdeSolutionFile> updated)
4646
{
47-
var toRemove = existing.ExceptBy(updated.Select(np => np.Path), p => p.Path).ToList();
48-
var toAdd = updated.ExceptBy(existing.Select(p => p.Path), np => np.Path).ToList();
47+
// Solution files whose .File null-state changed: remove old, re-add new
48+
var changedExistingSlnFiles = existing
49+
.Join(updated, p => p.Path, np => np.Path, (p, np) => (Old: p, New: np))
50+
.Where(pair => (pair.Old.File is null) != (pair.New.File is null))
51+
.ToList();
52+
List<SharpIdeSolutionFile> toRemove = [..existing.ExceptBy(updated.Select(np => np.Path), p => p.Path), ..changedExistingSlnFiles.Select(pair => pair.Old)];
53+
List<SharpIdeSolutionFile> toAdd = [..updated.ExceptBy(existing.Select(p => p.Path), np => np.Path), ..changedExistingSlnFiles.Select(pair => pair.New)];
4954
foreach (var s in toRemove) existing.Remove(s);
5055
foreach (var s in toAdd) existing.Insert(GetInsertionPosition(existing, s), s);
5156
}

0 commit comments

Comments
 (0)