Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo.moya@xamarin.com>2020-01-26 23:36:36 +0300
committerRodrigo Moya <rodrigo.moya@xamarin.com>2020-01-26 23:36:36 +0300
commite86aa9fd633e2d1eb04d9e0da02bc263d706a285 (patch)
tree5e604a58c15eb7a04cd61bb7d66a1536434b67bb
parent96b42aa0741af179a8e501f426b6ff5451c27264 (diff)
[Ide] Calculate file nesting on demandpr-file-nesting-perf
Instead of loading all files at once, just calculate file nesting information on demand, that is, when the node builders ask for it. Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1030656
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/FileNestingService.cs17
1 files changed, 12 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/FileNestingService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/FileNestingService.cs
index b10336aea4..eae4760ba2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/FileNestingService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.FileNesting/FileNestingService.cs
@@ -187,9 +187,6 @@ namespace MonoDevelop.Ide.Projects.FileNesting
initialized = true;
fileNestingEnabled = FileNestingService.IsEnabledForProject (Project);
- foreach (var file in Project.Files) {
- AddFile (file);
- }
}
}
@@ -296,7 +293,12 @@ namespace MonoDevelop.Ide.Projects.FileNesting
if (!fileNestingEnabled)
return null;
- return projectFiles.TryGetValue (inputFile, out var nestingInfo) ? nestingInfo.Parent : null;
+ if (!projectFiles.TryGetValue (inputFile, out var nestingInfo)) {
+ // Not found, so retrieve this file's information
+ nestingInfo = AddFile (inputFile);
+ }
+
+ return nestingInfo?.Parent;
}
public ProjectFileCollection GetChildrenForFile (ProjectFile inputFile)
@@ -305,7 +307,12 @@ namespace MonoDevelop.Ide.Projects.FileNesting
if (!fileNestingEnabled)
return null;
- return projectFiles.TryGetValue (inputFile, out var nestingInfo) ? nestingInfo.Children : null;
+ if (!projectFiles.TryGetValue (inputFile, out var nestingInfo)) {
+ // Not found, so retrieve this file's information
+ nestingInfo = AddFile (inputFile);
+ }
+
+ return nestingInfo?.Children;
}
public void Dispose ()