-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathclient.ts
30 lines (23 loc) · 1.01 KB
/
client.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import "ace-code/esm-resolver";
import {jsonContent} from "../docs-example/json-example";
import {json5Content, json5Schema} from "../docs-example/json5-example";
import {addFormatCommand, createEditorWithLSP} from "../utils";
import {AceLanguageClient} from "ace-linters/build/ace-language-client";
import {LanguageClientConfig} from "ace-linters/types/types/language-service";
let modes = [
{name: "json", mode: "ace/mode/json", content: jsonContent, options: {jsonSchemaUri: "common-form.schema.json"}},
{name: "json5", mode: "ace/mode/json5", content: json5Content, options: {jsonSchemaUri: json5Schema}},
]
const serverData: LanguageClientConfig = {
module: () => import("ace-linters/build/language-client"),
modes: "json|json5",
type: "socket",
socket: new WebSocket("ws://127.0.0.1:3000/exampleServer"),
}
let languageProvider = AceLanguageClient.for(serverData);
let i = 0;
for (let mode of modes) {
createEditorWithLSP(mode, i, languageProvider);
i++;
}
addFormatCommand(languageProvider);