Files
sx/editors/vscode/src/extension.ts
2026-02-12 16:23:42 +02:00

42 lines
822 B
TypeScript

import {
workspace,
ExtensionContext,
} from "vscode";
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
} from "vscode-languageclient/node";
let client: LanguageClient;
export function activate(context: ExtensionContext) {
const config = workspace.getConfiguration("sx");
const lspPath = config.get<string>("lspPath", "sx");
const serverOptions: ServerOptions = {
command: lspPath,
args: ["lsp"],
};
const clientOptions: LanguageClientOptions = {
documentSelector: [{ scheme: "file", language: "sx" }],
};
client = new LanguageClient(
"sx-lsp",
"sx Language Server",
serverOptions,
clientOptions
);
client.start();
}
export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
}