-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
extension.ts
46 lines (38 loc) · 999 Bytes
/
extension.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
40
41
42
43
44
45
46
import { connect } from "net";
import {
LanguageClient,
ServerOptions,
type LanguageClientOptions,
type StreamInfo,
} from "vscode-languageclient/node";
let client: LanguageClient;
const ENVY_LANGUAGE_SERVER_SOCKET_PATH = "/tmp/envy_language_server.socket";
export function activate() {
const serverOptions: ServerOptions = () => {
const socket = connect({ path: ENVY_LANGUAGE_SERVER_SOCKET_PATH });
const result: StreamInfo = {
writer: socket,
reader: socket,
};
return Promise.resolve(result);
};
const clientOptions: LanguageClientOptions = {
documentSelector: [
{ scheme: "file", language: "plaintext" },
{ scheme: "file", language: "nv" },
],
};
client = new LanguageClient(
"envyLanguageServer",
"Envy Language Server",
serverOptions,
clientOptions,
);
client.start();
}
export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
}