diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-09-05 01:29:11 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-09-06 01:05:24 +0200 |
commit | eb94326bb64552dbd7df62ae201ccca37f368467 (patch) | |
tree | b810f0230ace058cac8a6343455ca60113925221 /subprojects/frontend/src/xtext/XtextClient.ts | |
parent | refactor(frontend): more readable indentation (diff) | |
download | refinery-eb94326bb64552dbd7df62ae201ccca37f368467.tar.gz refinery-eb94326bb64552dbd7df62ae201ccca37f368467.tar.zst refinery-eb94326bb64552dbd7df62ae201ccca37f368467.zip |
feat(frontend): show connection status
Diffstat (limited to 'subprojects/frontend/src/xtext/XtextClient.ts')
-rw-r--r-- | subprojects/frontend/src/xtext/XtextClient.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/subprojects/frontend/src/xtext/XtextClient.ts b/subprojects/frontend/src/xtext/XtextClient.ts index 6351c9fd..c02afb3b 100644 --- a/subprojects/frontend/src/xtext/XtextClient.ts +++ b/subprojects/frontend/src/xtext/XtextClient.ts | |||
@@ -18,7 +18,7 @@ import type { XtextWebPushService } from './xtextMessages'; | |||
18 | const log = getLogger('xtext.XtextClient'); | 18 | const log = getLogger('xtext.XtextClient'); |
19 | 19 | ||
20 | export default class XtextClient { | 20 | export default class XtextClient { |
21 | private readonly webSocketClient: XtextWebSocketClient; | 21 | readonly webSocketClient: XtextWebSocketClient; |
22 | 22 | ||
23 | private readonly updateService: UpdateService; | 23 | private readonly updateService: UpdateService; |
24 | 24 | ||
@@ -32,7 +32,8 @@ export default class XtextClient { | |||
32 | 32 | ||
33 | constructor(store: EditorStore) { | 33 | constructor(store: EditorStore) { |
34 | this.webSocketClient = new XtextWebSocketClient( | 34 | this.webSocketClient = new XtextWebSocketClient( |
35 | () => this.updateService.onReconnect(), | 35 | () => this.onReconnect(), |
36 | () => this.onDisconnect(), | ||
36 | (resource, stateId, service, push) => | 37 | (resource, stateId, service, push) => |
37 | this.onPush(resource, stateId, service, push), | 38 | this.onPush(resource, stateId, service, push), |
38 | ); | 39 | ); |
@@ -46,6 +47,17 @@ export default class XtextClient { | |||
46 | this.occurrencesService = new OccurrencesService(store, this.updateService); | 47 | this.occurrencesService = new OccurrencesService(store, this.updateService); |
47 | } | 48 | } |
48 | 49 | ||
50 | private onReconnect(): void { | ||
51 | this.updateService.onReconnect(); | ||
52 | this.occurrencesService.onReconnect(); | ||
53 | } | ||
54 | |||
55 | private onDisconnect(): void { | ||
56 | this.highlightingService.onDisconnect(); | ||
57 | this.validationService.onDisconnect(); | ||
58 | this.occurrencesService.onDisconnect(); | ||
59 | } | ||
60 | |||
49 | onTransaction(transaction: Transaction): void { | 61 | onTransaction(transaction: Transaction): void { |
50 | // `ContentAssistService.prototype.onTransaction` needs the dirty change desc | 62 | // `ContentAssistService.prototype.onTransaction` needs the dirty change desc |
51 | // _before_ the current edit, so we call it before `updateService`. | 63 | // _before_ the current edit, so we call it before `updateService`. |