Add solution restore progress indicator
This commit is contained in:
@@ -108,12 +108,15 @@ public class RoslynAnalysis(ILogger<RoslynAnalysis> logger, BuildService buildSe
|
|||||||
|
|
||||||
_msBuildProjectLoader = new CustomMsBuildProjectLoader(_workspace);
|
_msBuildProjectLoader = new CustomMsBuildProjectLoader(_workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using (var ___ = SharpIdeOtel.Source.StartActivity("RestoreSolution"))
|
||||||
|
{
|
||||||
|
// MsBuildProjectLoader doesn't do a restore which is absolutely required for resolving PackageReferences, if they have changed. I am guessing it just reads from project.assets.json
|
||||||
|
await _buildService.MsBuildAsync(_sharpIdeSolutionModel.FilePath, BuildType.Restore, cancellationToken);
|
||||||
|
}
|
||||||
using (var ___ = SharpIdeOtel.Source.StartActivity("OpenSolution"))
|
using (var ___ = SharpIdeOtel.Source.StartActivity("OpenSolution"))
|
||||||
{
|
{
|
||||||
//_msBuildProjectLoader!.LoadMetadataForReferencedProjects = true;
|
//_msBuildProjectLoader!.LoadMetadataForReferencedProjects = true;
|
||||||
|
|
||||||
// MsBuildProjectLoader doesn't do a restore which is absolutely required for resolving PackageReferences, if they have changed. I am guessing it just reads from project.assets.json
|
|
||||||
await _buildService.MsBuildAsync(_sharpIdeSolutionModel.FilePath, BuildType.Restore, cancellationToken);
|
|
||||||
var (solutionInfo, projectFileInfos) = await _msBuildProjectLoader!.LoadSolutionInfoAsync(_sharpIdeSolutionModel.FilePath, cancellationToken: cancellationToken);
|
var (solutionInfo, projectFileInfos) = await _msBuildProjectLoader!.LoadSolutionInfoAsync(_sharpIdeSolutionModel.FilePath, cancellationToken: cancellationToken);
|
||||||
_projectFileInfoMap = projectFileInfos;
|
_projectFileInfoMap = projectFileInfos;
|
||||||
_workspace.ClearSolution();
|
_workspace.ClearSolution();
|
||||||
|
|||||||
@@ -9,16 +9,19 @@ public partial class RunningTasksDisplay : HBoxContainer
|
|||||||
{
|
{
|
||||||
[Inject] private readonly ActivityMonitor _activityMonitor = null!;
|
[Inject] private readonly ActivityMonitor _activityMonitor = null!;
|
||||||
|
|
||||||
|
private bool _isSolutionRestoring;
|
||||||
private bool _isSolutionLoading;
|
private bool _isSolutionLoading;
|
||||||
private bool _isSolutionDiagnosticsBeingRetrieved;
|
private bool _isSolutionDiagnosticsBeingRetrieved;
|
||||||
|
|
||||||
|
private Label _solutionRestoringLabel = null!;
|
||||||
private Label _solutionLoadingLabel = null!;
|
private Label _solutionLoadingLabel = null!;
|
||||||
private Label _solutionDiagnosticsLabel = null!;
|
private Label _solutionDiagnosticsLabel = null!;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_solutionLoadingLabel = GetNode<Label>("SolutionLoadingLabel");
|
_solutionRestoringLabel = GetNode<Label>("%SolutionRestoringLabel");
|
||||||
_solutionDiagnosticsLabel = GetNode<Label>("SolutionDiagnosticsLabel");
|
_solutionLoadingLabel = GetNode<Label>("%SolutionLoadingLabel");
|
||||||
|
_solutionDiagnosticsLabel = GetNode<Label>("%SolutionDiagnosticsLabel");
|
||||||
Visible = false;
|
Visible = false;
|
||||||
_activityMonitor.ActivityStarted.Subscribe(OnActivityStarted);
|
_activityMonitor.ActivityStarted.Subscribe(OnActivityStarted);
|
||||||
_activityMonitor.ActivityStopped.Subscribe(OnActivityStopped);
|
_activityMonitor.ActivityStopped.Subscribe(OnActivityStopped);
|
||||||
@@ -41,16 +44,21 @@ public partial class RunningTasksDisplay : HBoxContainer
|
|||||||
{
|
{
|
||||||
_isSolutionLoading = isOccurring;
|
_isSolutionLoading = isOccurring;
|
||||||
}
|
}
|
||||||
|
else if (activity.DisplayName == "RestoreSolution")
|
||||||
|
{
|
||||||
|
_isSolutionRestoring = isOccurring;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var visible = _isSolutionDiagnosticsBeingRetrieved || _isSolutionLoading;
|
var visible = _isSolutionDiagnosticsBeingRetrieved || _isSolutionLoading || _isSolutionRestoring;
|
||||||
await this.InvokeAsync(() =>
|
await this.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
_solutionLoadingLabel.Visible = _isSolutionLoading;
|
_solutionLoadingLabel.Visible = _isSolutionLoading;
|
||||||
_solutionDiagnosticsLabel.Visible = _isSolutionDiagnosticsBeingRetrieved;
|
_solutionDiagnosticsLabel.Visible = _isSolutionDiagnosticsBeingRetrieved;
|
||||||
|
_solutionRestoringLabel.Visible = _isSolutionRestoring;
|
||||||
Visible = visible;
|
Visible = visible;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,15 @@ theme_override_font_sizes/font_size = 14
|
|||||||
text = "Updating Solution Diagnostics"
|
text = "Updating Solution Diagnostics"
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="SolutionRestoringLabel" type="Label" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_color = Color(0.67058825, 0.67058825, 0.67058825, 1)
|
||||||
|
theme_override_font_sizes/font_size = 14
|
||||||
|
text = "Restoring Solution"
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="ProgressBar" type="ProgressBar" parent="."]
|
[node name="ProgressBar" type="ProgressBar" parent="."]
|
||||||
custom_minimum_size = Vector2(150, 9)
|
custom_minimum_size = Vector2(150, 9)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|||||||
Reference in New Issue
Block a user