diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-08-12 19:54:46 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-08-12 19:54:46 +0200 |
commit | d22c3b0c257f5daf5b401988a35ab9ce981a2341 (patch) | |
tree | 0a661c927c37b52197326d1c05e211daf9bd19e5 /subprojects/frontend/src/editor/findOccurrences.ts | |
parent | fix(language): rule parsing test (diff) | |
download | refinery-d22c3b0c257f5daf5b401988a35ab9ce981a2341.tar.gz refinery-d22c3b0c257f5daf5b401988a35ab9ce981a2341.tar.zst refinery-d22c3b0c257f5daf5b401988a35ab9ce981a2341.zip |
refactor(frontend): move from Webpack to Vite
Also overhaulds the building and linting for frontend assets.
Diffstat (limited to 'subprojects/frontend/src/editor/findOccurrences.ts')
-rw-r--r-- | subprojects/frontend/src/editor/findOccurrences.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/subprojects/frontend/src/editor/findOccurrences.ts b/subprojects/frontend/src/editor/findOccurrences.ts index c4a4e8ec..d7aae8d1 100644 --- a/subprojects/frontend/src/editor/findOccurrences.ts +++ b/subprojects/frontend/src/editor/findOccurrences.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Range, RangeSet, type TransactionSpec } from '@codemirror/state'; | 1 | import { type Range, RangeSet, type TransactionSpec } from '@codemirror/state'; |
2 | import { Decoration } from '@codemirror/view'; | 2 | import { Decoration } from '@codemirror/view'; |
3 | 3 | ||
4 | import { decorationSetExtension } from './decorationSetExtension'; | 4 | import defineDecorationSetExtension from './defineDecorationSetExtension'; |
5 | 5 | ||
6 | export interface IOccurrence { | 6 | export interface IOccurrence { |
7 | from: number; | 7 | from: number; |
@@ -9,7 +9,7 @@ export interface IOccurrence { | |||
9 | to: number; | 9 | to: number; |
10 | } | 10 | } |
11 | 11 | ||
12 | const [setOccurrencesInteral, findOccurrences] = decorationSetExtension(); | 12 | const [setOccurrencesInteral, findOccurrences] = defineDecorationSetExtension(); |
13 | 13 | ||
14 | const writeDecoration = Decoration.mark({ | 14 | const writeDecoration = Decoration.mark({ |
15 | class: 'cm-problem-write', | 15 | class: 'cm-problem-write', |
@@ -19,7 +19,10 @@ const readDecoration = Decoration.mark({ | |||
19 | class: 'cm-problem-read', | 19 | class: 'cm-problem-read', |
20 | }); | 20 | }); |
21 | 21 | ||
22 | export function setOccurrences(write: IOccurrence[], read: IOccurrence[]): TransactionSpec { | 22 | export function setOccurrences( |
23 | write: IOccurrence[], | ||
24 | read: IOccurrence[], | ||
25 | ): TransactionSpec { | ||
23 | const decorations: Range<Decoration>[] = []; | 26 | const decorations: Range<Decoration>[] = []; |
24 | write.forEach(({ from, to }) => { | 27 | write.forEach(({ from, to }) => { |
25 | decorations.push(writeDecoration.range(from, to)); | 28 | decorations.push(writeDecoration.range(from, to)); |
@@ -31,4 +34,4 @@ export function setOccurrences(write: IOccurrence[], read: IOccurrence[]): Trans | |||
31 | return setOccurrencesInteral(rangeSet); | 34 | return setOccurrencesInteral(rangeSet); |
32 | } | 35 | } |
33 | 36 | ||
34 | export { findOccurrences }; | 37 | export default findOccurrences; |