File tree Expand file tree Collapse file tree 2 files changed +7
-15
lines changed
pglt_workspace/src/workspace/server Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -59,5 +59,9 @@ mod tests {
5959 "select 1443ddwwd33djwdkjw13331333333333; select 1443ddwwd33djwdkjw13331333333333;" ;
6060 let diagnostics = lex ( input) . unwrap_err ( ) ;
6161 assert_eq ! ( diagnostics. len( ) , 2 ) ;
62+ assert_eq ! ( diagnostics[ 0 ] . span. unwrap( ) . start( ) , 7 . into( ) ) ;
63+ assert_eq ! ( diagnostics[ 0 ] . span. unwrap( ) . end( ) , 39 . into( ) ) ;
64+ assert_eq ! ( diagnostics[ 1 ] . span. unwrap( ) . start( ) , 48 . into( ) ) ;
65+ assert_eq ! ( diagnostics[ 1 ] . span. unwrap( ) . end( ) , 80 . into( ) ) ;
6266 }
6367}
Original file line number Diff line number Diff line change @@ -103,11 +103,7 @@ impl Document {
103103 self . diagnostics = diagnostics;
104104
105105 // Do not add any statements if there is a fatal error
106- if self
107- . diagnostics
108- . iter ( )
109- . any ( |d| d. severity ( ) == pglt_diagnostics:: Severity :: Fatal )
110- {
106+ if self . has_fatal_error ( ) {
111107 return changes;
112108 }
113109
@@ -264,11 +260,7 @@ impl Document {
264260
265261 self . diagnostics = diags;
266262
267- if self
268- . diagnostics
269- . iter ( )
270- . any ( |d| d. severity ( ) == pglt_diagnostics:: Severity :: Fatal )
271- {
263+ if self . has_fatal_error ( ) {
272264 // cleanup all positions if there is a fatal error
273265 changed. extend ( self . drain_positions ( ) ) ;
274266 // still process text change
@@ -333,11 +325,7 @@ impl Document {
333325
334326 self . diagnostics = diags;
335327
336- if self
337- . diagnostics
338- . iter ( )
339- . any ( |d| d. severity ( ) == pglt_diagnostics:: Severity :: Fatal )
340- {
328+ if self . has_fatal_error ( ) {
341329 // cleanup all positions if there is a fatal error
342330 changed. extend ( self . drain_positions ( ) ) ;
343331 // still process text change
You can’t perform that action at this time.
0 commit comments