Appearance
| 1 | namespace Logging is | |
| 2 | use System.Text.Json; | |
| 3 | ||
| 4 | use Source.LOCATION; | |
| 5 | ||
| 6 | class POSITION is | |
| 7 | line: uint public; | |
| 8 | character: uint public; | |
| 9 | ||
| 10 | init(line: uint, character: uint) is | |
| 11 | self.line = line; | |
| 12 | self.character = character; | |
| 13 | si | |
| 14 | si | |
| 15 | ||
| 16 | class RANGE is | |
| 17 | start: POSITION public; | |
| 18 | end: POSITION public; | |
| 19 | ||
| 20 | init(start: POSITION, end: POSITION) is | |
| 21 | self.start = start; | |
| 22 | self.end = end; | |
| 23 | si | |
| 24 | ||
| 25 | init(location: LOCATION) is | |
| 26 | start = POSITION(cast uint(location.start_line), cast uint(location.start_column)); | |
| 27 | end = POSITION(cast uint(location.end_line), cast uint(location.end_column)); | |
| 28 | si | |
| 29 | si | |
| 30 | ||
| 31 | enum DiagnosticSeverity is | |
| 32 | FATAL, // 0 | |
| 33 | ERROR, // 1 | |
| 34 | WARN, // 2 | |
| 35 | INFO, // 3 | |
| 36 | HINT, // 4 | |
| 37 | ||
| 38 | // FIXME: ideally this would be -1 but negative enum initializers are broken | |
| 39 | EXCEPTION, // 5 | |
| 40 | ||
| 41 | // Editor-only inlay-hint carrier: never published as a diagnostic, | |
| 42 | // surfaced only by the INLAY_HINTS analysis query. | |
| 43 | INLAY // 6 | |
| 44 | si | |
| 45 | ||
| 46 | class DIAGNOSTIC_DTO is | |
| 47 | range: RANGE; | |
| 48 | severity: DiagnosticSeverity; | |
| 49 | message: string; | |
| 50 | ||
| 51 | init( | |
| 52 | range: RANGE, | |
| 53 | severity: DiagnosticSeverity, | |
| 54 | message: string | |
| 55 | ) is | |
| 56 | self.range = range; | |
| 57 | self.severity = severity; | |
| 58 | self.message = message; | |
| 59 | si | |
| 60 | ||
| 61 | init( | |
| 62 | location: LOCATION, | |
| 63 | severity: DiagnosticSeverity, | |
| 64 | message: string | |
| 65 | ) is | |
| 66 | self.range = RANGE(location); | |
| 67 | self.severity = severity; | |
| 68 | self.message = message; | |
| 69 | si | |
| 70 | si | |
| 71 | ||
| 72 | class DIAGNOSTIC is | |
| 73 | location: LOCATION; | |
| 74 | severity: DiagnosticSeverity; | |
| 75 | message: string; | |
| 76 | si | |
| 77 | si |