Skip to content

Commit

Permalink
Can autoload package, log adding file context.
Browse files Browse the repository at this point in the history
  • Loading branch information
allisterb committed Dec 8, 2023
1 parent 78fde15 commit 0fa8ad1
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 28 deletions.
21 changes: 0 additions & 21 deletions src/Stratis.DevEx.sln
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stratis.DevEx.TestChain", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stratis.VS.StratisEVM", "Stratis.VS.StratisEVM\Stratis.VS.StratisEVM.csproj", "{99ED2062-8DD2-4969-972C-C9DC81EBF869}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSIXProject1", "VSIXProject1\VSIXProject1.csproj", "{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -655,24 +653,6 @@ Global
{99ED2062-8DD2-4969-972C-C9DC81EBF869}.Sources|arm64.Build.0 = Debug|arm64
{99ED2062-8DD2-4969-972C-C9DC81EBF869}.Sources|x86.ActiveCfg = Debug|x86
{99ED2062-8DD2-4969-972C-C9DC81EBF869}.Sources|x86.Build.0 = Debug|x86
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Debug|arm64.ActiveCfg = Debug|arm64
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Debug|arm64.Build.0 = Debug|arm64
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Debug|x86.ActiveCfg = Debug|x86
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Debug|x86.Build.0 = Debug|x86
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Release|Any CPU.Build.0 = Release|Any CPU
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Release|arm64.ActiveCfg = Release|arm64
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Release|arm64.Build.0 = Release|arm64
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Release|x86.ActiveCfg = Release|x86
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Release|x86.Build.0 = Release|x86
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Sources|Any CPU.ActiveCfg = Debug|Any CPU
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Sources|Any CPU.Build.0 = Debug|Any CPU
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Sources|arm64.ActiveCfg = Debug|arm64
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Sources|arm64.Build.0 = Debug|arm64
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Sources|x86.ActiveCfg = Debug|x86
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99}.Sources|x86.Build.0 = Debug|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -711,7 +691,6 @@ Global
{75785EBD-14DC-463A-AD50-ED046F39A5AC} = {A0717F4C-8EED-4659-B72F-50DB73E1F64E}
{F18BA290-AFB9-4EEF-8281-30F3F32A0265} = {8DC77034-0F3C-40E6-A352-B157BCB85462}
{99ED2062-8DD2-4969-972C-C9DC81EBF869} = {3244104A-4F62-488E-8DA9-B1FEB2E367E7}
{FC3D9983-8CCC-4BAA-A834-BF06A7310C99} = {3244104A-4F62-488E-8DA9-B1FEB2E367E7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {602325FF-1BC0-4A57-8252-3F0471EA4151}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

using Microsoft.VisualStudio.Workspace;

using Stratis.DevEx;
namespace Stratis.VS.StratisEVM
{
/// <summary>
Expand Down Expand Up @@ -39,6 +40,7 @@ public async Task<IReadOnlyCollection<FileContext>> GetContextsForFileAsync(stri

if (filePath.EndsWith(".sol"))
{
Runtime.Info("adding file contxt");
fileContexts.Add(new FileContext(
new Guid(ProviderType),
new Guid(StratisEVMPackageIds.SolidityFileContextType),
Expand Down
2 changes: 1 addition & 1 deletion src/Stratis.VS.StratisEVM/SolidityLanguageClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SolidityLanguageClient : Runtime, ILanguageClient, ILanguageClientC
#region Constructors
static SolidityLanguageClient()
{
Initialize("Stratis.VS.Solidity", "LanguageClient");
Initialize("Stratis.VS.StratisEVM", "VS");
}
public SolidityLanguageClient()
{
Expand Down
6 changes: 6 additions & 0 deletions src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@
<Name>Stratis.DevEx.Base</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="StratisEVMPackage.resx">
<MergeWithCTO>true</MergeWithCTO>
<ManifestResourceName>StratisEVMPackage</ManifestResourceName>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
15 changes: 10 additions & 5 deletions src/Stratis.VS.StratisEVM/StratisEVMPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ namespace Stratis.VS.StratisEVM
/// </para>
/// </remarks>
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[InstalledProductRegistration("#110", "#112", "0.1", IconResourceID = 400)]
[Guid(StratisEVMPackage.PackageGuidString)]
//[ProvideAutoLoad("4646B819-1AE0-4E79-97F4-8A8176FDD664", PackageAutoLoadFlags.BackgroundLoad)]
[ProvideAutoLoad(UIContextGuids80.NoSolution, PackageAutoLoadFlags.BackgroundLoad)]
[ProvideAutoLoad("4646B819-1AE0-4E79-97F4-8A8176FDD664", PackageAutoLoadFlags.BackgroundLoad)]
//[ProvideAutoLoad(UIContextGuids80.NoSolution, PackageAutoLoadFlags.BackgroundLoad)]
[ProvideMenuResource("Menus.ctmenu", 1)]
public sealed class StratisEVMPackage : AsyncPackage, IVsSolutionEvents7
{
Expand All @@ -41,7 +41,12 @@ public sealed class StratisEVMPackage : AsyncPackage, IVsSolutionEvents7
/// </summary>
public const string PackageGuidString = "711b90a1-97e6-4b9a-91c4-3d62ccd32d4e";


#region Constructors
static StratisEVMPackage()
{
Runtime.Initialize("Stratis.VS.StratisEVM", "VS");
}
#endregion
#region Methods

#region IVsSolutionEvents7
Expand Down Expand Up @@ -82,7 +87,7 @@ public void OnAfterLoadAllDeferredProjects()
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
await base.InitializeAsync(cancellationToken, progress);
Runtime.Initialize("Stratis.VS.StratisEVM", "VSPackage");
Runtime.Info("StratisEVM package initialized.");
// When initialized asynchronously, the current thread may be a background thread at this point.
// Do any initialization that requires the UI thread after switching to the UI thread.
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
Expand Down
126 changes: 126 additions & 0 deletions src/Stratis.VS.StratisEVM/StratisEVMPackage.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="110" xml:space="preserve">
<value>StratisEVM</value>
</data>
<data name="112" xml:space="preserve">
<value>Stratis smart contracts extension</value>
</data>
</root>
6 changes: 5 additions & 1 deletion src/Stratis.VS.StratisEVM/StratisEVMPackage.vsct
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@
<Button guid="guidStratisEVMPackageCmdSet" id="CmdId1" priority="0x0100" type="Button">
<Parent guid="guidStratisEVMPackageCmdSet" id="MyMenuGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<CommandFlag>DynamicVisibility</CommandFlag>
<CommandFlag>DefaultInvisible</CommandFlag>
<Strings>
<ButtonText>Solidity Command 1</ButtonText>
</Strings>
</Button>

<Button guid="guidStratisEVMPackageCmdSet" id="CmdId2" priority="0x0101" type="Button">
<Parent guid="guidStratisEVMPackageCmdSet" id="MyMenuGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Icon guid="guidImages" id="bmpPic1" />
<CommandFlag>DynamicVisibility</CommandFlag>
<CommandFlag>DefaultInvisible</CommandFlag>
<Strings>
<ButtonText>Solidity Command 2</ButtonText>
</Strings>
Expand Down

0 comments on commit 0fa8ad1

Please sign in to comment.