Skip to content

Commit

Permalink
Merge pull request #1915 from cwensley/curtis/vs-more-updates
Browse files Browse the repository at this point in the history
More VS extension tweaks
  • Loading branch information
cwensley authored Apr 5, 2021
2 parents 332ad15 + f8b1638 commit ac46107
Show file tree
Hide file tree
Showing 101 changed files with 327 additions and 177 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: addins
path: artifacts/addin/${{ env.BuildConfiguration }}/Eto.Addin.VisualStudio.Win*.vsix
path: artifacts/addin/${{ env.BuildConfiguration }}/Eto.Addin.VisualStudio.Windows*.vsix

- name: Upload test artifacts
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -178,8 +178,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: Eto.Addin.VisualStudio.Win-${{ steps.get_version.outputs.VERSION }}.vsix
asset_name: Eto.Addin.VisualStudio.Win-${{ steps.get_version.outputs.VERSION }}.vsix
asset_path: Eto.Addin.VisualStudio.Windows-${{ steps.get_version.outputs.VERSION }}.vsix
asset_name: Eto.Addin.VisualStudio.Windows-${{ steps.get_version.outputs.VERSION }}.vsix
asset_content_type: application/octet-stream

- name: Upload VS/Mac addin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
tag_name: ${{ github.event.milestone.title }}
release_name: ${{ github.event.milestone.title }}
body_path: release_file_combined.md
draft: false
draft: true
prerelease: false
11 changes: 10 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,17 @@
"args": [ "--no-redirect" ],
"env": {
"MONODEVELOP_CONSOLE_LOG_LEVEL": "All",
"MONODEVELOP_DEV_ADDINS": "${workspaceFolder}/artifacts/addin/${config:var.configuration}/net472/"
"MONODEVELOP_DEV_ADDINS": "${workspaceFolder}/artifacts/addin/${config:var.configuration}/VisualStudio.Mac/"
}
},
{
// note you cannot actually debug as omnisharp only supports x64, this is used so we can just run without debugging more easily
"name": "Eto.Addin.VisualStudio.Windows",
"type": "clr",
"request": "launch",
"preLaunchTask": "build-addins",
"program": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/devenv.exe",
"args": [ "/RootSuffix", "Exp" ],
}
]
}
10 changes: 5 additions & 5 deletions build/Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
Pattern='(?<=^\s*Version\s*=\s*["])(.+?)(?=["]\s*$)'
Replacement='$(AssemblyVersionBeforeRelease)' />

<FileUpdate Files="$(AddinDir)Eto.Addin.VisualStudio.Win\source.extension.vsixmanifest"
<FileUpdate Files="$(AddinDir)Eto.Addin.VisualStudio.Windows\source.extension.vsixmanifest"
WarnOnNoUpdate="true"
Pattern='(?&lt;=^\s*&lt;Identity\s+Id=&quot;Eto.Addin.VisualStudio.Win&quot;.+?Version=&quot;)(.+?)(?=&quot;\s+)'
Pattern='(?&lt;=^\s*&lt;Identity\s+Id=&quot;Eto.Addin.VisualStudio.Windows&quot;.+?Version=&quot;)(.+?)(?=&quot;\s+)'
Replacement='$(AssemblyVersionBeforeRelease)' />

<PropertyGroup>
Expand Down Expand Up @@ -80,7 +80,7 @@

<ItemGroup>
<TemplateFiles Include="$(TemplateFiles)" Condition="$(TemplateFiles) != ''" />
<TemplateFiles Include="$(SourceDir)Addins\Eto.Addin.VisualStudio.Win\**\*.vstemplate" />
<TemplateFiles Include="$(SourceDir)Addins\Eto.Addin.VisualStudio.Windows\**\*.vstemplate" />
<TemplateFiles Include="$(SourceDir)Addins\Eto.Addin.VisualStudio.Mac\**\*.xpt.xml" />
<TemplateFiles Include="$(SourceDir)Addins\Eto.Addin.VisualStudio.Mac\Properties\Manifest.addin.xml" />

Expand Down Expand Up @@ -227,8 +227,8 @@
<MSBuild Projects="$(AddinDir)Eto.Addin.VisualStudio.Mac\Eto.Addin.VisualStudio.Mac.csproj" Targets="PackageAddin" Properties="Configuration=$(Configuration)" Condition="$(HasVSMac) == 'True'" />

<!-- Visual Studio Addin -->
<MSBuild Projects="$(AddinDir)Eto.Addin.VisualStudio.Win.sln" Targets="Restore" Properties="Configuration=$(Configuration);_RestoreEnforceEvaluate=True" Condition="$(HasVSWin) == 'True'" />
<MSBuild Projects="$(AddinDir)Eto.Addin.VisualStudio.Win.sln" Targets="Build" Properties="Configuration=$(Configuration);DeployExtension=false" Condition="$(HasVSWin) == 'True'" />
<MSBuild Projects="$(AddinDir)Eto.Addin.VisualStudio.Windows.sln" Targets="Restore" Properties="Configuration=$(Configuration);_RestoreEnforceEvaluate=True" Condition="$(HasVSWin) == 'True'" />
<MSBuild Projects="$(AddinDir)Eto.Addin.VisualStudio.Windows.sln" Targets="Build" Properties="Configuration=$(Configuration);DeployExtension=false" Condition="$(HasVSWin) == 'True'" />
</Target>

<Target Name="Clean">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="Editor\XetoTextEditorExtension.cs" />
<Compile Include="..\Eto.Addin.VisualStudio.Win\Intellisense\*.cs" Link="Intellisense\%(Filename)%(Extension)" />
<Compile Include="..\Eto.Addin.VisualStudio.Win\Components.cs" />
<Compile Include="..\Eto.Addin.VisualStudio.Windows\Intellisense\*.cs" Link="Intellisense\%(Filename)%(Extension)" />
<Compile Include="..\Eto.Addin.VisualStudio.Windows\Components.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
42 changes: 19 additions & 23 deletions src/Addins/Eto.Addin.VisualStudio.Mac/EtoInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,32 @@ namespace Eto.Addin.VisualStudio.Mac
{
public static class EtoInitializer
{
static bool initialized;
public static void Initialize()
{
if (Platform.Instance == null)
if (initialized)
return;

initialized = true;

try
{
try
var platform = Platform.Instance;
if (platform == null)
{
var platform = new Eto.Mac.Platform();
platform = new Eto.Mac.Platform();
Platform.Initialize(platform);
}

platform.LoadAssembly(typeof(EtoInitializer).Assembly);
platform.LoadAssembly(typeof(EtoInitializer).Assembly);

new Eto.Forms.Application(platform).Attach();
if (Application.Instance == null)
new Eto.Forms.Application().Attach();

var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(r => r.GetName().Name.StartsWith("Xamarin")).ToArray();

}
catch (Exception ex)
{
Console.WriteLine($"{ex}");
}
#if Mac
if (EtoEnvironment.Platform.IsMac)
{
var plat = Platform.Instance;
if (!plat.IsMac)
{
// use some Mac handlers even when using Gtk platform as base
plat.Add<Cursor.IHandler>(() => new Eto.Mac.Forms.CursorHandler());
}
}
#endif
}
catch (Exception ex)
{
Console.WriteLine($"{ex}");
}
}
}
Expand Down
36 changes: 0 additions & 36 deletions src/Addins/Eto.Addin.VisualStudio.Win/Wizards/EtoInitializer.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eto.Addin.VisualStudio.Win", "Eto.Addin.VisualStudio.Win\Eto.Addin.VisualStudio.Win.csproj", "{4A50E311-097A-403F-BEE5-8A4EC3A8230B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eto.Addin.VisualStudio.Windows", "Eto.Addin.VisualStudio.Windows\Eto.Addin.VisualStudio.Windows.csproj", "{4A50E311-097A-403F-BEE5-8A4EC3A8230B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eto.Designer", "Eto.Designer\Eto.Designer.csproj", "{7FAA1841-0869-474C-9D89-87E1B4BAB190}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
using Eto.Addin.VisualStudio.Win.Util;
using Eto.Addin.VisualStudio.Windows.Util;
using System.Linq;

namespace Eto.Addin.VisualStudio.Win.Adornments
namespace Eto.Addin.VisualStudio.Windows.Adornments
{
/// <summary>
/// Establishes an <see cref="IAdornmentLayer"/> to place the adornment on and exports the <see cref="IWpfTextViewCreationListener"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using Microsoft.VisualStudio.Text.Tagging;
using System.Linq;

namespace Eto.Addin.VisualStudio.Win.Adornments
namespace Eto.Addin.VisualStudio.Windows.Adornments
{
public class ColorAdornment
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MUST match guids.h
using System;

namespace Eto.Addin.VisualStudio.Win
namespace Eto.Addin.VisualStudio.Windows
{
static class Constants
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.VisualStudio.Editor;
using System.Windows.Media;

namespace Eto.Addin.VisualStudio.Win.Editor
namespace Eto.Addin.VisualStudio.Windows.Editor
{
public class CodeEditorHost
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
using Eto.Designer;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
using Eto.Addin.VisualStudio.Win.Wizards;
using Eto.Addin.VisualStudio.Windows.Wizards;
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
using System.IO;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.Xml;
using Eto.Forms;

namespace Eto.Addin.VisualStudio.Win.Editor
namespace Eto.Addin.VisualStudio.Windows.Editor
{
[Guid(Constants.EtoPreviewEditorFactory_string)]
public sealed class EditorFactory : IVsEditorFactory, IDisposable
public sealed class EditorFactory : IVsEditorFactory, IDisposable, IVsEditorFactoryChooser
{
EtoAddinPackage editorPackage;
ServiceProvider vsServiceProvider;
Expand Down Expand Up @@ -174,7 +175,9 @@ public int CreateEditorInstance(


if (!BuilderInfo.Supports(pszMkDocument))
{
return VSConstants.VS_E_UNSUPPORTEDFORMAT;
}

// Validate inputs
if ((grfCreateDoc & (VSConstants.CEF_OPENFILE | VSConstants.CEF_SILENT)) == 0)
Expand Down Expand Up @@ -204,14 +207,24 @@ public int CreateEditorInstance(
}


var outputFile = GetAssemblyPath(proj);
var references = GetReferences(proj).ToList();
//var outputDir = Path.GetDirectoryName(outputFile);

var codeEditor = new CodeEditorHost(textBuffer);
// Create the Document (editor)
var editor = new EtoPreviewPane(editorPackage, pszMkDocument, textBuffer, outputFile, references, codeEditor);
ppunkDocView = Marshal.GetIUnknownForObject(editor);

try
{
var outputFile = GetAssemblyPath(proj);
var references = GetReferences(proj).ToList();
//var outputDir = Path.GetDirectoryName(outputFile);

// Create the Document (editor)
var editor = new EtoPreviewPane(editorPackage, pszMkDocument, textBuffer, outputFile, references, codeEditor);
ppunkDocView = Marshal.GetIUnknownForObject(editor);
}
catch (Exception ex)
{
MessageBox.Show($"Error creating preview pane: {ex.Message}");
Debug.WriteLine($"Error creating preview pane: {ex}");
throw;
}
//pbstrEditorCaption = " [Preview]";
return VSConstants.S_OK;
}
Expand Down Expand Up @@ -352,6 +365,32 @@ private static void MapLanguage(IVsTextLines textBuffer, string languageSid)
textBuffer.SetLanguageServiceID(ref langId);
}

public int ChooseEditorFactory(string pszMkDocument, IVsHierarchy pHier, uint itemid, IntPtr punkDocDataExisting, ref Guid rguidLogicalView, out Guid pguidEditorTypeActual, out Guid pguidLogicalViewActual)
{
ThreadHelper.ThrowIfNotOnUIThread();
pguidEditorTypeActual = Constants.EtoPreviewEditorFactory_guid;
pguidLogicalViewActual = VSConstants.LOGVIEWID.Designer_guid;
if (!BuilderInfo.Supports(pszMkDocument))
{
return VSConstants.VS_E_UNSUPPORTEDFORMAT;
}

rguidLogicalView = VSConstants.LOGVIEWID.Designer_guid;
object prjItemObject;
var projectItemId = VSConstants.VSITEMID_ROOT;
pHier.GetProperty(projectItemId, (int)__VSHPROPID.VSHPROPID_ExtObject, out prjItemObject);
var proj = prjItemObject as EnvDTE.Project;

// Get or open text buffer
var textBuffer = GetTextBuffer(punkDocDataExisting, pszMkDocument, ToVsProject(proj));

if (textBuffer == null)
return VSConstants.VS_E_INCOMPATIBLEDOCDATA;



return VSConstants.S_OK;
}

#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
using swc = System.Windows.Controls;
using System.Windows.Threading;
using Eto;
using Eto.Addin.VisualStudio.Win.Editor;
using Eto.Addin.VisualStudio.Windows.Editor;

[assembly: ExportHandler(typeof(IEtoAdapterHandler), typeof(EtoAdapterHandler))]

namespace Eto.Addin.VisualStudio.Win.Editor
namespace Eto.Addin.VisualStudio.Windows.Editor
{
class ControlContract : MarshalByRefObject
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
using System.Collections.Generic;

namespace Eto.Addin.VisualStudio.Win.Editor
namespace Eto.Addin.VisualStudio.Windows.Editor
{
[ComVisible(true)]
public sealed class EtoPreviewPane : Microsoft.VisualStudio.Shell.WindowPane,
Expand Down Expand Up @@ -262,8 +262,8 @@ protected override void Dispose(bool disposing)
editorControl?.Dispose();
editorControl = null;

preview?.Dispose();
preview = null;
previewSplitter?.Dispose();
previewSplitter = null;

GC.SuppressFinalize(this);
}
Expand Down
Loading

0 comments on commit ac46107

Please sign in to comment.