Permalink
Browse files

Fix #46 Formatting and whitespace fixes

F our tests are failing because of remaining formatting issues
  • Loading branch information...
1 parent 8ab6fa5 commit d14c3cc2737363948aa9f59e4eff144db0590a0b Kathleen Dollard committed Jul 23, 2014
Showing with 329 additions and 175 deletions.
  1. BIN Documentation/Long Term ToDo.docx
  2. +93 −0 Packages.dgml
  3. +15 −6 RoslynDom/BasesAndBaseHelpers/RDomCommentWhite.cs
  4. +7 −0 RoslynDom/Implementations/RDomComment.cs
  5. +9 −1 RoslynDom/Implementations/RDomVerticalWhitespace.cs
  6. +3 −3 RoslynDom/StatementImplementations/RDomAssignmentStatement.cs
  7. +54 −12 RoslynDomCSharpFactories/BuildSyntaxExtensions.cs
  8. +0 −25 RoslynDomCSharpFactories/CommentWhiteFactory.cs
  9. +1 −1 RoslynDomCSharpFactories/Factories/RDomAccessorFactory.cs
  10. +3 −5 RoslynDomCSharpFactories/Factories/RDomClassFactory.cs
  11. +2 −2 RoslynDomCSharpFactories/Factories/RDomEnumFactory.cs
  12. +1 −2 RoslynDomCSharpFactories/Factories/RDomFieldFactory.cs
  13. +1 −1 RoslynDomCSharpFactories/Factories/RDomInterfaceFactory.cs
  14. +1 −2 RoslynDomCSharpFactories/Factories/RDomMethodFactory.cs
  15. +2 −2 RoslynDomCSharpFactories/Factories/RDomNamespaceFactory.cs
  16. +2 −2 RoslynDomCSharpFactories/Factories/RDomParameterFactory.cs
  17. +1 −2 RoslynDomCSharpFactories/Factories/RDomPropertyFactory.cs
  18. +1 −2 RoslynDomCSharpFactories/Factories/RDomReferencedTypeFactory.cs
  19. +1 −1 RoslynDomCSharpFactories/Factories/RDomRootFactory.cs
  20. +1 −1 RoslynDomCSharpFactories/Factories/RDomStructureFactory.cs
  21. +1 −2 RoslynDomCSharpFactories/Factories/RDomUsingFactory.cs
  22. +5 −1 RoslynDomCSharpFactories/FactoriesForStatements/LoopFactoryHelper.cs
  23. +10 −7 RoslynDomCSharpFactories/FactoriesForStatements/RDomAssignmentStatementFactory.cs
  24. +2 −2 RoslynDomCSharpFactories/FactoriesForStatements/RDomBlockStatementFactory.cs
  25. +2 −1 RoslynDomCSharpFactories/FactoriesForStatements/RDomDeclarationStatementFactory.cs
  26. +2 −3 RoslynDomCSharpFactories/FactoriesForStatements/RDomForEachStatementFactory.cs
  27. +5 −5 RoslynDomCSharpFactories/FactoriesForStatements/RDomForStatementFactory.cs
  28. +1 −1 RoslynDomCSharpFactories/FactoriesForStatements/RDomIfStatementFactory.cs
  29. +3 −3 RoslynDomCSharpFactories/FactoriesForStatements/RDomInvocationStatementFactory.cs
  30. +2 −1 RoslynDomCSharpFactories/FactoriesForStatements/RDomReturnStatementFactory.cs
  31. +2 −1 RoslynDomCSharpFactories/FactoriesForStatements/RDomVariableDeclarationtFactory.cs
  32. +1 −8 RoslynDomCSharpFactories/RoslynCSharpUtilities.cs
  33. +2 −1 RoslynDomCommon/Interfaces_Statements/IAssignmentStatement.cs
  34. +0 −15 RoslynDomCommon/Interfaces_Statements/IDoWhileStatement.cs
  35. +1 −1 RoslynDomCommon/Interfaces_Statements/IInvocationStatement.cs
  36. +0 −5 RoslynDomRDomCommon/RDomBaseFactoryHelper.cs
  37. +21 −1 RoslynDomTests/BugResponseTests.cs
  38. +71 −47 RoslynDomTests/FactoryTests.cs
Binary file not shown.
View
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<DirectedGraph GraphDirection="LeftToRight" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
+ <Nodes>
+ <Node Id="RoslynDomCSharpFactories" Label="RoslynDomCSharpFactories" Category="Project" />
+ <Node Id="Microsoft.Bcl.Immutable 1.1.20-beta" Label="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package" />
+ <Node Id="Microsoft.Bcl.Metadata 1.0.11-alpha" Label="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Category="Package" />
+ <Node Id="RoslynDomRDomCommon" Label="RoslynDomRDomCommon" Category="Project" />
+ <Node Id="Microsoft.Bcl.Immutable 1.1.20-beta" Label="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package" />
+ <Node Id="Microsoft.Bcl.Metadata 1.0.11-alpha" Label="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package" />
+ <Node Id="Unity 3.5.1405-prerelease" Label="Unity 3.5.1405-prerelease" Category="Package" />
+ <Node Id="RoslynDomExampleTests" Label="RoslynDomExampleTests" Category="Project" />
+ <Node Id="Microsoft.Bcl.Immutable 1.1.20-beta" Label="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package" />
+ <Node Id="Microsoft.Bcl.Metadata 1.0.11-alpha" Label="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Category="Package" />
+ <Node Id="RoslynDomTests" Label="RoslynDomTests" Category="Project" />
+ <Node Id="Microsoft.Bcl.Immutable 1.1.20-beta" Label="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package" />
+ <Node Id="Microsoft.Bcl.Metadata 1.0.11-alpha" Label="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Category="Package" />
+ <Node Id="RoslynDom" Label="RoslynDom" Category="Project" />
+ <Node Id="Microsoft.Bcl.Immutable 1.1.20-beta" Label="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package" />
+ <Node Id="Microsoft.Bcl.Metadata 1.0.11-alpha" Label="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Category="Package" />
+ <Node Id="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Label="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Category="Package" />
+ <Node Id="Unity 3.5.1405-prerelease" Label="Unity 3.5.1405-prerelease" Category="Package" />
+ </Nodes>
+ <Links>
+ <Link Source="Microsoft.Bcl.Metadata 1.0.11-alpha" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="RoslynDomCSharpFactories" Target="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Category="Installed Package" />
+ <Link Source="Microsoft.Bcl.Metadata 1.0.11-alpha" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package Dependency" />
+ <Link Source="RoslynDomRDomCommon" Target="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Installed Package" />
+ <Link Source="RoslynDomRDomCommon" Target="Unity 3.5.1405-prerelease" Category="Installed Package" />
+ <Link Source="Microsoft.Bcl.Metadata 1.0.11-alpha" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="RoslynDomExampleTests" Target="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Category="Installed Package" />
+ <Link Source="Microsoft.Bcl.Metadata 1.0.11-alpha" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="RoslynDomTests" Target="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Category="Installed Package" />
+ <Link Source="Microsoft.Bcl.Metadata 1.0.11-alpha" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Immutable 1.1.20-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Target="Microsoft.Bcl.Metadata 1.0.11-alpha" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.CSharp 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="Microsoft.CodeAnalysis.Workspaces.Common 0.7.4052301-beta" Target="Microsoft.CodeAnalysis.Common 0.7.4052301-beta" Category="Package Dependency" />
+ <Link Source="RoslynDom" Target="Microsoft.CodeAnalysis.CSharp.Workspaces 0.7.4052301-beta" Category="Installed Package" />
+ <Link Source="RoslynDom" Target="Unity 3.5.1405-prerelease" Category="Installed Package" />
+ </Links>
+ <Categories>
+ <Category Id="Project" />
+ <Category Id="Package" />
+ </Categories>
+ <Styles>
+ <Style TargetType="Node" GroupLabel="Project" ValueLabel="True">
+ <Condition Expression="HasCategory('Project')" />
+ <Setter Property="Background" Value="Blue" />
+ </Style>
+ <Style TargetType="Link" GroupLabel="Package Dependency" ValueLabel="True">
+ <Condition Expression="HasCategory('Package Dependency')" />
+ <Setter Property="Background" Value="Yellow" />
+ </Style>
+ </Styles>
+</DirectedGraph>
@@ -10,9 +10,21 @@ namespace RoslynDom
{
public abstract class RDomCommentWhite : RDomBase, ICommentWhite
{
-
- public MemberKind MemberKind
- { get { return MemberKind.Whitespace; } }
+ internal RDomCommentWhite(StemMemberKind stemMemberKind, MemberKind memberKind)
+ {
+ StemMemberKind = stemMemberKind;
+ MemberKind = memberKind;
+ }
+
+ internal RDomCommentWhite(RDomCommentWhite oldRDom)
+ : base(oldRDom)
+ {
+ StemMemberKind = oldRDom.StemMemberKind;
+ MemberKind = oldRDom.MemberKind;
+ }
+
+ public StemMemberKind StemMemberKind { get; set; }
+ public MemberKind MemberKind { get; set; }
public override object OriginalRawItem
{ get { return null; } }
@@ -23,9 +35,6 @@ public override string OuterName
public override object RawItem
{ get { return null; } }
- public StemMemberKind StemMemberKind
- { get { return StemMemberKind.Whitespace; } }
-
public override ISymbol Symbol
{ get { return null; } }
@@ -11,10 +11,17 @@ namespace RoslynDom
public class RDomComment : RDomCommentWhite, IComment
{
public RDomComment (string text, bool isMultiline)
+ : base(StemMemberKind.Comment, MemberKind.Comment )
{
Text = text;
IsMultiline = isMultiline;
}
+ internal RDomComment( RDomComment oldRDom)
+ : base(oldRDom)
+ {
+ Text = oldRDom.Text;
+ IsMultiline = oldRDom.IsMultiline;
+ }
public string Text { get; set; }
@@ -10,12 +10,20 @@ namespace RoslynDom
{
public class RDomVerticalWhitespace : RDomCommentWhite, IVerticalWhitespace
{
- public RDomVerticalWhitespace (int count, bool isElastic)
+ public RDomVerticalWhitespace(int count, bool isElastic)
+ : base(StemMemberKind.Whitespace, MemberKind.Whitespace )
{
Count = count;
IsElastic = isElastic;
}
+ internal RDomVerticalWhitespace(RDomVerticalWhitespace oldRDom)
+ : base(oldRDom)
+ {
+ Count = oldRDom.Count;
+ IsElastic = oldRDom.IsElastic;
+ }
+
public int Count { get; set; }
public bool IsElastic { get; set; }
@@ -14,8 +14,8 @@ public RDomAssignmentStatement(SyntaxNode rawItem, IDom parent, SemanticModel mo
internal RDomAssignmentStatement(RDomAssignmentStatement oldRDom)
: base(oldRDom)
{
- Name = oldRDom.Name;
- Expression = oldRDom.Expression;
+ Left = oldRDom.Left.Copy();
+ Expression = oldRDom.Expression.Copy();
}
public override IEnumerable<IDom> Children
@@ -24,7 +24,7 @@ public override IEnumerable<IDom> Children
public override IEnumerable<IDom> Descendants
{ get { return new List<IDom>() { Expression }; } }
- public string Name { get; set; }
+ public IExpression Left { get; set; }
public IExpression Expression { get; set; }
}
}
@@ -13,6 +13,14 @@ namespace RoslynDom
{
public static class BuildSyntaxExtensions
{
+ public static IEnumerable<SyntaxNode> PrepareForBuildSyntaxOutput(this IDom item, SyntaxNode node)
+ {
+ var leadingTrivia = BuildSyntaxExtensions.LeadingTrivia(item);
+ node = node.WithLeadingTrivia(leadingTrivia);
+
+ return new SyntaxNode[] { RoslynUtilities.Format(node) };
+ }
+
public static SyntaxList<AttributeListSyntax> WrapInAttributeList(this IEnumerable<SyntaxNode> attributes)
{
var node = SyntaxFactory.List<AttributeListSyntax>(attributes.OfType<AttributeListSyntax>());
@@ -39,27 +47,60 @@ public static SyntaxTriviaList LeadingTrivia(IDom item)
return SyntaxFactory.TriviaList(leadingTrivia);
}
+ //private static IEnumerable<SyntaxTrivia> BuildCommentWhite(IDom item)
+ //{
+ // var ret = new List<SyntaxTrivia>();
+ // // This can happen if someone copies an item to a new item, does not attach it to a tree,
+ // // and asks for the syntax. It's actually expected to sometimes be unattached.
+ // if (item.Parent == null) { return ret; }
+ // if (item is IStemMember)
+ // {
+ // var parentAsStem = item.Parent as IStemContainer;
+ // if (parentAsStem == null) throw new InvalidOperationException();
+ // var commentWhites = parentAsStem.StemMembersAll
+ // .PreviousSiblingsUntil(item, x => !(x is IComment || x is IVerticalWhitespace))
+ // .OfType<ICommentWhite>();
+ // ret.AddRange(MakeWhiteCommentTrivia(commentWhites));
+ // }
+ // return ret;
+ //}
+
private static IEnumerable<SyntaxTrivia> BuildCommentWhite(IDom item)
{
var ret = new List<SyntaxTrivia>();
- if (item is IStemMember)
- {
- var parentAsStem = item.Parent as IStemContainer;
- if (parentAsStem == null) throw new InvalidOperationException();
- var commentWhites = parentAsStem.StemMembersAll
- .PreviousSiblingsUntil(item, x => !(x is IComment || x is IVerticalWhitespace))
- .OfType<ICommentWhite>();
- ret.AddRange( MakeWhiteCommentTrivia(commentWhites));
- }
+ // This can happen if someone copies an item to a new item, does not attach it to a tree,
+ // and asks for the syntax. It's actually expected to sometimes be unattached.
+ if (item.Parent == null) { return ret; }
+ if (TryBuildCommentWhiteFor<IStemMemberCommentWhite, IStemContainer>(item, ret, x => x.StemMembersAll)) { return ret; }
+ if (TryBuildCommentWhiteFor<ITypeMemberCommentWhite, ITypeMemberContainer>(item, ret, x => x.MembersAll)) { return ret; }
+ if (TryBuildCommentWhiteFor<IStatementCommentWhite, IStatementContainer>(item, ret, x => x.StatementsAll)) { return ret; }
return ret;
}
+ private static bool TryBuildCommentWhiteFor<TKind, TParent>
+ (IDom item, List<SyntaxTrivia> trivias, Func<TParent, IEnumerable<TKind>> getCandidates)
+ where TParent : class
+ where TKind : class
+ {
+ var itemAsTKind = item as TKind;
+ if (itemAsTKind == null) { return false; }
+ // if item is TKind, parent may not be TParent because types can be multiply rooted (stem or nested type)
+ var parentAsTParent = item.Parent as TParent;
+ if (parentAsTParent == null) return false;
+ var candidates = getCandidates(parentAsTParent);
+ var commentWhites = candidates
+ .PreviousSiblingsUntil(itemAsTKind, x => !(x is IComment || x is IVerticalWhitespace))
+ .OfType<ICommentWhite>();
+ trivias.AddRange(MakeWhiteCommentTrivia(commentWhites));
+ return true;
+ }
+
private static IEnumerable<SyntaxTrivia> MakeWhiteCommentTrivia(IEnumerable<ICommentWhite> commentWhites)
{
var ret = new List<SyntaxTrivia>();
foreach (var item in commentWhites)
{
- if (item is IVerticalWhitespace) { ret.Add(SyntaxFactory.EndOfLine("")); }
+ if (item is IVerticalWhitespace) { ret.Add(SyntaxFactory.EndOfLine("\r\n")); }
else
{
var itemAsComment = item as IComment;
@@ -68,16 +109,17 @@ private static IEnumerable<SyntaxTrivia> MakeWhiteCommentTrivia(IEnumerable<ICom
if (itemAsComment.IsMultiline) { comment = "/* " + itemAsComment.Text + "*/"; }
else { comment = "// " + itemAsComment.Text; }
ret.Add(SyntaxFactory.Comment(comment));
+ ret.Add(SyntaxFactory.EndOfLine("\r\n"));
}
}
return ret;
}
public static SyntaxTriviaList BuildStructuredDocumentationSyntax(IHasStructuredDocumentation itemHasStructDoc)
{
- var ret = SyntaxFactory.TriviaList ();
+ var ret = SyntaxFactory.TriviaList();
if (itemHasStructDoc == null || string.IsNullOrWhiteSpace(itemHasStructDoc.Description)) return ret;
- var description = "\r\n" + itemHasStructDoc.Description + "\r\n";
+ var description = "\r\n" + itemHasStructDoc.Description + "\r\n";
XDocument xDoc = null;
if (itemHasStructDoc.StructuredDocumentation == null)
{
Oops, something went wrong.

0 comments on commit d14c3cc

Please sign in to comment.