Make AllFiles threadsafe
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}");
|
||||
|
||||
@@ -119,7 +119,7 @@ public partial class ProblemsPanel : Control
|
||||
private void OpenDocumentContainingDiagnostic(Diagnostic diagnostic)
|
||||
{
|
||||
var fileLinePositionSpan = diagnostic.Location.GetMappedLineSpan();
|
||||
var file = Solution!.AllFiles.Single(f => f.Path == fileLinePositionSpan.Path);
|
||||
var file = Solution!.AllFiles[fileLinePositionSpan.Path];
|
||||
var linePosition = new SharpIdeFileLinePosition(fileLinePositionSpan.StartLinePosition.Line, fileLinePositionSpan.StartLinePosition.Character);
|
||||
GodotGlobalEvents.Instance.FileExternallySelected.InvokeParallelFireAndForget(file, linePosition);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public partial class IdeRoot : Control
|
||||
|
||||
var previousTabs = Singletons.AppState.RecentSlns.Single(s => s.FilePath == solutionModel.FilePath).IdeSolutionState.OpenTabs;
|
||||
var filesToOpen = previousTabs
|
||||
.Select(s => (solutionModel.AllFiles.SingleOrDefault(f => f.Path == s.FilePath), new SharpIdeFileLinePosition(s.CaretLine, s.CaretColumn), s.IsSelected))
|
||||
.Select(s => (solutionModel.AllFiles.GetValueOrDefault(s.FilePath), new SharpIdeFileLinePosition(s.CaretLine, s.CaretColumn), s.IsSelected))
|
||||
.Where(s => s.Item1 is not null)
|
||||
.OfType<(SharpIdeFile file, SharpIdeFileLinePosition linePosition, bool isSelected)>()
|
||||
.ToList();
|
||||
|
||||
Reference in New Issue
Block a user