Skip to content

Commit

Permalink
Fix For Generators used on Generic class (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman authored Nov 7, 2024
1 parent 5b65578 commit 954ab78
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
20 changes: 20 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute/TestViewModel2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using ReactiveUI;
using ReactiveUI.SourceGenerators;

namespace SGReactiveUI.SourceGenerators.Test;

/// <summary>
/// TestViewModel2.
/// </summary>
/// <typeparam name="T">the type.</typeparam>
/// <seealso cref="ReactiveUI.ReactiveObject" />
public partial class TestViewModel2<T> : ReactiveObject
{
[Reactive]
private bool _IsTrue;
}
22 changes: 22 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute/TestViewWpf2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Windows;
using ReactiveUI.SourceGenerators;

namespace SGReactiveUI.SourceGenerators.Test;

/// <summary>
/// TestViewWpf2.
/// </summary>
/// <seealso cref="System.Windows.Window" />
[IViewFor("TestViewModel2<int>")]
public partial class TestViewWpf2 : Window
{
/// <summary>
/// Initializes a new instance of the <see cref="TestViewWpf2"/> class.
/// </summary>
public TestViewWpf2() => ViewModel = new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// See the LICENSE file in the project root for full license information.

using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
Expand Down
7 changes: 2 additions & 5 deletions src/ReactiveUI.SourceGenerators/Core/Models/TargetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.CodeAnalysis;
using ReactiveUI.SourceGenerators.Extensions;
using ReactiveUI.SourceGenerators.Helpers;
Expand All @@ -22,8 +19,8 @@ internal sealed partial record TargetInfo(
{
public static TargetInfo From(INamedTypeSymbol namedTypeSymbol)
{
var targetHintName = namedTypeSymbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);
var targetName = namedTypeSymbol.Name;
var targetHintName = namedTypeSymbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat).Replace("<", "_").Replace(">", "_");
var targetName = namedTypeSymbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);
var targetNamespace = namedTypeSymbol.ContainingNamespace.ToDisplayString(SymbolHelpers.DefaultDisplay);
var targetNameWithNamespace = namedTypeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
var targetAccessibility = namedTypeSymbol.GetAccessibilityString();
Expand Down

0 comments on commit 954ab78

Please sign in to comment.