From 9f05cf8fbbf3596664af8b1cd9e1cf2c019a9cab Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Wed, 26 Feb 2014 10:26:48 -0800 Subject: [PATCH] Write helper method template functions with no indent. Also removed capturing of the LineMapping (wasn't being used) for the CSharpHelperVisitor. --- .../CodeBuilder/CSharp/Visitors/CSharpHelperVisitor.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpHelperVisitor.cs b/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpHelperVisitor.cs index 28af2e5357..ce47a734bb 100644 --- a/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpHelperVisitor.cs +++ b/src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp/Visitors/CSharpHelperVisitor.cs @@ -20,9 +20,13 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp string accessibility = "public " + (Context.Host.StaticHelpers ? "static" : String.Empty); + // We want to write the method signature at 0 indentation so if helper's are formatted they format correctly. + int currentIndentation = Writer.CurrentIndent; + Writer.ResetIndent(); Writer.Write(accessibility).Write(" ").Write(Context.Host.GeneratedClassContext.TemplateTypeName).Write(" "); + Writer.SetIndent(currentIndentation); - using (CSharpLineMappingWriter mappingWriter = Writer.BuildLineMapping(chunk.Signature.Location, chunk.Signature.Value.Length, Context.SourceFile)) + using (Writer.BuildLineMapping(chunk.Signature.Location, chunk.Signature.Value.Length, Context.SourceFile)) { Writer.Write(chunk.Signature); }