aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/src/main/js/editor/EditorStore.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <marussy@mit.bme.hu>2021-10-02 16:53:46 +0200
committerLibravatar Kristóf Marussy <marussy@mit.bme.hu>2021-10-02 16:58:31 +0200
commitea509702b6ed88951a1b7b109b5dc597ee81112d (patch)
tree241b9732e7094ef22e7860a9e97a9f67b5b63509 /language-web/src/main/js/editor/EditorStore.ts
parentperf(web): split off CodeMirror chunks (diff)
downloadrefinery-ea509702b6ed88951a1b7b109b5dc597ee81112d.tar.gz
refinery-ea509702b6ed88951a1b7b109b5dc597ee81112d.tar.zst
refinery-ea509702b6ed88951a1b7b109b5dc597ee81112d.zip
feat(web): add client-side logging support
Also modified langauge-web/src/main/js/xtext/ServiceBuilder.js to make sure the new logger is used as soon as xtext is initialized.
Diffstat (limited to 'language-web/src/main/js/editor/EditorStore.ts')
-rw-r--r--language-web/src/main/js/editor/EditorStore.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/language-web/src/main/js/editor/EditorStore.ts b/language-web/src/main/js/editor/EditorStore.ts
index 1ac2e79f..8b9432dd 100644
--- a/language-web/src/main/js/editor/EditorStore.ts
+++ b/language-web/src/main/js/editor/EditorStore.ts
@@ -8,8 +8,11 @@ import {
8import type { IXtextOptions, IXtextServices } from 'xtext/xtext-codemirror'; 8import type { IXtextOptions, IXtextServices } from 'xtext/xtext-codemirror';
9 9
10import type { IEditorChunk } from './editor'; 10import type { IEditorChunk } from './editor';
11import { getLogger } from '../logging';
11import type { ThemeStore } from '../theme/ThemeStore'; 12import type { ThemeStore } from '../theme/ThemeStore';
12 13
14const log = getLogger('EditorStore');
15
13const xtextLang = 'problem'; 16const xtextLang = 'problem';
14 17
15const xtextOptions: IXtextOptions = { 18const xtextOptions: IXtextOptions = {
@@ -52,12 +55,20 @@ export class EditorStore {
52 xtextServices: observable.ref, 55 xtextServices: observable.ref,
53 initialSelection: false, 56 initialSelection: false,
54 }); 57 });
58 this.loadChunk();
59 }
60
61 private loadChunk(): void {
62 const loadingStartMillis = Date.now();
63 log.info('Requesting editor chunk');
55 import('./editor').then(({ editorChunk }) => { 64 import('./editor').then(({ editorChunk }) => {
56 runInAction(() => { 65 runInAction(() => {
57 this.chunk = editorChunk; 66 this.chunk = editorChunk;
58 }); 67 });
68 const loadingDurationMillis = Date.now() - loadingStartMillis;
69 log.info('Loaded editor chunk in', loadingDurationMillis, 'ms');
59 }).catch((error) => { 70 }).catch((error) => {
60 console.warn('Error while loading editor', error); 71 log.error('Error while loading editor', error);
61 }); 72 });
62 } 73 }
63 74