aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/src/main/js/xtext/ContentAssistService.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-11-16 03:00:45 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-11-16 03:11:00 +0100
commit5810a7eb3b19ef9868db170c9214686bfc613eee (patch)
treeda122997d4ad58f4104d0f84b06a00fe14e7ad02 /language-web/src/main/js/xtext/ContentAssistService.ts
parentfeat(lang): basic formatting (diff)
downloadrefinery-5810a7eb3b19ef9868db170c9214686bfc613eee.tar.gz
refinery-5810a7eb3b19ef9868db170c9214686bfc613eee.tar.zst
refinery-5810a7eb3b19ef9868db170c9214686bfc613eee.zip
chore(web): json validation with zod
Use the zod library instead of manually written type assertions for validating json messages from the server. This makes it easier to add and handle new messages.
Diffstat (limited to 'language-web/src/main/js/xtext/ContentAssistService.ts')
-rw-r--r--language-web/src/main/js/xtext/ContentAssistService.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/language-web/src/main/js/xtext/ContentAssistService.ts b/language-web/src/main/js/xtext/ContentAssistService.ts
index aa9a80b0..8b872e06 100644
--- a/language-web/src/main/js/xtext/ContentAssistService.ts
+++ b/language-web/src/main/js/xtext/ContentAssistService.ts
@@ -10,7 +10,7 @@ import escapeStringRegexp from 'escape-string-regexp';
10import { implicitCompletion } from '../language/props'; 10import { implicitCompletion } from '../language/props';
11import type { UpdateService } from './UpdateService'; 11import type { UpdateService } from './UpdateService';
12import { getLogger } from '../utils/logger'; 12import { getLogger } from '../utils/logger';
13import type { IContentAssistEntry } from './xtextServiceResults'; 13import type { ContentAssistEntry } from './xtextServiceResults';
14 14
15const PROPOSALS_LIMIT = 1000; 15const PROPOSALS_LIMIT = 1000;
16 16
@@ -67,8 +67,8 @@ function computeSpan(prefix: string, entryCount: number): RegExp {
67 return new RegExp(`^${escapedPrefix}$`); 67 return new RegExp(`^${escapedPrefix}$`);
68} 68}
69 69
70function createCompletion(entry: IContentAssistEntry): Completion { 70function createCompletion(entry: ContentAssistEntry): Completion {
71 let boost; 71 let boost: number;
72 switch (entry.kind) { 72 switch (entry.kind) {
73 case 'KEYWORD': 73 case 'KEYWORD':
74 // Some hard-to-type operators should be on top. 74 // Some hard-to-type operators should be on top.