forked from xiaoxustudio/webgal-for-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.ts
39 lines (38 loc) · 1.02 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
31
32
33
34
35
36
37
38
39
/*
* @Author: xuranXYS
* @LastEditTime: 2024-03-30 21:40:26
* @GitHub: www.github.com/xiaoxustudio
* @WebSite: www.xiaoxustudio.top
* @Description: By xuranXYS
*/
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind,
} from "vscode-languageclient/node";
import { ExtensionContext, workspace } from "vscode";
import path from "path";
import { selector } from "./utils/utils";
export function create_client(context: ExtensionContext): LanguageClient {
const serverModule = context.asAbsolutePath(path.join("out", "server.js"));
const serverOptions: ServerOptions = {
run: { module: serverModule, transport: TransportKind.ipc },
debug: {
module: serverModule,
transport: TransportKind.ipc,
},
};
const clientOptions: LanguageClientOptions = {
documentSelector: [selector],
synchronize: {
fileEvents: workspace.createFileSystemWatcher("**/.clientrc"),
},
};
return new LanguageClient(
"XRWEBGALlanguageServer",
"XR WEBGAL Language Server",
serverOptions,
clientOptions
);
}