Skip to content

Commit

Permalink
Fix ordering of sync to avoid name collisions on default project names.
Browse files Browse the repository at this point in the history
  • Loading branch information
comintern committed Jan 16, 2019
1 parent 58a1d5b commit 92534c9
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -75,14 +75,15 @@ public override void Synchronize(List<Declaration> updated)

Declaration = match;
updated.Remove(Declaration);
var children = updated.Where(declaration => declaration.ProjectId.Equals(Declaration.ProjectId)).ToList();
updated.RemoveAll(declaration => declaration.ProjectId.Equals(Declaration.ProjectId));

// Reference synchronization is deferred to AddNewChildren for 2 reasons. First, it doesn't make sense to sling around a List of
// declaration for something that doesn't need it. Second (and more importantly), the priority can't be set without calling
// GetProjectReferenceModels, which hits the VBE COM interfaces. So, we only want to do that once. The bonus 3rd reason is that it
// can be called from the ctor this way.

SynchronizeChildren(updated.Where(declaration => declaration.ProjectId.Equals(Declaration.ProjectId)).ToList());
updated.RemoveAll(declaration => declaration.ProjectId.Equals(Declaration.ProjectId));
SynchronizeChildren(children);

// Have to do this again - the project might have been saved or otherwise had the ProjectDisplayName changed.
SetName();
Expand Down

0 comments on commit 92534c9

Please sign in to comment.