Use GodotTask everywhere
This commit is contained in:
@@ -47,9 +47,7 @@ public partial class IdeRoot : Control
|
||||
|
||||
private void OnFileSelected(string path)
|
||||
{
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
_ = GodotTask.Run(async () =>
|
||||
{
|
||||
GD.Print($"Selected: {path}");
|
||||
var solutionModel = await VsPersistenceMapper.GetSolutionModel(path);
|
||||
@@ -78,12 +76,6 @@ public partial class IdeRoot : Control
|
||||
|
||||
//var runnableProject = solutionModel.AllProjects.First(s => s.IsRunnable);
|
||||
//await this.InvokeAsync(() => _runPanel.NewRunStarted(runnableProject));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GD.PrintErr($"Error loading solution: {e.Message}");
|
||||
GD.PrintErr(e.StackTrace);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -114,9 +114,7 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
{
|
||||
// update the MSBuildWorkspace
|
||||
RoslynAnalysis.UpdateDocument(_currentFile, Text);
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
_ = GodotTask.Run(async () =>
|
||||
{
|
||||
var syntaxHighlighting = await RoslynAnalysis.GetDocumentSyntaxHighlighting(_currentFile);
|
||||
var diagnostics = await RoslynAnalysis.GetDocumentDiagnostics(_currentFile);
|
||||
@@ -125,11 +123,6 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
SetSyntaxHighlightingModel(syntaxHighlighting);
|
||||
SetDiagnosticsModel(diagnostics);
|
||||
}).CallDeferred();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
GD.PrintErr($"Error Calling OnTextChanged: {ex.Message}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -140,9 +133,7 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
if (codeAction is null) return;
|
||||
var currentCaretPosition = GetCaretPosition();
|
||||
var vScroll = GetVScroll();
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
_ = GodotTask.Run(async () =>
|
||||
{
|
||||
await RoslynAnalysis.ApplyCodeActionAsync(codeAction);
|
||||
var fileContents = await File.ReadAllTextAsync(_currentFile.Path);
|
||||
@@ -159,11 +150,6 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
SetVScroll(vScroll);
|
||||
EndComplexOperation();
|
||||
}).CallDeferred();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
GD.PrintErr($"Error applying code fix: {ex.Message}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -301,9 +287,7 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
_popupMenu.AddItem("Getting Context Actions...", 0);
|
||||
_popupMenu.Popup();
|
||||
GD.Print($"Code fixes requested at line {caretLine}, column {caretColumn}");
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
_ = GodotTask.Run(async () =>
|
||||
{
|
||||
var linePos = new LinePosition(caretLine, caretColumn);
|
||||
var codeActions = await RoslynAnalysis.GetCodeFixesForDocumentAtPosition(_currentFile, linePos);
|
||||
@@ -320,11 +304,6 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
if (codeActions.Length is not 0) _popupMenu.SetFocusedItem(0);
|
||||
GD.Print($"Code fixes found: {codeActions.Length}, displaying menu");
|
||||
}).CallDeferred();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
GD.Print(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -333,9 +312,7 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
var (caretLine, caretColumn) = GetCaretPosition();
|
||||
|
||||
GD.Print($"Code completion requested at line {caretLine}, column {caretColumn}");
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
_ = GodotTask.Run(async () =>
|
||||
{
|
||||
var linePos = new LinePosition(caretLine, caretColumn);
|
||||
|
||||
@@ -351,11 +328,6 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
//RequestCodeCompletion(true);
|
||||
GD.Print($"Found {completions.ItemsList.Count} completions, displaying menu");
|
||||
}).CallDeferred();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
GD.Print(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user