Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for VS 2019 #60

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion T4Toolbox.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<RootNamespace>$(MSBuildProjectName)</RootNamespace>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<PropertyGroup>
<ProjectGuid>{E0282961-2D83-48CC-B4D4-8257449CF8F7}</ProjectGuid>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<Import Project="..\..\T4Toolbox.Common.props" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<YaccLexTools>..\..\packages\YaccLexTools.0.2.2\tools\</YaccLexTools>
<GplexTool>"$(YaccLexTools)gplex.exe"</GplexTool>
<GppgTool>"$(YaccLexTools)gppg.exe"</GppgTool>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
<PropertyGroup>
<ProjectGuid>{FDE953D3-AD27-4398-8EF4-293C0CEBDC3E}</ProjectGuid>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.CoreUtility" />
<Reference Include="Microsoft.VisualStudio.Editor" />
<Reference Include="Microsoft.VisualStudio.Language" />
<Reference Include="Microsoft.VisualStudio.Language.Intellisense" />
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
<Reference Include="Microsoft.VisualStudio.Shell.15.0" />
Expand Down
20 changes: 8 additions & 12 deletions src/T4Toolbox.VisualStudio.Editor/TemplateQuickInfoSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
namespace T4Toolbox.VisualStudio.Editor
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;

internal sealed class TemplateQuickInfoSource : IQuickInfoSource
internal sealed class TemplateQuickInfoSource : IAsyncQuickInfoSource
{
private readonly TemplateAnalyzer analyzer;

Expand All @@ -20,18 +21,14 @@ public TemplateQuickInfoSource(ITextBuffer buffer)
this.analyzer = TemplateAnalyzer.GetOrCreate(buffer);
}

public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
public Task<QuickInfoItem> GetQuickInfoItemAsync(IAsyncQuickInfoSession session, CancellationToken cancellationToken)
{
QuickInfoItem quickInfoItem = null;
if (session == null)
{
throw new ArgumentNullException("session");
}

if (quickInfoContent == null)
{
throw new ArgumentNullException("quickInfoContent");
}

TemplateAnalysis analysis = this.analyzer.CurrentAnalysis;
SnapshotPoint? triggerPoint = session.GetTriggerPoint(analysis.TextSnapshot);
if (triggerPoint != null && analysis.Template != null)
Expand All @@ -40,13 +37,12 @@ public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> qui
Span applicableTo;
if (analysis.Template.TryGetDescription(triggerPoint.Value.Position, out description, out applicableTo))
{
quickInfoContent.Add(description);
applicableToSpan = analysis.TextSnapshot.CreateTrackingSpan(applicableTo, SpanTrackingMode.EdgeExclusive);
return;
ITrackingSpan applicableToSpan = analysis.TextSnapshot.CreateTrackingSpan(applicableTo, SpanTrackingMode.EdgeExclusive);
quickInfoItem = new QuickInfoItem(applicableToSpan, description);
}
}

applicableToSpan = null;
return Task.FromResult(quickInfoItem);
}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace T4Toolbox.VisualStudio.Editor
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;

[Export(typeof(IQuickInfoSourceProvider)), ContentType(TemplateContentType.Name)]
[Export(typeof(IAsyncQuickInfoSourceProvider)), ContentType(TemplateContentType.Name)]
[Name("Template Quick Info Source"), Order(Before = "Default Quick Info Presenter")]
internal sealed class TemplateQuickInfoSourceProvider : IQuickInfoSourceProvider
internal sealed class TemplateQuickInfoSourceProvider : IAsyncQuickInfoSourceProvider
{
private readonly ITemplateEditorOptions options;

Expand All @@ -27,16 +27,16 @@ public TemplateQuickInfoSourceProvider(ITemplateEditorOptions options)
this.options = options;
}

public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer buffer)
public IAsyncQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
{
if (buffer == null)
if (textBuffer == null)
{
throw new ArgumentNullException(nameof(buffer));
throw new ArgumentNullException(nameof(textBuffer));
}

if (this.options.QuickInfoTooltipsEnabled)
{
return buffer.Properties.GetOrCreateSingletonProperty(() => new TemplateQuickInfoSource(buffer));
return textBuffer.Properties.GetOrCreateSingletonProperty(() => new TemplateQuickInfoSource(textBuffer));
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<CopyVsixManifestToOutput>false</CopyVsixManifestToOutput>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
Expand Down Expand Up @@ -58,4 +60,4 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
</Project>
2 changes: 1 addition & 1 deletion src/T4Toolbox.VisualStudio/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/T4Toolbox.VisualStudio/T4Toolbox.VisualStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<CreateVsixContainer>false</CreateVsixContainer>
<DeployExtension>false</DeployExtension>
<UseCodebase>true</UseCodebase>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
Expand Down
2 changes: 2 additions & 0 deletions src/T4Toolbox.vsix/T4Toolbox.vsix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<DeployExtension Condition=" '$(BuildingInsideVisualStudio)' != 'true' ">false</DeployExtension>
<!-- Disable FxCop - no assembly -->
<RunCodeAnalysis>false</RunCodeAnalysis>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
Expand Down
56 changes: 28 additions & 28 deletions src/T4Toolbox.vsix/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="T4Toolbox.15" Version="|%CurrentProject%;GetPackageVersion|" Language="en-US" Publisher="Oleg Sych" />
<DisplayName>T4 Toolbox for Visual Studio 2017</DisplayName>
<Description>Extends Text Templates with syntax colorization, error reporting, outlining, QuickInfo tooltips, statement completion, generation of multiple output files with source control integration, support for template parameters in Solution Explorer properties and more.</Description>
<MoreInfo>https://github.com/olegsych/T4Toolbox</MoreInfo>
<License>License.txt</License>
<GettingStartedGuide>http://olegsych.github.io/T4Toolbox/getting-started.html</GettingStartedGuide>
<ReleaseNotes>https://github.com/olegsych/T4Toolbox/releases</ReleaseNotes>
</Metadata>
<Installation InstalledByMsi="false">
<InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Community" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.6,)" />
<Dependency Id="Microsoft.VisualStudio.MPF.15.0" DisplayName="Visual Studio MPF 15.0" d:Source="Installed" Version="[15.0,16.0)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="T4Toolbox.VisualStudio" Path="|T4Toolbox.VisualStudio;PkgdefProjectOutputGroup|" />
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="DarkTheme.pkgdef" />
<Asset Type="Microsoft.VisualStudio.ItemTemplate" d:Source="Project" d:ProjectName="%CurrentProject%.ItemTemplates" d:TargetPath="|T4Toolbox.VisualStudio.ItemTemplates;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" />
<Asset Type="Microsoft.T4.Include" Path="Include" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="T4Toolbox.VisualStudio" Path="|T4Toolbox.VisualStudio|" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="T4Toolbox.VisualStudio.Editor" Path="|T4Toolbox.VisualStudio.Editor|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.TextTemplating" Version="[15.0, 16.0)" DisplayName="Text Template Transformation" />
<Prerequisite Id="Microsoft.VisualStudio.Component.Roslyn.LanguageServices" Version="[15.0,16.0)" DisplayName="C# and Visual Basic" />
</Prerequisites>
<Metadata>
<Identity Id="T4Toolbox.16" Version="|%CurrentProject%;GetPackageVersion|" Language="en-US" Publisher="Oleg Sych" />
<DisplayName>T4 Toolbox for Visual Studio 2019</DisplayName>
<Description xml:space="preserve">Extends Text Templates with syntax colorization, error reporting, outlining, QuickInfo tooltips, statement completion, generation of multiple output files with source control integration, support for template parameters in Solution Explorer properties and more.</Description>
<MoreInfo>https://github.com/olegsych/T4Toolbox</MoreInfo>
<License>License.txt</License>
<GettingStartedGuide>http://olegsych.github.io/T4Toolbox/getting-started.html</GettingStartedGuide>
<ReleaseNotes>https://github.com/olegsych/T4Toolbox/releases</ReleaseNotes>
</Metadata>
<Installation InstalledByMsi="false">
<InstallationTarget Version="[16.0,17.0)" Id="Microsoft.VisualStudio.Community" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.7.2,)" />
<Dependency d:Source="Installed" Version="[16.0,17.0)" Id="Microsoft.VisualStudio.MPF.16.0" DisplayName="Visual Studio MPF 16.0" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="T4Toolbox.VisualStudio" Path="|T4Toolbox.VisualStudio;PkgdefProjectOutputGroup|" />
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="DarkTheme.pkgdef" />
<Asset Type="Microsoft.VisualStudio.ItemTemplate" d:Source="Project" d:ProjectName="%CurrentProject%.ItemTemplates" d:TargetPath="|T4Toolbox.VisualStudio.ItemTemplates;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" />
<Asset Type="Microsoft.T4.Include" Path="Include" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="T4Toolbox.VisualStudio" Path="|T4Toolbox.VisualStudio|" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="T4Toolbox.VisualStudio.Editor" Path="|T4Toolbox.VisualStudio.Editor|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.TextTemplating" Version="[16.0,17.0)" DisplayName="Text Template Transformation" />
<Prerequisite Id="Microsoft.VisualStudio.Component.Roslyn.LanguageServices" Version="[16.0,17.0)" DisplayName="C# and Visual Basic" />
</Prerequisites>
</PackageManifest>
2 changes: 2 additions & 0 deletions src/T4Toolbox/T4Toolbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<PropertyGroup>
<ProjectGuid>{682E771A-76F7-4972-BBDC-1250B67F399B}</ProjectGuid>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<Import Project="..\..\T4Toolbox.Common.props" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
Expand Down
72 changes: 18 additions & 54 deletions test/T4Toolbox.VisualStudio.Editor.Tests/FakeQuickInfoSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,109 +5,73 @@
namespace T4Toolbox.VisualStudio.Editor
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;

internal class FakeQuickInfoSession : IQuickInfoSession
internal class FakeQuickInfoSession : IAsyncQuickInfoSession
{
public SnapshotPoint? SnapshotTriggerPoint { get; set; }

#region IQuickInfoSession
#region IAsyncQuickInfoSession

ITrackingSpan IQuickInfoSession.ApplicableToSpan
public ITrackingSpan ApplicableToSpan
{
get { throw new NotImplementedException(); }
}

event EventHandler IQuickInfoSession.ApplicableToSpanChanged
{
add { throw new NotImplementedException(); }
remove { throw new NotImplementedException(); }
}

BulkObservableCollection<object> IQuickInfoSession.QuickInfoContent
public IEnumerable<object> Content
{
get { throw new NotImplementedException(); }
}

bool IQuickInfoSession.TrackMouse
public bool HasInteractiveContent
{
get { throw new NotImplementedException(); }
}

void IIntellisenseSession.Collapse()
public QuickInfoSessionOptions Options
{
throw new NotImplementedException();
}

void IIntellisenseSession.Dismiss()
{
throw new NotImplementedException();
}

event EventHandler IIntellisenseSession.Dismissed
{
add { throw new NotImplementedException(); }
remove { throw new NotImplementedException(); }
}

SnapshotPoint? IIntellisenseSession.GetTriggerPoint(ITextSnapshot textSnapshot)
{
return this.SnapshotTriggerPoint;
}

ITrackingPoint IIntellisenseSession.GetTriggerPoint(ITextBuffer textBuffer)
{
throw new NotImplementedException();
get { throw new NotImplementedException(); }
}

bool IIntellisenseSession.IsDismissed
public QuickInfoSessionState State
{
get { throw new NotImplementedException(); }
}

bool IIntellisenseSession.Match()
public ITextView TextView
{
throw new NotImplementedException();
get { throw new NotImplementedException(); }
}

IIntellisensePresenter IIntellisenseSession.Presenter
public PropertyCollection Properties
{
get { throw new NotImplementedException(); }
}

event EventHandler IIntellisenseSession.PresenterChanged
public event EventHandler<QuickInfoSessionStateChangedEventArgs> StateChanged
{
add { throw new NotImplementedException(); }
remove { throw new NotImplementedException(); }
}

void IIntellisenseSession.Recalculate()
public Task DismissAsync()
{
throw new NotImplementedException();
}

event EventHandler IIntellisenseSession.Recalculated
{
add { throw new NotImplementedException(); }
remove { throw new NotImplementedException(); }
}

void IIntellisenseSession.Start()
public ITrackingPoint GetTriggerPoint(ITextBuffer textBuffer)
{
throw new NotImplementedException();
}

ITextView IIntellisenseSession.TextView
public SnapshotPoint? GetTriggerPoint(ITextSnapshot snapshot)
{
get { throw new NotImplementedException(); }
}

PropertyCollection IPropertyOwner.Properties
{
get { throw new NotImplementedException(); }
return this.SnapshotTriggerPoint;
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.CoreUtility" />
<Reference Include="Microsoft.VisualStudio.Editor" />
<Reference Include="Microsoft.VisualStudio.Language" />
<Reference Include="Microsoft.VisualStudio.Language.Intellisense" />
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
<!-- Explicitly specify version of Microsoft.VisualStudio.Shell.Immutable.10.0 because Version=15.0.0.0 doesn't define SVsServiceProvider -->
Expand Down
Loading