Make AllFiles threadsafe

This commit is contained in:
Matt Parker
2025-11-23 14:49:45 +10:00
parent 8ee1499894
commit a6fc3c8976
10 changed files with 35 additions and 23 deletions

View File

@@ -126,7 +126,7 @@ public partial class CodeEditorPanel : MarginContainer
if (executionStopInfo.FilePath != currentSharpIdeFile?.Path)
{
var file = Solution.AllFiles.Single(s => s.Path == executionStopInfo.FilePath);
var file = Solution.AllFiles[executionStopInfo.FilePath];
await GodotGlobalEvents.Instance.FileExternallySelected.InvokeParallelAsync(file, null).ConfigureAwait(false);
}
var lineInt = executionStopInfo.Line - 1; // Debugging is 1-indexed, Godot is 0-indexed

View File

@@ -44,7 +44,7 @@ public partial class SharpIdeCodeEdit
var referenceLocation = locations[0];
var referenceLineSpan = referenceLocation.Location.GetMappedLineSpan();
var sharpIdeFile = Solution!.AllFiles.SingleOrDefault(f => f.Path == referenceLineSpan.Path);
var sharpIdeFile = Solution!.AllFiles.GetValueOrDefault(referenceLineSpan.Path);
if (sharpIdeFile is null)
{
GD.Print($"Reference file not found in solution: {referenceLineSpan.Path}");
@@ -82,7 +82,7 @@ public partial class SharpIdeCodeEdit
// Lets jump to the definition
var definitionLocation = locations[0];
var definitionLineSpan = definitionLocation.GetMappedLineSpan();
var sharpIdeFile = Solution!.AllFiles.SingleOrDefault(f => f.Path == definitionLineSpan.Path);
var sharpIdeFile = Solution!.AllFiles.GetValueOrDefault(definitionLineSpan.Path);
if (sharpIdeFile is null)
{
GD.Print($"Definition file not found in solution: {definitionLineSpan.Path}");