@@ -120,9 +120,9 @@ public void StartEarlyProcessing(string clientId, IReadOnlyList<string> history)
120
120
{
121
121
string secondToLastLine = history . TakeLast ( AzPredictorConstants . CommandHistoryCountToProcess ) . First ( ) ;
122
122
var secondToLastCommand = GetAstAndMaskedCommandLine ( secondToLastLine ) ;
123
- _lastTwoMaskedCommands . Enqueue ( secondToLastCommand . MaskedValue ) ;
123
+ _lastTwoMaskedCommands . Enqueue ( secondToLastCommand . IsSupported ? secondToLastCommand . MaskedValue : AzPredictorConstants . CommandPlaceholder ) ;
124
124
125
- if ( ! string . Equals ( AzPredictorConstants . CommandPlaceholder , secondToLastCommand . MaskedValue , StringComparison . Ordinal ) )
125
+ if ( secondToLastCommand . IsSupported )
126
126
{
127
127
_service . RecordHistory ( secondToLastCommand . Ast ) ;
128
128
}
@@ -162,9 +162,7 @@ public void StartEarlyProcessing(string clientId, IReadOnlyList<string> history)
162
162
_lastTwoMaskedCommands . Enqueue ( existingInQueue ) ;
163
163
}
164
164
165
- _telemetryClient . OnHistory ( new HistoryTelemetryData ( clientId ,
166
- lastCommand . IsSupported ? lastCommand . MaskedValue :
167
- ( lastCommand . Ast ? . GetCommandName ( ) ?? lastCommand . MaskedValue ) ) ) ;
165
+ _telemetryClient . OnHistory ( new HistoryTelemetryData ( clientId , lastCommand . MaskedValue ?? AzPredictorConstants . CommandPlaceholder ) ) ;
168
166
169
167
if ( isLastTwoCommandsChanged )
170
168
{
@@ -209,15 +207,10 @@ public void StartEarlyProcessing(string clientId, IReadOnlyList<string> history)
209
207
var asts = Parser . ParseInput ( commandLine , out _ , out _ ) ;
210
208
var allNestedAsts = asts ? . FindAll ( ( ast ) => ast is CommandAst , true ) ;
211
209
var commandAst = allNestedAsts ? . LastOrDefault ( ) as CommandAst ;
212
- string maskedCommandLine = AzPredictorConstants . CommandPlaceholder ;
213
210
214
211
var commandName = commandAst ? . CommandElements ? . FirstOrDefault ( ) . ToString ( ) ;
215
212
bool isSupported = _service . IsSupportedCommand ( commandName ) ;
216
-
217
- if ( isSupported )
218
- {
219
- maskedCommandLine = CommandLineUtilities . MaskCommandLine ( commandAst ) ;
220
- }
213
+ string maskedCommandLine = CommandLineUtilities . MaskCommandLine ( commandAst ) ;
221
214
222
215
return ( commandAst , maskedCommandLine , isSupported ) ;
223
216
}
0 commit comments