blob: 410a46b711fb742a17ec25ef75fa5f37a6b33a02 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
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'),
hint: new DiagnosticValue('hint'),
};
private constructor(public readonly severity: Severity) {
super();
}
override point = true;
override eq(other: RangeValue): boolean {
return other instanceof DiagnosticValue && other.severity === this.severity;
}
}
|