diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-10-30 21:56:42 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-10-31 19:26:15 +0100 |
commit | 8c90023676fae675e89b1a20c7fc95c63fc1dd5a (patch) | |
tree | cef3c3f6716026d1e9998fec8ca9171c6fe478af /language-web/src/main/js/editor/EditorStore.ts | |
parent | feat(web): use 4 space for indentation (diff) | |
download | refinery-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.ts | 17 |
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'; |
32 | import { | 32 | import { |
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 | ||
45 | import { findOccurrences, IOccurrence, setOccurrences } from './findOccurrences'; | ||
46 | import { problemLanguageSupport } from '../language/problemLanguageSupport'; | 46 | import { problemLanguageSupport } from '../language/problemLanguageSupport'; |
47 | import { semanticHighlighting, setSemanticHighlighting } from './semanticHighlighting'; | 47 | import { |
48 | IHighlightRange, | ||
49 | semanticHighlighting, | ||
50 | setSemanticHighlighting, | ||
51 | } from './semanticHighlighting'; | ||
48 | import type { ThemeStore } from '../theme/ThemeStore'; | 52 | import type { ThemeStore } from '../theme/ThemeStore'; |
49 | import { getLogger } from '../utils/logger'; | 53 | import { getLogger } from '../utils/logger'; |
50 | import { XtextClient } from '../xtext/XtextClient'; | 54 | import { 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 | /** |