@@ -26,7 +26,7 @@ public Indenter(VBE vbe, Func<IIndenterSettings> settings)
26
26
{
27
27
foreach ( var token in ProcedureLevelTypeTokens )
28
28
{
29
- _inProcedure . Add ( string . Join ( " " , ( new [ ] { scope , modifier , token } ) . Where ( x => ! string . IsNullOrEmpty ( x ) ) ) ) ;
29
+ _inProcedure . Add ( string . Join ( " " , new [ ] { scope , modifier , token } . Where ( x => ! string . IsNullOrEmpty ( x ) ) ) ) ;
30
30
}
31
31
}
32
32
}
@@ -48,21 +48,22 @@ private void OnReportProgress(string moduleName, int progress, int max)
48
48
public void IndentCurrentProcedure ( )
49
49
{
50
50
var pane = _vbe . ActiveCodePane ;
51
+ var module = pane . CodeModule ;
51
52
var selection = GetSelection ( pane ) ;
52
53
53
54
vbext_ProcKind procKind ;
54
- var procName = pane . CodeModule . get_ProcOfLine ( selection . StartLine , out procKind ) ;
55
+ var procName = module . ProcOfLine [ selection . StartLine , out procKind ] ;
55
56
56
57
if ( string . IsNullOrEmpty ( procName ) )
57
58
{
58
59
return ;
59
60
}
60
61
61
- var startLine = pane . CodeModule . get_ProcStartLine ( procName , procKind ) ;
62
- var endLine = startLine + pane . CodeModule . get_ProcCountLines ( procName , procKind ) ;
62
+ var startLine = module . ProcStartLine [ procName , procKind ] ;
63
+ var endLine = startLine + module . ProcCountLines [ procName , procKind ] ;
63
64
64
65
selection = new Selection ( startLine , 1 , endLine , 1 ) ;
65
- Indent ( pane . CodeModule . Parent , procName , selection ) ;
66
+ Indent ( module . Parent , procName , selection ) ;
66
67
}
67
68
68
69
public void IndentCurrentModule ( )
@@ -107,7 +108,7 @@ private static bool HasCode(CodeModule module, ref int lineCount)
107
108
lineCount += module . CountOfLines ;
108
109
for ( var i = 0 ; i < module . CountOfLines ; i ++ )
109
110
{
110
- if ( ! string . IsNullOrWhiteSpace ( module . get_Lines ( i , 1 ) ) )
111
+ if ( ! string . IsNullOrWhiteSpace ( module . Lines [ i , 1 ] ) )
111
112
{
112
113
return true ;
113
114
}
@@ -119,7 +120,7 @@ private static bool HasCode(CodeModule module)
119
120
{
120
121
for ( var i = 0 ; i < module . CountOfLines ; i ++ )
121
122
{
122
- if ( ! string . IsNullOrWhiteSpace ( module . get_Lines ( i , 1 ) ) )
123
+ if ( ! string . IsNullOrWhiteSpace ( module . Lines [ i , 1 ] ) )
123
124
{
124
125
return true ;
125
126
}
@@ -138,42 +139,44 @@ private static Selection GetSelection(CodePane codePane)
138
139
return new Selection ( startLine , startColumn , endLine , endColumn ) ;
139
140
}
140
141
141
- public void Indent ( VBComponent module , bool reportProgress = true , int linesAlreadyRebuilt = 0 )
142
+ public void Indent ( VBComponent component , bool reportProgress = true , int linesAlreadyRebuilt = 0 )
142
143
{
143
- var lineCount = module . CodeModule . CountOfLines ;
144
+ var module = component . CodeModule ;
145
+ var lineCount = module . CountOfLines ;
144
146
if ( lineCount == 0 )
145
147
{
146
148
return ;
147
149
}
148
150
149
- var codeLines = module . CodeModule . get_Lines ( 1 , lineCount ) . Replace ( "\r " , string . Empty ) . Split ( '\n ' ) ;
150
- Indent ( codeLines , module . Name , reportProgress , linesAlreadyRebuilt ) ;
151
+ var codeLines = module . Lines [ 1 , lineCount ] . Replace ( "\r " , string . Empty ) . Split ( '\n ' ) ;
152
+ Indent ( codeLines , component . Name , reportProgress , linesAlreadyRebuilt ) ;
151
153
152
154
for ( var i = 0 ; i < lineCount ; i ++ )
153
155
{
154
- if ( module . CodeModule . get_Lines ( i + 1 , 1 ) != codeLines [ i ] )
156
+ if ( module . Lines [ i + 1 , 1 ] != codeLines [ i ] )
155
157
{
156
- module . CodeModule . ReplaceLine ( i + 1 , codeLines [ i ] ) ;
158
+ component . CodeModule . ReplaceLine ( i + 1 , codeLines [ i ] ) ;
157
159
}
158
160
}
159
161
}
160
162
161
- public void Indent ( VBComponent module , string procedureName , Selection selection , bool reportProgress = true , int linesAlreadyRebuilt = 0 )
163
+ public void Indent ( VBComponent component , string procedureName , Selection selection , bool reportProgress = true , int linesAlreadyRebuilt = 0 )
162
164
{
163
- var lineCount = module . CodeModule . CountOfLines ;
165
+ var module = component . CodeModule ;
166
+ var lineCount = module . CountOfLines ;
164
167
if ( lineCount == 0 )
165
168
{
166
169
return ;
167
170
}
168
171
169
- var codeLines = module . CodeModule . get_Lines ( selection . StartLine , selection . LineCount ) . Replace ( "\r " , string . Empty ) . Split ( '\n ' ) ;
172
+ var codeLines = module . Lines [ selection . StartLine , selection . LineCount ] . Replace ( "\r " , string . Empty ) . Split ( '\n ' ) ;
170
173
Indent ( codeLines , procedureName , reportProgress , linesAlreadyRebuilt ) ;
171
174
172
175
for ( var i = 0 ; i < selection . EndLine - selection . StartLine ; i ++ )
173
176
{
174
- if ( module . CodeModule . get_Lines ( selection . StartLine + i , 1 ) != codeLines [ i ] )
177
+ if ( module . Lines [ selection . StartLine + i , 1 ] != codeLines [ i ] )
175
178
{
176
- module . CodeModule . ReplaceLine ( selection . StartLine + i , codeLines [ i ] ) ;
179
+ component . CodeModule . ReplaceLine ( selection . StartLine + i , codeLines [ i ] ) ;
177
180
}
178
181
}
179
182
}
0 commit comments