Skip to content

Commit

Permalink
Upgrade packages
Browse files Browse the repository at this point in the history
  • Loading branch information
aelij committed Jul 27, 2023
1 parent 1958cfb commit bc61575
Show file tree
Hide file tree
Showing 24 changed files with 123 additions and 154 deletions.
27 changes: 14 additions & 13 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
</PropertyGroup>
<PropertyGroup>
<DotNetExtensionsVersion>7.0.0</DotNetExtensionsVersion>
<RoslynVersion>4.7.0-1.final</RoslynVersion>
<RoslynPrivateVersion>4.7.0-1.23226.11</RoslynPrivateVersion>
<AvaloniaVersion>11.0.0-preview4</AvaloniaVersion>
<RxVersion>5.0.0</RxVersion>
<NuGetVersion>6.4.0</NuGetVersion>
<RoslynVersion>4.7.0-2.final</RoslynVersion>
<RoslynPrivateVersion>4.7.0-2.23280.4</RoslynPrivateVersion>
<AvaloniaVersion>11.0.0</AvaloniaVersion>
<RxVersion>6.0.0</RxVersion>
<NuGetVersion>6.6.1</NuGetVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="AvalonEdit" Version="6.2.0.78" />
<PackageVersion Include="Avalonia.AvaloniaEdit" Version="11.0.0-preview2" />
<PackageVersion Include="AvalonEdit" Version="6.3.0.90" />
<PackageVersion Include="Avalonia.AvaloniaEdit" Version="11.0.0" />
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.ThemeManager" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)" />
Expand All @@ -29,11 +29,12 @@
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(DotNetExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="$(DotNetExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(DotNetExtensionsVersion)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Mono.Cecil" Version="0.11.4" />
<PackageVersion Include="Nerdbank.Streams" Version="2.9.112" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="Microsoft.VisualStudio.Validation" Version="17.6.11" />
<PackageVersion Include="Mono.Cecil" Version="0.11.5" />
<PackageVersion Include="Nerdbank.Streams" Version="2.10.69" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NuGet.Commands" Version="$(NuGetVersion)" />
<PackageVersion Include="NuGet.Versioning" Version="$(NuGetVersion)" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
Expand All @@ -42,8 +43,8 @@
<PackageVersion Include="System.Reflection.MetadataLoadContext" Version="7.0.0" />
<PackageVersion Include="System.Reflection.Metadata" Version="7.0.0" />
<PackageVersion Include="System.Composition" Version="7.0.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0" />
<PackageVersion Include="Xunit.StaFact" Version="1.1.11" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit" Version="2.5.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.101"
"version": "7.0.300"
},
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "3.4.0"
Expand Down
4 changes: 2 additions & 2 deletions src/RestoreHelper/RestoreHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<NoWarn>$(NoWarn);NU1603;NU1605</NoWarn>
</PropertyGroup>
<!--
Unfortunately we can't use the public feed version because it doesn't contain `LanguageServer.Protocol`.
Must correlate its version using the Git commit ID.
Unfortunately we can't use the public feed version because it doesn't the following packages.
We must manually correlate their version using the Git commit ID.
-->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.LanguageServer.Protocol" Version="$(RoslynPrivateVersion)" GeneratePathProperty="true" IncludeAssets="none" PrivateAssets="all" />
Expand Down
6 changes: 3 additions & 3 deletions src/RoslynPad.Avalonia/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
xmlns:codeActions="clr-namespace:Microsoft.CodeAnalysis.CodeActions;assembly=Microsoft.CodeAnalysis.Workspaces"
xmlns:codeFixes="clr-namespace:RoslynPad.Roslyn.CodeFixes;assembly=RoslynPad.Roslyn">
<Application.Styles>
<FluentTheme Mode="Light"/>
<StyleInclude Source="avares://AvaloniaEdit/AvaloniaEdit.xaml" />
<FluentTheme />
<StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />

<Style Selector="cc|CompletionList">
<Style Selector="cc|CompletionList">
<Setter Property="Template">
<ControlTemplate>
<cc:CompletionListBox Name="PART_ListBox">
Expand Down
2 changes: 1 addition & 1 deletion src/RoslynPad.Avalonia/AppDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public Task InvokeTaskAsync(Action action, AppDispatcherPriority priority = AppD

private Task InternalInvoke(Action action, AppDispatcherPriority priority, CancellationToken cancellationToken)
{
return Dispatcher.UIThread.InvokeAsync(action, ConvertPriority(priority));
return Dispatcher.UIThread.InvokeAsync(action, ConvertPriority(priority), cancellationToken).GetTask();
}

private DispatcherPriority ConvertPriority(AppDispatcherPriority priority)
Expand Down
2 changes: 1 addition & 1 deletion src/RoslynPad.Avalonia/DocumentTreeView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
</Border>

<TreeView Grid.Row="1"
Items="{Binding DocumentRoot.Children}"
ItemsSource="{Binding DocumentRoot.Children}"
Name="Tree">
<TreeView.ItemTemplate>
<TreeDataTemplate ItemsSource="{Binding Children}">
Expand Down
49 changes: 14 additions & 35 deletions src/RoslynPad.Avalonia/DocumentTreeView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,50 +1,26 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using RoslynPad.UI;
using Avalonia.VisualTree;
using System.Linq;

namespace RoslynPad;

public class DocumentTreeView : UserControl
public partial class DocumentTreeView : UserControl
{
private MainViewModel _viewModel;
private MainViewModel? _viewModel;

#pragma warning disable CS8618 // Non-nullable field is uninitialized.
public DocumentTreeView()
#pragma warning restore CS8618 // Non-nullable field is uninitialized.
{
AvaloniaXamlLoader.Load(this);
InitializeComponent();
var treeView = this.Find<TreeView>("Tree");
if (treeView != null)
{
treeView.ItemContainerGenerator.Materialized += ItemContainerGenerator_Materialized;
treeView.ItemContainerGenerator.Dematerialized += ItemContainerGenerator_Dematerialized;
}
}

private void ItemContainerGenerator_Materialized(object? sender, Avalonia.Controls.Generators.ItemContainerEventArgs e)
{
foreach (var item in e.Containers)
{
if (item.ContainerControl is TreeViewItem treeViewItem)
{
treeViewItem.DoubleTapped += OnDocumentClick;
treeViewItem.KeyDown += OnDocumentKeyDown;
}
}
}

private void ItemContainerGenerator_Dematerialized(object? sender, Avalonia.Controls.Generators.ItemContainerEventArgs e)
{
foreach (var item in e.Containers)
{
if (item.ContainerControl is TreeViewItem treeViewItem)
{
treeViewItem.DoubleTapped -= OnDocumentClick;
treeViewItem.KeyDown -= OnDocumentKeyDown;
}
treeView.DoubleTapped += OnDocumentClick;
treeView.KeyDown += OnDocumentKeyDown;
}
}

Expand All @@ -53,7 +29,6 @@ protected override void OnDataContextChanged(EventArgs e)
_viewModel = DataContext as MainViewModel ?? throw new InvalidOperationException("DataContext is null");
}


private void OnDocumentClick(object? sender, RoutedEventArgs e)
{
OpenDocument(e.Source);
Expand All @@ -69,9 +44,13 @@ private void OnDocumentKeyDown(object? sender, KeyEventArgs e)

private void OpenDocument(object? source)
{
if ((source as Control)?.DataContext is DocumentViewModel documentViewModel)
var item = (source as Visual)?.GetSelfAndVisualAncestors()
.OfType<TreeViewItem>()
.FirstOrDefault();

if (item?.DataContext is DocumentViewModel documentViewModel)
{
_viewModel.OpenDocument(documentViewModel);
_viewModel?.OpenDocument(documentViewModel);
}
}
}
6 changes: 3 additions & 3 deletions src/RoslynPad.Avalonia/DocumentView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
Width="16"
Height="16" />
</Button>
<ComboBox Items="{Binding AvailablePlatforms, Mode=OneTime}"
<ComboBox ItemsSource="{Binding AvailablePlatforms, Mode=OneTime}"
SelectedItem="{Binding Platform}" />
<Button ToolTip.Tip="Set platform as default"
Command="{Binding SetDefaultPlatformCommand, Mode=OneTime}">
Expand All @@ -108,7 +108,7 @@
IsEnabled="{Binding NuGet.IsEnabled}">
<MenuItem Name="RootNuGetMenu"
IsSubMenuOpen="{Binding NuGet.IsPackagesMenuOpen}"
Items="{Binding NuGet.Packages}"
ItemsSource="{Binding NuGet.Packages}"
Header="{Binding NuGet, Mode=OneTime}"
ToolTip.Tip="NuGet Packages">
<MenuItem.Styles>
Expand Down Expand Up @@ -205,7 +205,7 @@
Grid.Row="1" />

<TreeView Grid.Row="3"
Items="{Binding Results}">
ItemsSource="{Binding Results}">
<TreeView.ItemTemplate>
<TreeDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
Expand Down
5 changes: 2 additions & 3 deletions src/RoslynPad.Avalonia/DocumentView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Runtime.InteropServices;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using AvaloniaEdit.Document;
using Microsoft.CodeAnalysis.Text;
using RoslynPad.Editor;
Expand All @@ -10,13 +9,13 @@

namespace RoslynPad;

class DocumentView : UserControl, IDisposable
partial class DocumentView : UserControl, IDisposable
{
private readonly RoslynCodeEditor _editor;

public DocumentView()
{
AvaloniaXamlLoader.Load(this);
InitializeComponent();

_editor = this.FindControl<RoslynCodeEditor>("Editor") ?? throw new InvalidOperationException("Missing Editor");
_editor.FontFamily = GetPlatformFontFamily();
Expand Down
2 changes: 1 addition & 1 deletion src/RoslynPad.Avalonia/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</Border>

<Grid>
<TabControl Items="{Binding OpenDocuments}"
<TabControl ItemsSource="{Binding OpenDocuments}"
SelectedItem="{Binding CurrentOpenDocument}">
<TabControl.ItemTemplate>
<DataTemplate>
Expand Down
13 changes: 6 additions & 7 deletions src/RoslynPad.Avalonia/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using RoslynPad.UI;
using System;
using System;
using System.Composition.Hosting;
using System.Reflection;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Markup.Xaml;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using RoslynPad.UI;

namespace RoslynPad;

class MainWindow : Window
partial class MainWindow : Window
{
private readonly MainViewModelBase _viewModel;

Expand All @@ -35,7 +34,7 @@ public MainWindow()
FontSize = _viewModel.Settings.WindowFontSize.Value;
}

AvaloniaXamlLoader.Load(this);
InitializeComponent();
}

protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
Expand Down
6 changes: 2 additions & 4 deletions src/RoslynPad.Avalonia/OpenFileDialogAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Platform.Storage;
using Avalonia.Platform.Storage.FileIO;
using RoslynPad.UI;

namespace RoslynPad;
Expand Down Expand Up @@ -33,7 +32,7 @@ internal class OpenFileDialogAdapter : IOpenFileDialog
var options = new FilePickerOpenOptions
{
AllowMultiple = AllowMultiple,
SuggestedStartLocation = new BclStorageFolder(InitialDirectory),
SuggestedStartLocation = await window.StorageProvider.TryGetFolderFromPathAsync(InitialDirectory).ConfigureAwait(false),
};

if (Filter != null)
Expand All @@ -46,7 +45,6 @@ internal class OpenFileDialogAdapter : IOpenFileDialog

var file = await window.StorageProvider.OpenFilePickerAsync(options).ConfigureAwait(false);

return file.Select(f => { f.TryGetUri(out var uri); return uri?.LocalPath!; })
.Where(f => f != null).ToArray();
return file.Select(f => f.Path.ToString()).ToArray();
}
}
4 changes: 1 addition & 3 deletions src/RoslynPad.Avalonia/SaveFileDialogAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Platform.Storage.FileIO;
using Avalonia.Platform.Storage;
using RoslynPad.UI;
using System;

namespace RoslynPad;

Expand Down Expand Up @@ -53,6 +51,6 @@ public bool AddExtension
}

var file = await window.StorageProvider.SaveFilePickerAsync(options).ConfigureAwait(false);
return file?.TryGetUri(out var uri) == true ? uri.LocalPath : null;
return file?.Path.ToString();
}
}
22 changes: 11 additions & 11 deletions src/RoslynPad.Editor.Avalonia/AvaloniaExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,36 @@
using Avalonia.Input;
using Avalonia.Media;
using Avalonia.Threading;
using Avalonia.VisualTree;
using System;
using System.Collections.Generic;

namespace RoslynPad.Editor;

internal static class AvaloniaExtensions
{
public static T? FindAncestorByType<T>(this IControl control)
where T : class, IControl
public static T? FindAncestorByType<T>(this Control control)
where T : Control
{
IControl? result = control;
Control? result = control;

while (result != null && !(result is T))
{
result = result.Parent;
result = result.Parent as Control;
}

return result as T;
}

public static Window? GetWindow(this Control c) => c.FindAncestorByType<Window>();

public static Dispatcher GetDispatcher(this IControl o) => Dispatcher.UIThread;
public static Dispatcher GetDispatcher(this Control o) => Dispatcher.UIThread;

public static Size GetRenderSize(this IControl element) => element.Bounds.Size;
public static Size GetRenderSize(this Control element) => element.Bounds.Size;

public static void HookupLoadedUnloadedAction(this IControl element, Action<bool> action)
public static void HookupLoadedUnloadedAction(this Control element, Action<bool> action)
{
if (element.IsAttachedToVisualTree)
if (element.IsAttachedToVisualTree())
{
action(true);
}
Expand All @@ -51,7 +52,7 @@ public static void DetachLocationChanged(this Window topLevel, EventHandler<Pixe
topLevel.PositionChanged -= handler;
}

public static IBrush AsFrozen(this IMutableBrush freezable)
public static IBrush AsFrozen(this IBrush freezable)
{
return freezable.ToImmutable();
}
Expand Down Expand Up @@ -90,6 +91,5 @@ public static bool HasModifiers(this KeyEventArgs args, KeyModifiers modifier) =

public static void SetContent(this ToolTip toolTip, Control control, object content) => ToolTip.SetTip(control, content);

public static void SetItems(this ItemsControl itemsControl, System.Collections.IEnumerable enumerable) =>
itemsControl.Items = enumerable;
public static void Open(this FlyoutBase flyout, Control control) => flyout.ShowAt(control);
}
Loading

0 comments on commit bc61575

Please sign in to comment.