From 5da3d92e209e0d35aca61aa3ab7912a36a8f0527 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Thu, 6 Jul 2023 12:52:50 +0200 Subject: [PATCH 1/2] Restore PR #321 This reverts commit 53004a1b1f6bfec061f73b06892701360718257f. --- AvaloniaVS.Shared/AvaloniaPackage.cs | 11 +++++++++++ .../IntelliSense/XamlTextViewCreationListener.cs | 3 +++ AvaloniaVS.Shared/Services/EditorFactory.cs | 1 + 3 files changed, 15 insertions(+) diff --git a/AvaloniaVS.Shared/AvaloniaPackage.cs b/AvaloniaVS.Shared/AvaloniaPackage.cs index e7aacd27..c1f4cf30 100644 --- a/AvaloniaVS.Shared/AvaloniaPackage.cs +++ b/AvaloniaVS.Shared/AvaloniaPackage.cs @@ -52,7 +52,18 @@ namespace AvaloniaVS DesignerLogicalViewEditor = typeof(EditorFactory), DebuggingLogicalViewEditor = typeof(EditorFactory), TextLogicalViewEditor = typeof(EditorFactory))] + [ProvideXmlEditorChooserDesignerView(Constants.PackageName, + Constants.axaml, + LogicalViewID.Designer, + 10000, + Namespace = "https://github.com/avaloniaui", + MatchExtensionAndNamespace = true, + CodeLogicalViewEditor = typeof(EditorFactory), + DesignerLogicalViewEditor = typeof(EditorFactory), + DebuggingLogicalViewEditor = typeof(EditorFactory), + TextLogicalViewEditor = typeof(EditorFactory))] [ProvideOptionPage(typeof(OptionsDialogPage), Constants.PackageName, "General", 113, 0, supportsAutomation: true)] + [ProvideBindingPath] internal sealed class AvaloniaPackage : AsyncPackage { public static SolutionService SolutionService { get; private set; } diff --git a/AvaloniaVS.Shared/IntelliSense/XamlTextViewCreationListener.cs b/AvaloniaVS.Shared/IntelliSense/XamlTextViewCreationListener.cs index 3eb538f6..7c88e2d7 100644 --- a/AvaloniaVS.Shared/IntelliSense/XamlTextViewCreationListener.cs +++ b/AvaloniaVS.Shared/IntelliSense/XamlTextViewCreationListener.cs @@ -15,8 +15,11 @@ namespace AvaloniaVS.IntelliSense /// [Name("Avalonia XAML manupulator")] [ContentType("xml")] + [ContentType("axaml")] + [ContentType("xaml")] [Export(typeof(IWpfTextViewCreationListener))] [TextViewRole(PredefinedTextViewRoles.Editable)] + [TextViewRole(PredefinedTextViewRoles.PrimaryDocument)] internal sealed class XamlTextViewCreationListener : IWpfTextViewCreationListener { private readonly IServiceProvider _serviceProvider; diff --git a/AvaloniaVS.Shared/Services/EditorFactory.cs b/AvaloniaVS.Shared/Services/EditorFactory.cs index 44788d8f..50eb0ac8 100644 --- a/AvaloniaVS.Shared/Services/EditorFactory.cs +++ b/AvaloniaVS.Shared/Services/EditorFactory.cs @@ -18,6 +18,7 @@ namespace AvaloniaVS.Services /// Implements to create s containing /// an Avalonia XAML designer. /// + [Guid(AvaloniaVS.Constants.AvaloviaFactoryEditorGuidString)] internal sealed class EditorFactory : IVsEditorFactory, IDisposable { private readonly AvaloniaPackage _package; From a234c177a0e8a338995abfc98e29fbf438933cea Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Thu, 6 Jul 2023 14:49:38 +0200 Subject: [PATCH 2/2] fix: Can not open xaml file in Avalonia Designer --- AvaloniaVS.Shared/AvaloniaPackage.cs | 6 +++--- .../IntelliSense/XamlTextViewCreationListener.cs | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/AvaloniaVS.Shared/AvaloniaPackage.cs b/AvaloniaVS.Shared/AvaloniaPackage.cs index c1f4cf30..f09160f2 100644 --- a/AvaloniaVS.Shared/AvaloniaPackage.cs +++ b/AvaloniaVS.Shared/AvaloniaPackage.cs @@ -45,9 +45,9 @@ namespace AvaloniaVS [ProvideXmlEditorChooserDesignerView(Constants.PackageName, Constants.xaml, LogicalViewID.Designer, - 10000, + 10001, Namespace = "https://github.com/avaloniaui", - MatchExtensionAndNamespace = true, + MatchExtensionAndNamespace = false, CodeLogicalViewEditor = typeof(EditorFactory), DesignerLogicalViewEditor = typeof(EditorFactory), DebuggingLogicalViewEditor = typeof(EditorFactory), @@ -57,7 +57,7 @@ namespace AvaloniaVS LogicalViewID.Designer, 10000, Namespace = "https://github.com/avaloniaui", - MatchExtensionAndNamespace = true, + MatchExtensionAndNamespace = false, CodeLogicalViewEditor = typeof(EditorFactory), DesignerLogicalViewEditor = typeof(EditorFactory), DebuggingLogicalViewEditor = typeof(EditorFactory), diff --git a/AvaloniaVS.Shared/IntelliSense/XamlTextViewCreationListener.cs b/AvaloniaVS.Shared/IntelliSense/XamlTextViewCreationListener.cs index 7c88e2d7..1c033f38 100644 --- a/AvaloniaVS.Shared/IntelliSense/XamlTextViewCreationListener.cs +++ b/AvaloniaVS.Shared/IntelliSense/XamlTextViewCreationListener.cs @@ -1,11 +1,8 @@ using System; using System.ComponentModel.Composition; using AvaloniaVS.Models; -using Microsoft.VisualStudio.Editor; -using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Text.Editor; -using Microsoft.VisualStudio.TextManager.Interop; using Microsoft.VisualStudio.Utilities; namespace AvaloniaVS.IntelliSense @@ -15,8 +12,6 @@ namespace AvaloniaVS.IntelliSense /// [Name("Avalonia XAML manupulator")] [ContentType("xml")] - [ContentType("axaml")] - [ContentType("xaml")] [Export(typeof(IWpfTextViewCreationListener))] [TextViewRole(PredefinedTextViewRoles.Editable)] [TextViewRole(PredefinedTextViewRoles.PrimaryDocument)]