diff options
author | 2021-11-16 03:00:45 +0100 | |
---|---|---|
committer | 2021-11-16 03:11:00 +0100 | |
commit | 5810a7eb3b19ef9868db170c9214686bfc613eee (patch) | |
tree | da122997d4ad58f4104d0f84b06a00fe14e7ad02 /language-web/src/main/js/xtext/ContentAssistService.ts | |
parent | feat(lang): basic formatting (diff) | |
download | refinery-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.ts | 6 |
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'; | |||
10 | import { implicitCompletion } from '../language/props'; | 10 | import { implicitCompletion } from '../language/props'; |
11 | import type { UpdateService } from './UpdateService'; | 11 | import type { UpdateService } from './UpdateService'; |
12 | import { getLogger } from '../utils/logger'; | 12 | import { getLogger } from '../utils/logger'; |
13 | import type { IContentAssistEntry } from './xtextServiceResults'; | 13 | import type { ContentAssistEntry } from './xtextServiceResults'; |
14 | 14 | ||
15 | const PROPOSALS_LIMIT = 1000; | 15 | const 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 | ||
70 | function createCompletion(entry: IContentAssistEntry): Completion { | 70 | function 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. |