Skip to content

Commit

Permalink
First release based on the full Roslyn API
Browse files Browse the repository at this point in the history
  • Loading branch information
balazssimon committed Jul 13, 2019
1 parent 8ddf386 commit 7269c29
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2874,14 +2874,15 @@ public sealed class [rule.RedName()] : [Properties.LanguageName]SyntaxNode[GetCo
end template

template GenerateTokenSyntaxFacts()
using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.CodeAnalysis;
using MetaDslx.CodeAnalysis.Syntax;
using Roslyn.Utilities;
^
[string className = Properties.LanguageName+"SyntaxFacts"]
[string syntaxKind = Properties.LanguageName+"SyntaxKind"]
[string className = Properties.LanguageName+"TokensSyntaxFacts"]
[string syntaxKind = Properties.LanguageName+"TokensSyntaxKind"]
[var lang = Properties.LanguageName]
namespace [Properties.DefaultNamespace].Syntax
{
Expand All @@ -2901,17 +2902,22 @@ namespace [Properties.DefaultNamespace].Syntax
[end loop]
}
^
public partial class [className] : SyntaxFacts
public class [className] : SyntaxFacts
{
public [className]()
: base(typeof([lang]SyntaxKind))
: base(typeof([syntaxKind]))
{
}
^
protected [className](Type syntaxKindType)
: base(syntaxKindType)
{
}
^
public override SyntaxKind DefaultWhitespaceKind => ([lang]SyntaxKind)[lang]SyntaxKind.[Instances.DefaultWhitespaceKind.PlainName()];
public override SyntaxKind DefaultEndOfLineKind => ([lang]SyntaxKind)[lang]SyntaxKind.[Instances.DefaultEndOfLineKind.PlainName()];
public override SyntaxKind DefaultSeparatorKind => ([lang]SyntaxKind)[lang]SyntaxKind.[Instances.DefaultSeparatorKind.PlainName()];
public override SyntaxKind DefaultIdentifierKind => ([lang]SyntaxKind)[lang]SyntaxKind.[Instances.DefaultIdentifierKind.PlainName()];
public override SyntaxKind DefaultWhitespaceKind => ([syntaxKind])[syntaxKind].[Instances.DefaultWhitespaceKind.PlainName()];
public override SyntaxKind DefaultEndOfLineKind => ([syntaxKind])[syntaxKind].[Instances.DefaultEndOfLineKind.PlainName()];
public override SyntaxKind DefaultSeparatorKind => ([syntaxKind])[syntaxKind].[Instances.DefaultSeparatorKind.PlainName()];
public override SyntaxKind DefaultIdentifierKind => ([syntaxKind])[syntaxKind].[Instances.DefaultIdentifierKind.PlainName()];
^
public override bool IsToken(SyntaxKind kind)
{
Expand Down Expand Up @@ -2946,10 +2952,10 @@ namespace [Properties.DefaultNamespace].Syntax
{
[loop(literal:Instances.FixedTokens where literal.Kind > 0)]
case [literal.FixedToken.FixedTokenToCSharpString()]:
return [lang]SyntaxKind.[literal.PlainName()];
return [syntaxKind].[literal.PlainName()];
[end loop]
default:
return [lang]SyntaxKind.None;
return [syntaxKind].None;
}
}
^
Expand Down Expand Up @@ -3104,6 +3110,7 @@ namespace [Properties.DefaultNamespace].Syntax
end template

template GenerateNodeSyntaxFacts()
using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.CodeAnalysis;
Expand All @@ -3115,10 +3122,15 @@ using Roslyn.Utilities;
[var lang = Properties.LanguageName]
namespace [Properties.DefaultNamespace].Syntax
{
public partial class [className]
public class [className] : [lang]TokensSyntaxFacts
{
public [className]()
: base(typeof([syntaxKind]))
{
}
^
[if (Instances.MainRule() != null)]
public override SyntaxKind CompilationUnitKind => ([lang]SyntaxKind)[lang]SyntaxKind.[Instances.MainRule().PlainName()];
public override SyntaxKind CompilationUnitKind => ([syntaxKind])[syntaxKind].[Instances.MainRule().PlainName()];
[end if]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

[assembly: System.Reflection.AssemblyCompanyAttribute("MetaDslx.Languages.Meta")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.9.2.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.9.2-alpha1")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.9.5.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.9.5-alpha1")]
[assembly: System.Reflection.AssemblyProductAttribute("MetaDslx.Languages.Meta")]
[assembly: System.Reflection.AssemblyTitleAttribute("MetaDslx.Languages.Meta")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.9.2.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.9.5.0")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

[assembly: System.Reflection.AssemblyCompanyAttribute("MetaDslx.Languages.Meta")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.9.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.9.0-alpha1")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.10.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.10.0-alpha1")]
[assembly: System.Reflection.AssemblyProductAttribute("MetaDslx.Languages.Meta")]
[assembly: System.Reflection.AssemblyTitleAttribute("MetaDslx.Languages.Meta")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.9.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.10.0.0")]

// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ namespace MetaDslx.VisualStudio.Languages.Antlr4Roslyn.Classification
{
internal class Antlr4RoslynClassifier : Antlr4LexerClassifier
{
private Antlr4RoslynSyntaxFacts _syntaxFacts;
private Antlr4RoslynTokensSyntaxFacts _syntaxFacts;

internal Antlr4RoslynClassifier(ITextBuffer textBuffer, IClassificationTypeRegistryService classificationRegistryService)
: base(textBuffer, classificationRegistryService, new MetaDslx.Languages.Antlr4Roslyn.Syntax.InternalSyntax.Antlr4RoslynLexer(Antlr4LexerClassifier.EmptyCharStream))
{
_syntaxFacts = new Antlr4RoslynSyntaxFacts();
_syntaxFacts = new Antlr4RoslynTokensSyntaxFacts();
}

protected override IClassificationType GetClassificationType(int tokenType, int mode)
{
var syntaxKind = (Antlr4RoslynSyntaxKind)tokenType.FromAntlr4(_syntaxFacts.SyntaxKindType);
var syntaxKind = (Antlr4RoslynTokensSyntaxKind)tokenType.FromAntlr4(_syntaxFacts.SyntaxKindType);
var tokenKind = _syntaxFacts.GetTokenKind(syntaxKind);
if (tokenKind == Antlr4RoslynTokenKind.None)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ namespace MetaDslx.VisualStudio.Languages.MetaGenerator.Classification
{
internal class MetaGeneratorClassifier : Antlr4LexerClassifier
{
private MetaGeneratorSyntaxFacts _syntaxFacts;
private MetaGeneratorTokensSyntaxFacts _syntaxFacts;

internal MetaGeneratorClassifier(ITextBuffer textBuffer, IClassificationTypeRegistryService classificationRegistryService)
: base(textBuffer, classificationRegistryService, new MetaDslx.Languages.MetaGenerator.Syntax.InternalSyntax.MetaGeneratorLexer(Antlr4LexerClassifier.EmptyCharStream))
{
_syntaxFacts = new MetaGeneratorSyntaxFacts();
_syntaxFacts = new MetaGeneratorTokensSyntaxFacts();
}

protected override IClassificationType GetClassificationType(int tokenType, int mode)
{
var syntaxKind = (MetaGeneratorSyntaxKind)tokenType.FromAntlr4(_syntaxFacts.SyntaxKindType);
var syntaxKind = (MetaGeneratorTokensSyntaxKind)tokenType.FromAntlr4(_syntaxFacts.SyntaxKindType);
var tokenKind = _syntaxFacts.GetTokenKind(syntaxKind);
if (tokenKind == MetaGeneratorTokenKind.None)
{
Expand Down
6 changes: 4 additions & 2 deletions src/Main/MetaDslx.VisualStudio/MetaDslx.VisualStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<GeneratePkgDefFile>true</GeneratePkgDefFile>
<UseCodebase>true</UseCodebase>
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>true</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>true</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>true</CopyOutputSymbolsToOutputDirectory>
<StartAction>Program</StartAction>
Expand All @@ -36,6 +34,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>true</IncludeDebugSymbolsInLocalVSIXDeployment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -44,6 +44,8 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
</PropertyGroup>
<ItemGroup>
<Compile Include="Classification\Antlr4CompilationTaggerProvider.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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="MetaDslx.VisualStudio.cf2296b0-4cb6-423a-9130-8a56bfd89938" Version="0.9.1" Language="en-US" Publisher="Balazs Simon" />
<Identity Id="MetaDslx.VisualStudio.cf2296b0-4cb6-423a-9130-8a56bfd89938" Version="0.10.0" Language="en-US" Publisher="Balazs Simon" />
<DisplayName>MetaDslx Extension for Visual Studio</DisplayName>
<Description xml:space="preserve">A metamodel, compiler and template-based code generator framework for Visual Studio</Description>
</Metadata>
Expand Down
4 changes: 2 additions & 2 deletions src/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
Roslyn version
-->
<PropertyGroup>
<VersionPrefix>0.9.2</VersionPrefix>
<VersionPrefix>0.10.0</VersionPrefix>
<VersionSuffix Condition="'$(OfficialBuild)' != 'true' and '$(DotNetUseShippingVersions)' != 'true'">alpha1</VersionSuffix>
<BootstrapVersion>0.9.1-alpha1</BootstrapVersion>
<BootstrapVersion>0.9.4-alpha1</BootstrapVersion>
<SemanticVersioningV1>true</SemanticVersioningV1>
<!--
By default the assembly version in official builds is "$(VersionPrefix).0".
Expand Down

0 comments on commit 7269c29

Please sign in to comment.