plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


plum-tooling/vscode-plum/src/extension.ts
import * as path from "path";
import { ExtensionContext, workspace } from "vscode";
import { LanguageClient, LanguageClientOptions, ServerOptions } from "vscode-languageclient/node";

let client: LanguageClient | undefined;

export function activate(context: ExtensionContext) {
  const serverPath = path.join(
    context.extensionPath,
    "server",
    process.platform === "win32" ? "plum-lsp.exe" : "plum-lsp",
  );

  // `plum-lsp` falls back to a build-machine-baked default (see
  // plum-lsp/src/main.rs) if `--lib-path` isn't given — this setting only
  // needs to be set when the workspace's std lib lives somewhere else.
  const configuredLibPath = workspace.getConfiguration("plum").get<string>("libPath");
  const args = configuredLibPath ? ["--lib-path", configuredLibPath] : [];

  const serverOptions: ServerOptions = { command: serverPath, args };
  const clientOptions: LanguageClientOptions = {
    documentSelector: [{ scheme: "file", language: "plum" }],
  };

  client = new LanguageClient("plum-lsp", "Plum Language Server", serverOptions, clientOptions);
  client.start();
}

export function deactivate(): Thenable<void> | undefined {
  return client?.stop();
}