@@ -5,6 +5,7 @@ namespace StyleCop.Analyzers.Helpers
55{
66 using Microsoft . CodeAnalysis ;
77 using Microsoft . CodeAnalysis . CSharp ;
8+ using Settings . ObjectModel ;
89 using StyleCop . Analyzers . Helpers . ObjectPools ;
910
1011 /// <summary>
@@ -39,39 +40,39 @@ public static SyntaxToken GetFirstTokenOnTextLine(SyntaxToken token)
3940 /// <summary>
4041 /// Gets the number of steps that the given node is indented.
4142 /// </summary>
42- /// <param name="indentationOptions ">The indentation options to use.</param>
43+ /// <param name="indentationSettings ">The indentation settings to use.</param>
4344 /// <param name="node">The node to inspect.</param>
4445 /// <returns>The number of steps that the node is indented.</returns>
45- public static int GetIndentationSteps ( IndentationOptions indentationOptions , SyntaxNode node )
46+ public static int GetIndentationSteps ( IndentationSettings indentationSettings , SyntaxNode node )
4647 {
47- return GetIndentationSteps ( indentationOptions , node . SyntaxTree , node . GetLeadingTrivia ( ) ) ;
48+ return GetIndentationSteps ( indentationSettings , node . SyntaxTree , node . GetLeadingTrivia ( ) ) ;
4849 }
4950
5051 /// <summary>
5152 /// Gets the number of steps that the given token is indented.
5253 /// </summary>
53- /// <param name="indentationOptions ">The indentation options to use.</param>
54+ /// <param name="indentationSettings ">The indentation settings to use.</param>
5455 /// <param name="token">The token to inspect.</param>
5556 /// <returns>The number of steps that the token is indented.</returns>
56- public static int GetIndentationSteps ( IndentationOptions indentationOptions , SyntaxToken token )
57+ public static int GetIndentationSteps ( IndentationSettings indentationSettings , SyntaxToken token )
5758 {
58- return GetIndentationSteps ( indentationOptions , token . SyntaxTree , token . LeadingTrivia ) ;
59+ return GetIndentationSteps ( indentationSettings , token . SyntaxTree , token . LeadingTrivia ) ;
5960 }
6061
6162 /// <summary>
6263 /// Generate a new indentation string.
6364 /// </summary>
64- /// <param name="indentationOptions ">The indentation options to use.</param>
65+ /// <param name="indentationSettings ">The indentation settings to use.</param>
6566 /// <param name="indentationSteps">The number of indentation steps.</param>
6667 /// <returns>A string containing the amount of whitespace needed for the given indentation steps.</returns>
67- public static string GenerateIndentationString ( IndentationOptions indentationOptions , int indentationSteps )
68+ public static string GenerateIndentationString ( IndentationSettings indentationSettings , int indentationSteps )
6869 {
6970 string result ;
70- var indentationCount = indentationSteps * indentationOptions . IndentationSize ;
71- if ( indentationOptions . UseTabs )
71+ var indentationCount = indentationSteps * indentationSettings . IndentationSize ;
72+ if ( indentationSettings . UseTabs )
7273 {
73- var tabCount = indentationCount / indentationOptions . TabSize ;
74- var spaceCount = indentationCount % indentationOptions . TabSize ;
74+ var tabCount = indentationCount / indentationSettings . TabSize ;
75+ var spaceCount = indentationCount % indentationSettings . TabSize ;
7576 result = new string ( '\t ' , tabCount ) + new string ( ' ' , spaceCount ) ;
7677 }
7778 else
@@ -85,15 +86,15 @@ public static string GenerateIndentationString(IndentationOptions indentationOpt
8586 /// <summary>
8687 /// Generates a whitespace trivia with the requested indentation.
8788 /// </summary>
88- /// <param name="indentationOptions ">The indentation options to use.</param>
89+ /// <param name="indentationSettings ">The indentation settings to use.</param>
8990 /// <param name="indentationSteps">The amount of indentation steps.</param>
9091 /// <returns>A <see cref="SyntaxTrivia"/> containing the indentation whitespace.</returns>
91- public static SyntaxTrivia GenerateWhitespaceTrivia ( IndentationOptions indentationOptions , int indentationSteps )
92+ public static SyntaxTrivia GenerateWhitespaceTrivia ( IndentationSettings indentationSettings , int indentationSteps )
9293 {
93- return SyntaxFactory . Whitespace ( GenerateIndentationString ( indentationOptions , indentationSteps ) ) ;
94+ return SyntaxFactory . Whitespace ( GenerateIndentationString ( indentationSettings , indentationSteps ) ) ;
9495 }
9596
96- private static int GetIndentationSteps ( IndentationOptions indentationOptions , SyntaxTree syntaxTree , SyntaxTriviaList leadingTrivia )
97+ private static int GetIndentationSteps ( IndentationSettings indentationSettings , SyntaxTree syntaxTree , SyntaxTriviaList leadingTrivia )
9798 {
9899 var triviaSpan = syntaxTree . GetLineSpan ( leadingTrivia . FullSpan ) ;
99100
@@ -115,7 +116,7 @@ private static int GetIndentationSteps(IndentationOptions indentationOptions, Sy
115116 builder . Insert ( 0 , trivia . ToFullString ( ) ) ;
116117 }
117118
118- var tabSize = indentationOptions . TabSize ;
119+ var tabSize = indentationSettings . TabSize ;
119120 var indentationCount = 0 ;
120121 for ( var i = 0 ; i < builder . Length ; i ++ )
121122 {
@@ -124,7 +125,7 @@ private static int GetIndentationSteps(IndentationOptions indentationOptions, Sy
124125
125126 StringBuilderPool . ReturnAndFree ( builder ) ;
126127
127- return ( indentationCount + ( indentationOptions . IndentationSize / 2 ) ) / indentationOptions . IndentationSize ;
128+ return ( indentationCount + ( indentationSettings . IndentationSize / 2 ) ) / indentationSettings . IndentationSize ;
128129 }
129130 }
130131}
0 commit comments