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