(err *SyntaxError, statement string)
| 67 | } |
| 68 | |
| 69 | func ConvertSyntaxErrorToDiagnostic(err *SyntaxError, statement string) Diagnostic { |
| 70 | start := *convertPositionToUTF16Position(err.Position, statement) |
| 71 | end := start |
| 72 | end.Character++ |
| 73 | message := err.Message |
| 74 | if err.RawMessage != "" { |
| 75 | // Use RawMessage which created by antlr runtime, do not need our fine-tuned message |
| 76 | // because we had indicated the error position in the message. |
| 77 | message = err.RawMessage |
| 78 | } |
| 79 | return Diagnostic{ |
| 80 | Range: lsp.Range{ |
| 81 | Start: start, |
| 82 | End: end, |
| 83 | }, |
| 84 | Severity: lsp.SeverityError, |
| 85 | Source: "Syntax check", |
| 86 | Message: message, |
| 87 | } |
| 88 | } |
no test coverage detected