@@ -129,7 +129,7 @@ public AnalysisService(IConsoleHost consoleHost, string settingsPath = null)
129
129
#region Public Methods
130
130
131
131
/// <summary>
132
- /// Performs semantic analysis on the given ScriptFile and returns
132
+ /// Perform semantic analysis on the given ScriptFile and returns
133
133
/// an array of ScriptFileMarkers.
134
134
/// </summary>
135
135
/// <param name="file">The ScriptFile which will be analyzed for semantic markers.</param>
@@ -139,46 +139,17 @@ public ScriptFileMarker[] GetSemanticMarkers(ScriptFile file)
139
139
return GetSemanticMarkers ( file , activeRules , settingsPath ) ;
140
140
}
141
141
142
+ /// <summary>
143
+ /// Perform semantic analysis on the given ScriptFile with the given settings.
144
+ /// </summary>
145
+ /// <param name="file">The ScriptFile to be analyzed.</param>
146
+ /// <param name="settings">ScriptAnalyzer settings</param>
147
+ /// <returns></returns>
142
148
public ScriptFileMarker [ ] GetSemanticMarkers ( ScriptFile file , Hashtable settings )
143
149
{
144
150
return GetSemanticMarkers < Hashtable > ( file , null , settings ) ;
145
151
}
146
152
147
- private ScriptFileMarker [ ] GetSemanticMarkers < TSettings > (
148
- ScriptFile file ,
149
- string [ ] rules ,
150
- TSettings settings ) where TSettings : class
151
- {
152
- if ( this . scriptAnalyzerModuleInfo != null
153
- && file . IsAnalysisEnabled
154
- && ( typeof ( TSettings ) == typeof ( string ) || typeof ( TSettings ) == typeof ( Hashtable ) )
155
- && ( rules != null || settings != null ) )
156
- {
157
- // TODO: This is a temporary fix until we can change how
158
- // ScriptAnalyzer invokes their async tasks.
159
- // TODO: Make this async
160
- Task < ScriptFileMarker [ ] > analysisTask =
161
- Task . Factory . StartNew < ScriptFileMarker [ ] > (
162
- ( ) =>
163
- {
164
- return
165
- GetDiagnosticRecords ( file , rules , settings )
166
- . Select ( ScriptFileMarker . FromDiagnosticRecord )
167
- . ToArray ( ) ;
168
- } ,
169
- CancellationToken . None ,
170
- TaskCreationOptions . None ,
171
- TaskScheduler . Default ) ;
172
- analysisTask . Wait ( ) ;
173
- return analysisTask . Result ;
174
- }
175
- else
176
- {
177
- // Return an empty marker list
178
- return new ScriptFileMarker [ 0 ] ;
179
- }
180
- }
181
-
182
153
/// <summary>
183
154
/// Returns a list of builtin-in PSScriptAnalyzer rules
184
155
/// </summary>
@@ -220,6 +191,42 @@ public void Dispose()
220
191
#endregion // public methods
221
192
222
193
#region Private Methods
194
+
195
+ private ScriptFileMarker [ ] GetSemanticMarkers < TSettings > (
196
+ ScriptFile file ,
197
+ string [ ] rules ,
198
+ TSettings settings ) where TSettings : class
199
+ {
200
+ if ( this . scriptAnalyzerModuleInfo != null
201
+ && file . IsAnalysisEnabled
202
+ && ( typeof ( TSettings ) == typeof ( string ) || typeof ( TSettings ) == typeof ( Hashtable ) )
203
+ && ( rules != null || settings != null ) )
204
+ {
205
+ // TODO: This is a temporary fix until we can change how
206
+ // ScriptAnalyzer invokes their async tasks.
207
+ // TODO: Make this async
208
+ Task < ScriptFileMarker [ ] > analysisTask =
209
+ Task . Factory . StartNew < ScriptFileMarker [ ] > (
210
+ ( ) =>
211
+ {
212
+ return
213
+ GetDiagnosticRecords ( file , rules , settings )
214
+ . Select ( ScriptFileMarker . FromDiagnosticRecord )
215
+ . ToArray ( ) ;
216
+ } ,
217
+ CancellationToken . None ,
218
+ TaskCreationOptions . None ,
219
+ TaskScheduler . Default ) ;
220
+ analysisTask . Wait ( ) ;
221
+ return analysisTask . Result ;
222
+ }
223
+ else
224
+ {
225
+ // Return an empty marker list
226
+ return new ScriptFileMarker [ 0 ] ;
227
+ }
228
+ }
229
+
223
230
private void FindPSScriptAnalyzer ( )
224
231
{
225
232
lock ( runspaceLock )
0 commit comments