diff options
Diffstat (limited to 'subprojects/frontend/src/xtext')
-rw-r--r-- | subprojects/frontend/src/xtext/HighlightingService.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/subprojects/frontend/src/xtext/HighlightingService.ts b/subprojects/frontend/src/xtext/HighlightingService.ts index 447f1401..eacee117 100644 --- a/subprojects/frontend/src/xtext/HighlightingService.ts +++ b/subprojects/frontend/src/xtext/HighlightingService.ts | |||
@@ -10,6 +10,8 @@ import type { IHighlightRange } from '../editor/semanticHighlighting'; | |||
10 | import type UpdateService from './UpdateService'; | 10 | import type UpdateService from './UpdateService'; |
11 | import { highlightingResult } from './xtextServiceResults'; | 11 | import { highlightingResult } from './xtextServiceResults'; |
12 | 12 | ||
13 | const TYPE_HASH_HEX_PREFIX = 'typeHash-_'; | ||
14 | |||
13 | export default class HighlightingService { | 15 | export default class HighlightingService { |
14 | constructor( | 16 | constructor( |
15 | private readonly store: EditorStore, | 17 | private readonly store: EditorStore, |
@@ -20,6 +22,7 @@ export default class HighlightingService { | |||
20 | const { regions } = highlightingResult.parse(push); | 22 | const { regions } = highlightingResult.parse(push); |
21 | const allChanges = this.updateService.computeChangesSinceLastUpdate(); | 23 | const allChanges = this.updateService.computeChangesSinceLastUpdate(); |
22 | const ranges: IHighlightRange[] = []; | 24 | const ranges: IHighlightRange[] = []; |
25 | const hexTypeHashes = new Set<string>(); | ||
23 | regions.forEach(({ offset, length, styleClasses }) => { | 26 | regions.forEach(({ offset, length, styleClasses }) => { |
24 | if (styleClasses.length === 0) { | 27 | if (styleClasses.length === 0) { |
25 | return; | 28 | return; |
@@ -34,11 +37,16 @@ export default class HighlightingService { | |||
34 | to, | 37 | to, |
35 | classes: styleClasses, | 38 | classes: styleClasses, |
36 | }); | 39 | }); |
40 | styleClasses.forEach((styleClass) => { | ||
41 | if (styleClass.startsWith(TYPE_HASH_HEX_PREFIX)) { | ||
42 | hexTypeHashes.add(styleClass.substring(TYPE_HASH_HEX_PREFIX.length)); | ||
43 | } | ||
44 | }); | ||
37 | }); | 45 | }); |
38 | this.store.updateSemanticHighlighting(ranges); | 46 | this.store.updateSemanticHighlighting(ranges, Array.from(hexTypeHashes)); |
39 | } | 47 | } |
40 | 48 | ||
41 | onDisconnect(): void { | 49 | onDisconnect(): void { |
42 | this.store.updateSemanticHighlighting([]); | 50 | this.store.updateSemanticHighlighting([], []); |
43 | } | 51 | } |
44 | } | 52 | } |