From ffe5b08149681f51625bdac43c7ab41ccf5f9cc3 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Tue, 1 Nov 2022 12:05:21 -0400 Subject: feat(frontend): scrollbar annotations --- subprojects/frontend/src/editor/DiagnosticValue.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 subprojects/frontend/src/editor/DiagnosticValue.ts (limited to 'subprojects/frontend/src/editor/DiagnosticValue.ts') 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 @@ +import type { Diagnostic } from '@codemirror/lint'; +import { RangeValue } from '@codemirror/state'; + +export default class DiagnosticValue extends RangeValue { + static VALUES: Record = { + error: new DiagnosticValue('error'), + warning: new DiagnosticValue('warning'), + info: new DiagnosticValue('info'), + }; + + private constructor(public readonly severity: Diagnostic['severity']) { + super(); + } + + override point = true; + + override eq(other: RangeValue): boolean { + return other instanceof DiagnosticValue && other.severity === this.severity; + } +} -- cgit v1.2.3-54-g00ecf