diff options
author | 2021-11-16 16:47:58 +0100 | |
---|---|---|
committer | 2021-11-16 16:47:58 +0100 | |
commit | 11cbae607b5a6f59f5a019b7eb525da689d2bb30 (patch) | |
tree | c40e4af57988becdcf7d363a2fb7107f668b8ba0 /language-web/src/main/js/editor/EditorStore.ts | |
parent | chore(web): json validation with zod (diff) | |
download | refinery-11cbae607b5a6f59f5a019b7eb525da689d2bb30.tar.gz refinery-11cbae607b5a6f59f5a019b7eb525da689d2bb30.tar.zst refinery-11cbae607b5a6f59f5a019b7eb525da689d2bb30.zip |
feat(web): xtext formatter client
Uses the xtext formatted on the server to format the document.
Also adds the capability to take (delta) changes from the server and
apply them before any pending local changes, then replay the changes.
This means that the server-side formatter is effectively acting as a
second user who is editing the document.
Diffstat (limited to 'language-web/src/main/js/editor/EditorStore.ts')
-rw-r--r-- | language-web/src/main/js/editor/EditorStore.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/language-web/src/main/js/editor/EditorStore.ts b/language-web/src/main/js/editor/EditorStore.ts index 059233f4..5760de28 100644 --- a/language-web/src/main/js/editor/EditorStore.ts +++ b/language-web/src/main/js/editor/EditorStore.ts | |||
@@ -115,6 +115,7 @@ export class EditorStore { | |||
115 | lineNumbers(), | 115 | lineNumbers(), |
116 | foldGutter(), | 116 | foldGutter(), |
117 | keymap.of([ | 117 | keymap.of([ |
118 | { key: 'Mod-Shift-f', run: () => this.formatText() }, | ||
118 | ...closeBracketsKeymap, | 119 | ...closeBracketsKeymap, |
119 | ...commentKeymap, | 120 | ...commentKeymap, |
120 | ...completionKeymap, | 121 | ...completionKeymap, |
@@ -280,4 +281,9 @@ export class EditorStore { | |||
280 | toggleLintPanel(): void { | 281 | toggleLintPanel(): void { |
281 | this.setLintPanelOpen(!this.showLintPanel); | 282 | this.setLintPanelOpen(!this.showLintPanel); |
282 | } | 283 | } |
284 | |||
285 | formatText(): boolean { | ||
286 | this.client.formatText(); | ||
287 | return true; | ||
288 | } | ||
283 | } | 289 | } |