@@ -177,13 +177,37 @@ private IEnumerable<DiagnosticRecord> FindSeparatorViolations(TokenOperations to
177177 // TODO update separator error string
178178 foreach ( var tokenNode in tokenOperations . GetTokenNodes ( IsSeparator ) . Where ( predicate ) )
179179 {
180+ var errorKind = tokenNode . Value . Kind == TokenKind . Comma
181+ ? ErrorKind . SeparatorComma
182+ : ErrorKind . SeparatorSemi ;
180183 yield return getDiagnosticRecord (
181184 tokenNode . Value ,
182- tokenNode . Value . Kind == TokenKind . Comma ? ErrorKind . SeparatorComma : ErrorKind . SeparatorSemi ) ;
185+ errorKind ,
186+ GetSeparatorCorrections ( errorKind , tokenNode . Value , tokenNode . Next . Value ) . ToList ( ) ) ;
183187 }
184188 }
185189
186- private DiagnosticRecord getDiagnosticRecord ( Token token , ErrorKind errKind )
190+ private IEnumerable < CorrectionExtent > GetSeparatorCorrections (
191+ ErrorKind errorKind ,
192+ Token separatorToken ,
193+ Token nextToken )
194+ {
195+ var e1 = separatorToken . Extent ;
196+ var e2 = nextToken . Extent ;
197+ var extent = new ScriptExtent (
198+ new ScriptPosition ( e1 . File , e1 . StartLineNumber , e1 . StartColumnNumber , null ) ,
199+ new ScriptPosition ( e2 . File , e2 . StartLineNumber , e2 . StartColumnNumber , null ) ) ;
200+ yield return new CorrectionExtent (
201+ separatorToken . Extent ,
202+ separatorToken . Text + whiteSpace ,
203+ separatorToken . Extent . File ,
204+ GetError ( errorKind ) ) ; // TODO replace with better string
205+ }
206+
207+ private DiagnosticRecord getDiagnosticRecord (
208+ Token token ,
209+ ErrorKind errKind ,
210+ List < CorrectionExtent > corrections )
187211 {
188212 return new DiagnosticRecord (
189213 GetError ( errKind ) ,
@@ -192,7 +216,7 @@ private DiagnosticRecord getDiagnosticRecord(Token token, ErrorKind errKind)
192216 GetDiagnosticSeverity ( ) ,
193217 token . Extent . File ,
194218 null ,
195- null ) ;
219+ corrections ) ;
196220 }
197221
198222 private bool IsKeyword ( Token token )
0 commit comments