Skip to content

Commit

Permalink
Close #1506
Browse files Browse the repository at this point in the history
  • Loading branch information
Hosch250 committed Jun 7, 2016
1 parent 88cb6c2 commit e9e5546
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion RetailCoder.VBE/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ async void sink_ProjectRenamed(object sender, DispatcherRenamedEventArgs<VBProje

_logger.Debug("Project '{0}' (ID {1}) was renamed to '{2}'.", e.OldName, e.Item.HelpFile, e.Item.Name);

// note: if a bug is discovered with renaming a project, it may just need to be removed and readded.
_parser.State.RemoveProject(e.Item.HelpFile);
_parser.State.AddProject(e.Item);

_parser.State.OnParseRequested(sender);
}
Expand Down
2 changes: 1 addition & 1 deletion RetailCoder.VBE/Refactorings/Rename/RenameRefactoring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ private void Rename()
else if (_model.Target.DeclarationType == DeclarationType.Project)
{
RenameProject();
return; // renaming a project automatically triggers a reparse
}
else
{
Expand Down Expand Up @@ -263,7 +264,6 @@ private void RenameProject()
if (project != null)
{
project.Name = _model.NewName;
_state.RemoveDeclaration(_model.Target);
}
}
catch (COMException)
Expand Down
6 changes: 6 additions & 0 deletions Rubberduck.Parsing/VBA/RubberduckParserState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,16 @@ public void AddProject(VBProject project)

public void RemoveProject(string projectId)
{
var project = Projects.FirstOrDefault(f => f.HelpFile == projectId);
if (_projects.ContainsKey(projectId))
{
_projects.Remove(projectId);
}

if (project != null)
{
ClearStateCache(project);
}
}

public void RemoveProject(VBProject project)
Expand Down

0 comments on commit e9e5546

Please sign in to comment.