Skip to content

Commit

Permalink
Don't constantly switch project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andersbakken committed Nov 1, 2021
1 parent 60889dc commit 923fb39
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,13 @@ void Server::setCurrentProject(const std::shared_ptr<Project> &project)
{
std::shared_ptr<Project> old = currentProject();
if (project != old) {
debug() << "changing current from"
<< (old ? old->path() : String())
<< (old ? old->trailer() : String())
<< "to"
<< (project ? project->path() : String())
<< (project ? project->trailer() : String());

if (old && old->fileManager())
old->fileManager()->clearFileSystemWatcher();
mCurrentProject = project;
Expand Down Expand Up @@ -827,10 +834,10 @@ List<std::shared_ptr<Project>> Server::projectsForMatches(Flags<QueryMessage::Fl
if (m > best) {
best = m;
ret.insert(ret.begin(), project);
setCurrentProject(project);
} else {
ret.append(project);
}
setCurrentProject(project);
break;
}
}
Expand Down

0 comments on commit 923fb39

Please sign in to comment.