-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathextension.ts
More file actions
30 lines (27 loc) · 899 Bytes
/
Copy pathextension.ts
File metadata and controls
30 lines (27 loc) · 899 Bytes
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 * as vscode from "vscode";
import { runClient, stopClient } from "./lsp/client";
import { runLanguageServer, stopLanguageServer } from "./lsp/server";
import { findJavaExecutable } from "./utils/utils";
/**
* Starts LiquidJava and reports verifier errors as standard VS Code diagnostics.
*/
export async function activate(context: vscode.ExtensionContext) {
const javaExecutablePath = findJavaExecutable();
if (!javaExecutablePath) {
vscode.window.showErrorMessage("LiquidJava - Java Runtime Not Found in JAVA_HOME or PATH");
return;
}
const port = await runLanguageServer(context, javaExecutablePath);
try {
await runClient(context, port);
} catch {
await stopLanguageServer();
}
}
/**
* Stops the language client and server.
*/
export async function deactivate() {
await stopClient();
await stopLanguageServer();
}