aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/src/main/js/xtext/HighlightingService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'language-web/src/main/js/xtext/HighlightingService.ts')
-rw-r--r--language-web/src/main/js/xtext/HighlightingService.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/language-web/src/main/js/xtext/HighlightingService.ts b/language-web/src/main/js/xtext/HighlightingService.ts
index b8ceed20..451a3a52 100644
--- a/language-web/src/main/js/xtext/HighlightingService.ts
+++ b/language-web/src/main/js/xtext/HighlightingService.ts
@@ -1,7 +1,5 @@
1import { Decoration } from '@codemirror/view';
2import { Range, RangeSet } from '@codemirror/rangeset';
3
4import type { EditorStore } from '../editor/EditorStore'; 1import type { EditorStore } from '../editor/EditorStore';
2import type { IHighlightRange } from '../editor/semanticHighlighting';
5import type { UpdateService } from './UpdateService'; 3import type { UpdateService } from './UpdateService';
6import { getLogger } from '../utils/logger'; 4import { getLogger } from '../utils/logger';
7import { isHighlightingResult } from './xtextServiceResults'; 5import { isHighlightingResult } from './xtextServiceResults';
@@ -24,7 +22,7 @@ export class HighlightingService {
24 return; 22 return;
25 } 23 }
26 const allChanges = this.updateService.computeChangesSinceLastUpdate(); 24 const allChanges = this.updateService.computeChangesSinceLastUpdate();
27 const decorations: Range<Decoration>[] = []; 25 const ranges: IHighlightRange[] = [];
28 push.regions.forEach(({ offset, length, styleClasses }) => { 26 push.regions.forEach(({ offset, length, styleClasses }) => {
29 if (styleClasses.length === 0) { 27 if (styleClasses.length === 0) {
30 return; 28 return;
@@ -34,10 +32,12 @@ export class HighlightingService {
34 if (to <= from) { 32 if (to <= from) {
35 return; 33 return;
36 } 34 }
37 decorations.push(Decoration.mark({ 35 ranges.push({
38 class: styleClasses.map((c) => `cmt-problem-${c}`).join(' '), 36 from,
39 }).range(from, to)); 37 to,
38 classes: styleClasses,
39 });
40 }); 40 });
41 this.store.updateSemanticHighlighting(RangeSet.of(decorations, true)); 41 this.store.updateSemanticHighlighting(ranges);
42 } 42 }
43} 43}