plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
plum-tooling/vscode-plum/src/extension.ts
| 6fc9e6d | 1 | import * as path from "path"; |
| 6fc9e6d | 2 | import { ExtensionContext, workspace } from "vscode"; |
| 6fc9e6d | 3 | import { LanguageClient, LanguageClientOptions, ServerOptions } from "vscode-languageclient/node"; |
| 6fc9e6d | 4 | |
| 6fc9e6d | 5 | let client: LanguageClient | undefined; |
| 6fc9e6d | 6 | |
| 6fc9e6d | 7 | export function activate(context: ExtensionContext) { |
| 6fc9e6d | 8 | const serverPath = path.join( |
| 6fc9e6d | 9 | context.extensionPath, |
| 6fc9e6d | 10 | "server", |
| 6fc9e6d | 11 | process.platform === "win32" ? "plum-lsp.exe" : "plum-lsp", |
| 6fc9e6d | 12 | ); |
| 6fc9e6d | 13 | |
| 6fc9e6d | 14 | // `plum-lsp` falls back to a build-machine-baked default (see |
| 6fc9e6d | 15 | // plum-lsp/src/main.rs) if `--lib-path` isn't given — this setting only |
| 6fc9e6d | 16 | // needs to be set when the workspace's std lib lives somewhere else. |
| 6fc9e6d | 17 | const configuredLibPath = workspace.getConfiguration("plum").get<string>("libPath"); |
| 6fc9e6d | 18 | const args = configuredLibPath ? ["--lib-path", configuredLibPath] : []; |
| 6fc9e6d | 19 | |
| 6fc9e6d | 20 | const serverOptions: ServerOptions = { command: serverPath, args }; |
| 6fc9e6d | 21 | const clientOptions: LanguageClientOptions = { |
| 6fc9e6d | 22 | documentSelector: [{ scheme: "file", language: "plum" }], |
| 6fc9e6d | 23 | }; |
| 6fc9e6d | 24 | |
| 6fc9e6d | 25 | client = new LanguageClient("plum-lsp", "Plum Language Server", serverOptions, clientOptions); |
| 6fc9e6d | 26 | client.start(); |
| 6fc9e6d | 27 | } |
| 6fc9e6d | 28 | |
| 6fc9e6d | 29 | export function deactivate(): Thenable<void> | undefined { |
| 6fc9e6d | 30 | return client?.stop(); |
| 6fc9e6d | 31 | } |