diff options
Diffstat (limited to 'subprojects/frontend/src/editor/DiagnosticValue.ts')
-rw-r--r-- | subprojects/frontend/src/editor/DiagnosticValue.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/subprojects/frontend/src/editor/DiagnosticValue.ts b/subprojects/frontend/src/editor/DiagnosticValue.ts new file mode 100644 index 00000000..ad23c467 --- /dev/null +++ b/subprojects/frontend/src/editor/DiagnosticValue.ts | |||
@@ -0,0 +1,20 @@ | |||
1 | import type { Diagnostic } from '@codemirror/lint'; | ||
2 | import { RangeValue } from '@codemirror/state'; | ||
3 | |||
4 | export default class DiagnosticValue extends RangeValue { | ||
5 | static VALUES: Record<Diagnostic['severity'], DiagnosticValue> = { | ||
6 | error: new DiagnosticValue('error'), | ||
7 | warning: new DiagnosticValue('warning'), | ||
8 | info: new DiagnosticValue('info'), | ||
9 | }; | ||
10 | |||
11 | private constructor(public readonly severity: Diagnostic['severity']) { | ||
12 | super(); | ||
13 | } | ||
14 | |||
15 | override point = true; | ||
16 | |||
17 | override eq(other: RangeValue): boolean { | ||
18 | return other instanceof DiagnosticValue && other.severity === this.severity; | ||
19 | } | ||
20 | } | ||