aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/src/main/js/editor/EditorStore.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-10-30 21:56:42 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-10-31 19:26:15 +0100
commit8c90023676fae675e89b1a20c7fc95c63fc1dd5a (patch)
treecef3c3f6716026d1e9998fec8ca9171c6fe478af /language-web/src/main/js/editor/EditorStore.ts
parentfeat(web): use 4 space for indentation (diff)
downloadrefinery-8c90023676fae675e89b1a20c7fc95c63fc1dd5a.tar.gz
refinery-8c90023676fae675e89b1a20c7fc95c63fc1dd5a.tar.zst
refinery-8c90023676fae675e89b1a20c7fc95c63fc1dd5a.zip
feat(web): find occurrences when idle
Diffstat (limited to 'language-web/src/main/js/editor/EditorStore.ts')
-rw-r--r--language-web/src/main/js/editor/EditorStore.ts17
1 files changed, 13 insertions, 4 deletions
diff --git a/language-web/src/main/js/editor/EditorStore.ts b/language-web/src/main/js/editor/EditorStore.ts
index f47f47a0..8788e00f 100644
--- a/language-web/src/main/js/editor/EditorStore.ts
+++ b/language-web/src/main/js/editor/EditorStore.ts
@@ -30,7 +30,6 @@ import {
30 TransactionSpec, 30 TransactionSpec,
31} from '@codemirror/state'; 31} from '@codemirror/state';
32import { 32import {
33 DecorationSet,
34 drawSelection, 33 drawSelection,
35 EditorView, 34 EditorView,
36 highlightActiveLine, 35 highlightActiveLine,
@@ -43,8 +42,13 @@ import {
43 reaction, 42 reaction,
44} from 'mobx'; 43} from 'mobx';
45 44
45import { findOccurrences, IOccurrence, setOccurrences } from './findOccurrences';
46import { problemLanguageSupport } from '../language/problemLanguageSupport'; 46import { problemLanguageSupport } from '../language/problemLanguageSupport';
47import { semanticHighlighting, setSemanticHighlighting } from './semanticHighlighting'; 47import {
48 IHighlightRange,
49 semanticHighlighting,
50 setSemanticHighlighting,
51} from './semanticHighlighting';
48import type { ThemeStore } from '../theme/ThemeStore'; 52import type { ThemeStore } from '../theme/ThemeStore';
49import { getLogger } from '../utils/logger'; 53import { getLogger } from '../utils/logger';
50import { XtextClient } from '../xtext/XtextClient'; 54import { XtextClient } from '../xtext/XtextClient';
@@ -95,6 +99,7 @@ export class EditorStore {
95 EditorView.theme({}, { 99 EditorView.theme({}, {
96 dark: this.themeStore.darkMode, 100 dark: this.themeStore.darkMode,
97 }), 101 }),
102 findOccurrences,
98 highlightActiveLine(), 103 highlightActiveLine(),
99 highlightActiveLineGutter(), 104 highlightActiveLineGutter(),
100 highlightSpecialChars(), 105 highlightSpecialChars(),
@@ -204,8 +209,12 @@ export class EditorStore {
204 return null; 209 return null;
205 } 210 }
206 211
207 updateSemanticHighlighting(decorations: DecorationSet): void { 212 updateSemanticHighlighting(ranges: IHighlightRange[]): void {
208 this.dispatch(setSemanticHighlighting(decorations)); 213 this.dispatch(setSemanticHighlighting(ranges));
214 }
215
216 updateOccurrences(write: IOccurrence[], read: IOccurrence[]): void {
217 this.dispatch(setOccurrences(write, read));
209 } 218 }
210 219
211 /** 220 /**