Skip to content

Commit d54313d

Browse files
committed
Fix bug where memory usage and index size are not always displayed
1 parent 91f0c0d commit d54313d

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/VsChromium/Features/ToolWindows/CodeSearch/CodeSearchController.cs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,19 @@ private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs
159159
public IOpenDocumentHelper OpenDocumentHelper { get { return _openDocumentHelper; } }
160160

161161
public void OnFileSystemTreeComputing() {
162-
var items = CreateInfromationMessages("Loading files from VS Chromium projects...)");
163-
ViewModel.SetInformationMessages(items);
162+
// Display a generic "loading" message the first time a file system tree
163+
// is loaded.
164+
if (!ViewModel.FileSystemTreeAvailable) {
165+
var items = CreateInfromationMessages(
166+
"Loading files from VS Chromium projects...");
167+
ViewModel.SetInformationMessages(items);
164168

165-
if (!ViewModel.FileSystemTreeAvailable || ViewModel.ActiveDisplay == CodeSearchViewModel.DisplayKind.InformationMessages) {
166-
_searchResultDocumentChangeTracker.Disable();
167-
ViewModel.SwitchToInformationMessages();
169+
// Display the new info messages, except if there is an active search
170+
// result.
171+
if (ViewModel.ActiveDisplay == CodeSearchViewModel.DisplayKind.InformationMessages) {
172+
_searchResultDocumentChangeTracker.Disable();
173+
ViewModel.SwitchToInformationMessages();
174+
}
168175
}
169176
}
170177

@@ -174,17 +181,19 @@ public void OnFileSystemTreeComputed(FileSystemTree tree) {
174181

175182
if (ViewModel.FileSystemTreeAvailable) {
176183
var items = CreateInfromationMessages(
177-
"No search results available - Type text to search for in the \"Search Code\" or \"File Paths\" text box.");
184+
"No search results available - Type text to search for " +
185+
"in the \"Search Code\" or \"File Paths\" text box.");
178186
ViewModel.SetInformationMessages(items);
179187
if (ViewModel.ActiveDisplay == CodeSearchViewModel.DisplayKind.InformationMessages) {
180188
_searchResultDocumentChangeTracker.Disable();
181189
ViewModel.SwitchToInformationMessages();
182190
}
183191

184192
RefreshView(tree.Version);
193+
FetchDatabaseStatistics();
185194
} else {
186195
var items = CreateInfromationMessages(
187-
string.Format("Open a source file from a local Chromium enlistment or") + "\r\n" +
196+
"Open a source file from a local Chromium enlistment or" + "\r\n" +
188197
string.Format("from a directory containing a \"{0}\" file.", ConfigurationFileNames.ProjectFileName));
189198
ViewModel.SetInformationMessages(items);
190199
_searchResultDocumentChangeTracker.Disable();
@@ -203,11 +212,12 @@ public void OnFilesLoading() {
203212
}
204213

205214
public void OnFilesLoadingProgress() {
206-
RefreshView(-1);
215+
FetchDatabaseStatistics();
207216
}
208217

209218
public void OnFilesLoaded(long treeVersion) {
210219
RefreshView(treeVersion);
220+
FetchDatabaseStatistics();
211221
}
212222

213223
/// <summary>
@@ -227,7 +237,6 @@ private void RefreshView(long treeVersion) {
227237
// Add top level nodes in search results explaining results may be outdated
228238
AddResultsOutdatedMessage();
229239
}
230-
FetchDatabaseStatistics();
231240
}
232241

233242
public void CancelSearch() {

0 commit comments

Comments
 (0)