-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVscodeLanguageClient.affine
More file actions
46 lines (39 loc) · 2.14 KB
/
Copy pathVscodeLanguageClient.affine
File metadata and controls
46 lines (39 loc) · 2.14 KB
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
// SPDX-License-Identifier: PMPL-1.0-or-later
// Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
//
// VscodeLanguageClient.affine — issue #35 Phase 2 bindings for the
// `vscode-languageclient/node` package's Node-side LSP client.
//
// Same conventions as Vscode.affine: opaque handles as Int, host shim
// maintains the JS-side handle table, all imports under the `env`
// namespace.
//
// The 4 LSP types from the issue (LanguageClient + ServerOptions +
// LanguageClientOptions + Executable/TransportKind) collapse to a single
// LanguageClient handle in this binding because the constructor's
// arguments are passed inline as primitives. The host shim builds the
// concrete TS records from those primitives before invoking
// `new LanguageClient(...)`.
module VscodeLanguageClient;
pub extern type LanguageClient;
/// Construct a LanguageClient for an LSP server launched as a subprocess.
/// `id` and `name` identify the client; `command` and `args` (newline-
/// separated) describe how to launch the server; `transport_kind` is 0
/// for stdio, 1 for ipc.
pub extern fn newLanguageClient(id: String,
name: String,
command: String,
args_nl: String,
transport_kind: Int) -> LanguageClient;
pub extern fn languageClientStart(c: LanguageClient) -> Int;
pub extern fn languageClientStop(c: LanguageClient) -> Int;
// ── Async-extern ABI (issue #103) ────────────────────────────────────
// Opaque host handle, declared per-module (these binding modules are
// self-contained; the host erases the type). See stdlib/Vscode.affine.
pub extern type Thenable;
/// `LanguageClient.sendRequest(method, params)` — returns a Thenable of
/// the JSON-encoded response. `params_json` is the request params encoded
/// as a JSON string; the host shim parses it before the LSP call.
pub extern fn languageClientSendRequest(c: LanguageClient,
method: String,
params_json: String) -> Thenable / Async;