blob: b4e0b1656cb03a6798b6d586c854de8bdb202040 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import type { Diagnostic } from '@codemirror/lint';
import { RangeValue } from '@codemirror/state';
export type Severity = Diagnostic['severity'];
export default class DiagnosticValue extends RangeValue {
static VALUES: Record<Severity, DiagnosticValue> = {
error: new DiagnosticValue('error'),
warning: new DiagnosticValue('warning'),
info: new DiagnosticValue('info'),
};
private constructor(public readonly severity: Severity) {
super();
}
override point = true;
override eq(other: RangeValue): boolean {
return other instanceof DiagnosticValue && other.severity === this.severity;
}
}
|