Browse Source

Add completion setup on settings load

pull/165/head
Ionite 1 year ago
parent
commit
9ca11f872c
No known key found for this signature in database
  1. 5
      StabilityMatrix.Avalonia/Models/TagCompletion/CompletionProvider.cs
  2. 7
      StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs

5
StabilityMatrix.Avalonia/Models/TagCompletion/CompletionProvider.cs

@ -160,7 +160,10 @@ public partial class CompletionProvider : ICompletionProvider
// If tagsDir is empty and no selected, download defaults
if (
!tagsDir.Info.EnumerateFiles().Any()
&& settingsManager.Settings.TagCompletionCsv is null
&& (
settingsManager.Settings.TagCompletionCsv is null
|| !tagsDir.JoinFile(settingsManager.Settings.TagCompletionCsv).Exists
)
)
{
foreach (var remoteCsv in Assets.DefaultCompletionTags)

7
StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs

@ -11,6 +11,7 @@ using System.Reflection;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using AsyncAwaitBestPractices;
using Avalonia;
using Avalonia.Controls.Notifications;
using Avalonia.Controls.Primitives;
@ -215,9 +216,11 @@ public partial class SettingsViewModel : PageViewModelBase
}
/// <inheritdoc />
public override void OnLoaded()
public override async Task OnLoadedAsync()
{
base.OnLoaded();
await base.OnLoadedAsync();
await notificationService.TryAsync(completionProvider.Setup());
UpdateAvailableTagCompletionCsvs();
}

Loading…
Cancel
Save