@hydranium/protocol 1.0.0-next.39 → 1.0.0-next.391
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -83
- package/lib/abstract-logger.d.ts +11 -0
- package/lib/abstract-logger.d.ts.map +1 -1
- package/lib/abstract-logger.js +16 -0
- package/lib/abstract-logger.js.map +1 -1
- package/lib/client/data-connection.d.ts +303 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +534 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +11 -2
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +13 -1
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +34 -24
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +762 -89
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +1253 -115
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +16 -9
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +16 -9
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +6 -4
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +4 -4
- package/lib/client/message-relay.js.map +1 -1
- package/lib/client/post-message-transport.d.ts +69 -3
- package/lib/client/post-message-transport.d.ts.map +1 -1
- package/lib/client/post-message-transport.js +175 -1
- package/lib/client/post-message-transport.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +173 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +225 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/client/worker-handshake.d.ts +94 -0
- package/lib/client/worker-handshake.d.ts.map +1 -0
- package/lib/client/worker-handshake.js +51 -0
- package/lib/client/worker-handshake.js.map +1 -0
- package/lib/client/working-copy.d.ts +420 -0
- package/lib/client/working-copy.d.ts.map +1 -0
- package/lib/client/working-copy.js +958 -0
- package/lib/client/working-copy.js.map +1 -0
- package/lib/client-ids.d.ts +45 -0
- package/lib/client-ids.d.ts.map +1 -0
- package/lib/client-ids.js +48 -0
- package/lib/client-ids.js.map +1 -0
- package/lib/clock.d.ts +50 -10
- package/lib/clock.d.ts.map +1 -1
- package/lib/clock.js +36 -1
- package/lib/clock.js.map +1 -1
- package/lib/console-logger.d.ts +23 -0
- package/lib/console-logger.d.ts.map +1 -0
- package/lib/console-logger.js +39 -0
- package/lib/console-logger.js.map +1 -0
- package/lib/data/data-protocol-methods.d.ts +4 -4
- package/lib/data/data-protocol-methods.d.ts.map +1 -1
- package/lib/data/data-protocol-methods.js +7 -0
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +160 -50
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +75 -31
- package/lib/data/events.d.ts.map +1 -1
- package/lib/data/requests.d.ts +84 -11
- package/lib/data/requests.d.ts.map +1 -1
- package/lib/debouncer.d.ts +7 -4
- package/lib/debouncer.d.ts.map +1 -1
- package/lib/debouncer.js +10 -10
- package/lib/debouncer.js.map +1 -1
- package/lib/errors.d.ts +241 -48
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +395 -60
- package/lib/errors.js.map +1 -1
- package/lib/format-log-arg.d.ts +33 -0
- package/lib/format-log-arg.d.ts.map +1 -0
- package/lib/format-log-arg.js +158 -0
- package/lib/format-log-arg.js.map +1 -0
- package/lib/glsp-edits-settled-actions.d.ts +54 -0
- package/lib/glsp-edits-settled-actions.d.ts.map +1 -0
- package/lib/glsp-edits-settled-actions.js +28 -0
- package/lib/glsp-edits-settled-actions.js.map +1 -0
- package/lib/glsp-request-model-args.d.ts +16 -0
- package/lib/glsp-request-model-args.d.ts.map +1 -0
- package/lib/glsp-request-model-args.js +19 -0
- package/lib/glsp-request-model-args.js.map +1 -0
- package/lib/glsp-save-model-actions.d.ts +55 -0
- package/lib/glsp-save-model-actions.d.ts.map +1 -0
- package/lib/glsp-save-model-actions.js +28 -0
- package/lib/glsp-save-model-actions.js.map +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -1
- package/lib/latency-collector.d.ts +10 -4
- package/lib/latency-collector.d.ts.map +1 -1
- package/lib/latency-collector.js +2 -0
- package/lib/latency-collector.js.map +1 -1
- package/lib/logger.d.ts +38 -7
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +42 -4
- package/lib/logger.js.map +1 -1
- package/lib/messages/index.d.ts +4 -2
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +17 -4
- package/lib/messages/index.js.map +1 -1
- package/lib/messages/primitives.d.ts +59 -4
- package/lib/messages/primitives.d.ts.map +1 -1
- package/lib/messages/primitives.js +97 -4
- package/lib/messages/primitives.js.map +1 -1
- package/lib/model-server.d.ts +58 -11
- package/lib/model-server.d.ts.map +1 -1
- package/lib/model-server.js +4 -2
- package/lib/model-server.js.map +1 -1
- package/lib/model-service/base-version.d.ts +67 -0
- package/lib/model-service/base-version.d.ts.map +1 -0
- package/lib/model-service/base-version.js +44 -0
- package/lib/model-service/base-version.js.map +1 -0
- package/lib/model-service/index.d.ts +1 -1
- package/lib/model-service/index.d.ts.map +1 -1
- package/lib/model-service/index.js +4 -5
- package/lib/model-service/index.js.map +1 -1
- package/lib/model-service/reference-candidate.d.ts +5 -3
- package/lib/model-service/reference-candidate.d.ts.map +1 -1
- package/lib/node/index.d.ts +10 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +29 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/process-memory.d.ts +66 -0
- package/lib/node/process-memory.d.ts.map +1 -0
- package/lib/node/process-memory.js +291 -0
- package/lib/node/process-memory.js.map +1 -0
- package/lib/noop-logger.d.ts.map +1 -1
- package/lib/noop-logger.js.map +1 -1
- package/lib/observable-value.js.map +1 -1
- package/lib/patch-merge.d.ts +63 -35
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +171 -25
- package/lib/patch-merge.js.map +1 -1
- package/lib/pending-work-tracker.d.ts +33 -0
- package/lib/pending-work-tracker.d.ts.map +1 -0
- package/lib/pending-work-tracker.js +48 -0
- package/lib/pending-work-tracker.js.map +1 -0
- package/lib/profile-session.d.ts +24 -8
- package/lib/profile-session.d.ts.map +1 -1
- package/lib/profile-session.js +13 -4
- package/lib/profile-session.js.map +1 -1
- package/lib/profiling.d.ts +15 -2
- package/lib/profiling.d.ts.map +1 -1
- package/lib/profiling.js.map +1 -1
- package/lib/project.d.ts +6 -2
- package/lib/project.d.ts.map +1 -1
- package/lib/project.js.map +1 -1
- package/lib/random-uuid.d.ts +14 -0
- package/lib/random-uuid.d.ts.map +1 -0
- package/lib/random-uuid.js +24 -0
- package/lib/random-uuid.js.map +1 -0
- package/lib/reconcile-write.d.ts +70 -0
- package/lib/reconcile-write.d.ts.map +1 -0
- package/lib/reconcile-write.js +69 -0
- package/lib/reconcile-write.js.map +1 -0
- package/lib/rpc/bind-rpc-methods.d.ts +6 -2
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +17 -7
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +3 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +6 -1
- package/lib/rpc/create-rpc-proxy.js.map +1 -1
- package/lib/rpc/index.d.ts +1 -0
- package/lib/rpc/index.d.ts.map +1 -1
- package/lib/rpc/index.js +1 -0
- package/lib/rpc/index.js.map +1 -1
- package/lib/rpc/send-by-method-name.d.ts +76 -0
- package/lib/rpc/send-by-method-name.d.ts.map +1 -0
- package/lib/rpc/send-by-method-name.js +120 -0
- package/lib/rpc/send-by-method-name.js.map +1 -0
- package/lib/rpc/wire-prefix.js.map +1 -1
- package/lib/save-text-document.d.ts +40 -0
- package/lib/save-text-document.d.ts.map +1 -0
- package/lib/save-text-document.js +34 -0
- package/lib/save-text-document.js.map +1 -0
- package/lib/testing/catalogue-audit.js.map +1 -1
- package/lib/testing/data-doubles.d.ts +36 -11
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +47 -9
- package/lib/testing/data-doubles.js.map +1 -1
- package/lib/testing/fake-clock.d.ts +17 -2
- package/lib/testing/fake-clock.d.ts.map +1 -1
- package/lib/testing/fake-clock.js +61 -46
- package/lib/testing/fake-clock.js.map +1 -1
- package/lib/testing/harness.d.ts +9 -0
- package/lib/testing/harness.d.ts.map +1 -1
- package/lib/testing/index.d.ts +1 -0
- package/lib/testing/index.d.ts.map +1 -1
- package/lib/testing/index.js +4 -3
- package/lib/testing/index.js.map +1 -1
- package/lib/testing/node/duplex-connection.d.ts.map +1 -1
- package/lib/testing/node/duplex-connection.js +3 -2
- package/lib/testing/node/duplex-connection.js.map +1 -1
- package/lib/testing/node/duplex-stream.js.map +1 -1
- package/lib/testing/node/index.d.ts +2 -0
- package/lib/testing/node/index.d.ts.map +1 -1
- package/lib/testing/node/index.js +3 -2
- package/lib/testing/node/index.js.map +1 -1
- package/lib/testing/node/message-port-pair.d.ts +25 -0
- package/lib/testing/node/message-port-pair.d.ts.map +1 -0
- package/lib/testing/node/message-port-pair.js +26 -0
- package/lib/testing/node/message-port-pair.js.map +1 -0
- package/lib/testing/node/unhandled-rejections.d.ts +20 -0
- package/lib/testing/node/unhandled-rejections.d.ts.map +1 -0
- package/lib/testing/node/unhandled-rejections.js +35 -0
- package/lib/testing/node/unhandled-rejections.js.map +1 -0
- package/lib/testing/transfer-node-builder.d.ts +81 -0
- package/lib/testing/transfer-node-builder.d.ts.map +1 -0
- package/lib/testing/transfer-node-builder.js +47 -0
- package/lib/testing/transfer-node-builder.js.map +1 -0
- package/lib/testing/wait-for.d.ts +9 -3
- package/lib/testing/wait-for.d.ts.map +1 -1
- package/lib/testing/wait-for.js +57 -11
- package/lib/testing/wait-for.js.map +1 -1
- package/lib/tracer.d.ts.map +1 -1
- package/lib/tracer.js +5 -9
- package/lib/tracer.js.map +1 -1
- package/lib/transfer-diagnostic.d.ts +11 -0
- package/lib/transfer-diagnostic.d.ts.map +1 -1
- package/lib/transfer-diagnostic.js +17 -0
- package/lib/transfer-diagnostic.js.map +1 -1
- package/lib/transfer-document.d.ts +108 -32
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js +17 -9
- package/lib/transfer-document.js.map +1 -1
- package/lib/transfer-element.d.ts +4 -4
- package/lib/types.d.ts +32 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/{model-service/args.js → types.js} +2 -2
- package/lib/types.js.map +1 -0
- package/lib/uri.d.ts.map +1 -1
- package/lib/uri.js.map +1 -1
- package/lib/util.d.ts +8 -2
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +32 -4
- package/lib/util.js.map +1 -1
- package/package.json +24 -40
- package/src/abstract-logger.ts +18 -0
- package/src/client/data-connection.ts +654 -0
- package/src/client/data-events.ts +15 -1
- package/src/client/data-port.ts +36 -25
- package/src/client/data-session.ts +1606 -137
- package/src/client/index.ts +16 -9
- package/src/client/message-relay.ts +6 -4
- package/src/client/post-message-transport.ts +224 -4
- package/src/client/rpc-connection.ts +302 -0
- package/src/client/worker-handshake.ts +121 -0
- package/src/client/working-copy.ts +1116 -0
- package/src/client-ids.ts +49 -0
- package/src/clock.ts +68 -10
- package/src/console-logger.ts +39 -0
- package/src/data/data-protocol-methods.ts +8 -1
- package/src/data/data-server-protocol.ts +184 -49
- package/src/data/events.ts +77 -31
- package/src/data/requests.ts +90 -11
- package/src/debouncer.ts +11 -11
- package/src/errors.ts +496 -71
- package/src/format-log-arg.ts +176 -0
- package/src/glsp-edits-settled-actions.ts +62 -0
- package/src/glsp-request-model-args.ts +16 -0
- package/src/glsp-save-model-actions.ts +64 -0
- package/src/index.ts +11 -0
- package/src/latency-collector.ts +10 -3
- package/src/logger.ts +44 -8
- package/src/messages/index.ts +12 -2
- package/src/messages/primitives.ts +129 -5
- package/src/model-server.ts +62 -17
- package/src/model-service/base-version.ts +75 -0
- package/src/model-service/index.ts +4 -5
- package/src/model-service/reference-candidate.ts +5 -3
- package/src/node/index.ts +14 -0
- package/src/node/process-memory.ts +299 -0
- package/src/patch-merge.ts +230 -45
- package/src/pending-work-tracker.ts +48 -0
- package/src/profile-session.ts +31 -11
- package/src/profiling.ts +15 -2
- package/src/project.ts +6 -2
- package/src/random-uuid.ts +21 -0
- package/src/reconcile-write.ts +131 -0
- package/src/rpc/README.md +6 -6
- package/src/rpc/bind-rpc-methods.ts +18 -8
- package/src/rpc/create-rpc-proxy.ts +6 -1
- package/src/rpc/index.ts +1 -0
- package/src/rpc/send-by-method-name.ts +140 -0
- package/src/save-text-document.ts +39 -0
- package/src/testing/data-doubles.ts +119 -19
- package/src/testing/fake-clock.ts +76 -48
- package/src/testing/harness.ts +10 -0
- package/src/testing/index.ts +4 -3
- package/src/testing/node/duplex-connection.ts +3 -2
- package/src/testing/node/index.ts +3 -2
- package/src/testing/node/message-port-pair.ts +40 -0
- package/src/testing/node/unhandled-rejections.ts +31 -0
- package/src/testing/transfer-node-builder.ts +107 -0
- package/src/testing/wait-for.ts +61 -13
- package/src/tracer.ts +5 -9
- package/src/transfer-diagnostic.ts +17 -0
- package/src/transfer-document.ts +130 -34
- package/src/transfer-element.ts +4 -4
- package/src/types.ts +30 -0
- package/src/util.ts +33 -6
- package/lib/model-service/args.d.ts +0 -64
- package/lib/model-service/args.d.ts.map +0 -1
- package/lib/model-service/args.js.map +0 -1
- package/src/model-service/args.ts +0 -67
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Well-known values of the wire's `clientId` / `sourceClientId` field.
|
|
12
|
+
*
|
|
13
|
+
* The framework tracks each document as belonging to one or more "clients" —
|
|
14
|
+
* typically an LSP-text client (Monaco, VS Code, …), a GLSP diagram client,
|
|
15
|
+
* and/or a structured-form client — and keys its holds and watches per
|
|
16
|
+
* `(uri, clientId)`. These three values are not real participants, so a client
|
|
17
|
+
* minting its own id must avoid them.
|
|
18
|
+
*
|
|
19
|
+
* **Here rather than in the server package, because the side that has to
|
|
20
|
+
* RECOGNISE them is the client.** An inbound `onDocumentUpdated` carries
|
|
21
|
+
* `sourceClientId`, and a consumer deciding what to do with it is asking which
|
|
22
|
+
* of these it is — so a frontend would otherwise have to depend on the server
|
|
23
|
+
* tier to name three strings, and in practice retypes the literal instead.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** Identifier for an LSP-text client (Monaco, VS Code, …). */
|
|
27
|
+
export const LANGUAGE_CLIENT_ID = 'language-client';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The id an event names when no single client is behind it: the source of a
|
|
31
|
+
* `'rebuilt'` event, a document no client authored, or a build with more than
|
|
32
|
+
* one cause.
|
|
33
|
+
*/
|
|
34
|
+
export const UNKNOWN_CLIENT_ID = 'unknown';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Synthetic author id on the `onDocumentUpdated` broadcast a data-server
|
|
38
|
+
* emits for the build that follows a document's release, once no client holds
|
|
39
|
+
* it; by default that build reverts the document to its disk content,
|
|
40
|
+
* discarding unsaved edits. Not a real client: it lets consumers tell the
|
|
41
|
+
* release broadcast from client-authored updates.
|
|
42
|
+
*/
|
|
43
|
+
export const DOCUMENT_RELEASE_CLIENT_ID = 'document-release';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Every id the framework reserves, for a client checking that the identity it
|
|
47
|
+
* is about to mint collides with none of them.
|
|
48
|
+
*/
|
|
49
|
+
export const FRAMEWORK_CLIENT_IDS: readonly string[] = [LANGUAGE_CLIENT_ID, UNKNOWN_CLIENT_ID, DOCUMENT_RELEASE_CLIENT_ID];
|
package/src/clock.ts
CHANGED
|
@@ -14,9 +14,11 @@ import { Disposable } from './util';
|
|
|
14
14
|
* there is no `start` — you create it at the moment timing begins.
|
|
15
15
|
*
|
|
16
16
|
* Backed by a monotonic source (`performance.now`), so it is sub-millisecond
|
|
17
|
-
* precise and immune to wall-clock
|
|
18
|
-
* `Date.now` delta go backwards; a stopwatch cannot).
|
|
19
|
-
*
|
|
17
|
+
* precise and immune to wall-clock steps (a time sync or a manual change can
|
|
18
|
+
* make a `Date.now` delta go backwards; a stopwatch cannot). In Node on Linux
|
|
19
|
+
* it also leaves out time the system spends suspended, so a duration spanning
|
|
20
|
+
* a suspend reads as the awake time only. Use this for every duration, a TTL
|
|
21
|
+
* included, and {@link Clock.now} for "what time is it".
|
|
20
22
|
*
|
|
21
23
|
* It holds no scheduled resource and is therefore NOT a {@link Disposable} —
|
|
22
24
|
* the disposable thing is a {@link Clock.setTimer}. Reads are lazy, so a fake
|
|
@@ -45,16 +47,16 @@ export interface Stopwatch {
|
|
|
45
47
|
* testable instead of waiting on real wall-clock. The {@link SystemClock}
|
|
46
48
|
* default delegates to the platform; tests bind `makeFakeClock`.
|
|
47
49
|
*
|
|
48
|
-
* Two distinct readings on purpose: {@link now} is wall-clock
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
* Two distinct readings on purpose: {@link now} is wall-clock, for a
|
|
51
|
+
* timestamp, while {@link stopwatch} measures durations off a monotonic
|
|
52
|
+
* source. They are different clocks; do not subtract two {@link now} readings
|
|
53
|
+
* to measure a duration. Framework code reads time only through a `Clock`, so
|
|
54
|
+
* a platform workaround lives in one place.
|
|
52
55
|
*
|
|
53
56
|
* A cross-head contract, so it carries no platform or DI-framework coupling.
|
|
54
57
|
*
|
|
55
|
-
* Note:
|
|
56
|
-
*
|
|
57
|
-
* measure would invert their meaning.
|
|
58
|
+
* Note: code that measures real CPU, heap or event-loop time never takes the
|
|
59
|
+
* bound `Clock`: faking the time it measures would invert its meaning.
|
|
58
60
|
*/
|
|
59
61
|
export interface Clock {
|
|
60
62
|
/** Current wall-clock time in milliseconds (the `Date.now` reading). */
|
|
@@ -76,8 +78,30 @@ export interface Clock {
|
|
|
76
78
|
*/
|
|
77
79
|
measure<T>(callback: () => Promise<T>): Promise<Timed<T>>;
|
|
78
80
|
measure<T>(callback: () => T): Timed<T>;
|
|
81
|
+
/**
|
|
82
|
+
* Settle with `promise`, or with {@link TIMED_OUT} once `ms` have elapsed
|
|
83
|
+
* first. A promise that rejects first rejects this one; one that rejects
|
|
84
|
+
* after the timer is ignored. The timer is disposed the moment `promise`
|
|
85
|
+
* settles, so a won race leaves nothing scheduled, but `promise` itself
|
|
86
|
+
* runs on: nothing here can cancel it.
|
|
87
|
+
*
|
|
88
|
+
* Unlike VS Code's `raceTimeout`, this settles with a sentinel rather than
|
|
89
|
+
* `undefined`, so a promise resolving to `undefined` is not taken for a
|
|
90
|
+
* timeout; the caller branches on the result instead of passing an
|
|
91
|
+
* `onTimeout`.
|
|
92
|
+
*
|
|
93
|
+
* A custom implementation extends {@link SystemClock}, whose race runs over
|
|
94
|
+
* the subclass's {@link setTimer}.
|
|
95
|
+
*/
|
|
96
|
+
raceTimer<T>(promise: Promise<T>, ms: number): Promise<T | typeof TIMED_OUT>;
|
|
79
97
|
}
|
|
80
98
|
|
|
99
|
+
/**
|
|
100
|
+
* What {@link Clock.raceTimer} settles with when its timer fires first.
|
|
101
|
+
* Registered under a global key, so two copies of this package agree on it.
|
|
102
|
+
*/
|
|
103
|
+
export const TIMED_OUT = Symbol.for('hydranium/protocol/timed-out');
|
|
104
|
+
|
|
81
105
|
/**
|
|
82
106
|
* The result of {@link Clock.measure}: a callback's return value paired with
|
|
83
107
|
* its elapsed wall-time in milliseconds. A plain value object — no methods, no
|
|
@@ -144,6 +168,10 @@ function unrefTimer(handle: { unref?: () => void }): void {
|
|
|
144
168
|
* Default {@link Clock}: delegates to the platform's `Date.now`,
|
|
145
169
|
* `performance.now`, and `setTimeout`/`clearTimeout`. Bound everywhere in
|
|
146
170
|
* production; swapped for `makeFakeClock` in tests.
|
|
171
|
+
*
|
|
172
|
+
* {@link measure} and {@link raceTimer} run over {@link stopwatch} and
|
|
173
|
+
* {@link setTimer}, so a clock that extends this one and replaces those
|
|
174
|
+
* measures and races on its own time, as the test clock does.
|
|
147
175
|
*/
|
|
148
176
|
export class SystemClock implements Clock {
|
|
149
177
|
now(): number {
|
|
@@ -170,4 +198,34 @@ export class SystemClock implements Clock {
|
|
|
170
198
|
}
|
|
171
199
|
return { result: result as T, elapsedMs: stopwatch.elapsedMs };
|
|
172
200
|
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* The timer settles the race one microtask after it fires. A real timer
|
|
204
|
+
* runs only once pending resolutions are delivered, while a fake one fires
|
|
205
|
+
* inside its `advance`, so settling at once would let a promise already
|
|
206
|
+
* resolved when `advance` runs lose to a timer it beats in production. The
|
|
207
|
+
* deferral covers only that promise: one that settles through further
|
|
208
|
+
* chained reactions, such as a `.then` chain, an async function or
|
|
209
|
+
* `Promise.allSettled`, can still lose to an `advance` in the same turn,
|
|
210
|
+
* while it wins on the platform's timer. The handlers go on `promise`
|
|
211
|
+
* before {@link setTimer} runs, so a `setTimer` that throws still leaves
|
|
212
|
+
* `promise` observed.
|
|
213
|
+
*/
|
|
214
|
+
raceTimer<T>(promise: Promise<T>, ms: number): Promise<T | typeof TIMED_OUT> {
|
|
215
|
+
return new Promise<T | typeof TIMED_OUT>((resolve, reject) => {
|
|
216
|
+
// eslint-disable-next-line prefer-const -- with a `const`, a `setTimer` that throws leaves it uninitialised, and the handlers' later read of it is an unhandled ReferenceError
|
|
217
|
+
let timer: Disposable | undefined;
|
|
218
|
+
promise.then(
|
|
219
|
+
value => {
|
|
220
|
+
timer?.dispose();
|
|
221
|
+
resolve(value);
|
|
222
|
+
},
|
|
223
|
+
(err: unknown) => {
|
|
224
|
+
timer?.dispose();
|
|
225
|
+
reject(err);
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
timer = this.setTimer(() => void Promise.resolve().then(() => resolve(TIMED_OUT)), ms);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
173
231
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
|
|
10
|
+
import { AbstractLogger } from './abstract-logger';
|
|
11
|
+
import { type LogLevel, type Logger } from './logger';
|
|
12
|
+
|
|
13
|
+
/** `console.trace` prints a stack with every line, so `trace` goes out at `debug`. */
|
|
14
|
+
const CONSOLE_METHODS: Record<LogLevel, 'error' | 'warn' | 'info' | 'debug'> = {
|
|
15
|
+
error: 'error',
|
|
16
|
+
warn: 'warn',
|
|
17
|
+
info: 'info',
|
|
18
|
+
debug: 'debug',
|
|
19
|
+
trace: 'debug'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* {@link Logger} that writes each line to `console`, at the method matching its
|
|
24
|
+
* level: the framework's `[Label - time] [component]` prefix and the message,
|
|
25
|
+
* then any trailing arguments as they are, so a browser console can expand
|
|
26
|
+
* them. For a browser page, webview or extension host, which has no other sink
|
|
27
|
+
* to hand. On Node, `info` and `debug` reach stdout, so a process whose stdout
|
|
28
|
+
* carries a protocol stream must not use it.
|
|
29
|
+
*/
|
|
30
|
+
export class ConsoleLogger extends AbstractLogger implements Logger {
|
|
31
|
+
protected emit(level: LogLevel, label: string, message: string, args: readonly unknown[]): void {
|
|
32
|
+
console[CONSOLE_METHODS[level]](`${this.formatLinePrefix(label)} ${message}`, ...args);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected derive(component: string): this {
|
|
36
|
+
const Subclass = this.constructor as new (component?: string) => this;
|
|
37
|
+
return new Subclass(component);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -20,11 +20,17 @@ import type {
|
|
|
20
20
|
|
|
21
21
|
/** Request-method names on {@link DocumentServerProtocol}. */
|
|
22
22
|
export const DOCUMENT_SERVER_PROTOCOL_METHODS = [
|
|
23
|
+
'createSession',
|
|
24
|
+
'closeSession',
|
|
25
|
+
'createModelDocument',
|
|
26
|
+
'updateModelDocuments',
|
|
23
27
|
'openModelDocument',
|
|
24
28
|
'closeModelDocument',
|
|
25
29
|
'getModelDocument',
|
|
26
30
|
'updateModelDocument',
|
|
27
31
|
'saveModelDocument',
|
|
32
|
+
'persistModelDocument',
|
|
33
|
+
'deleteModelDocument',
|
|
28
34
|
'watchModelDocument',
|
|
29
35
|
'unwatchModelDocument',
|
|
30
36
|
'waitForReady'
|
|
@@ -56,12 +62,13 @@ export const REFERENCE_SERVER_PROTOCOL_METHODS = [
|
|
|
56
62
|
'findReferenceCandidates',
|
|
57
63
|
'resolveReference',
|
|
58
64
|
'findNextName'
|
|
59
|
-
] as const satisfies ReadonlyArray<keyof ReferenceServerProtocol
|
|
65
|
+
] as const satisfies ReadonlyArray<keyof ReferenceServerProtocol & string>;
|
|
60
66
|
|
|
61
67
|
/** Notification-method names on {@link DocumentClientProtocol}. */
|
|
62
68
|
export const DOCUMENT_CLIENT_PROTOCOL_METHODS = [
|
|
63
69
|
'onDocumentUpdated',
|
|
64
70
|
'onDocumentSaved',
|
|
71
|
+
'onDocumentDirtyChanged',
|
|
65
72
|
'onDocumentDeleted',
|
|
66
73
|
'onDocumentsBuilt'
|
|
67
74
|
] as const satisfies ReadonlyArray<keyof DocumentClientProtocol<TransferElement> & string>;
|
|
@@ -10,22 +10,35 @@
|
|
|
10
10
|
import type { TransferDiagnostic } from '../transfer-diagnostic';
|
|
11
11
|
import type { TransferElement } from '../transfer-element';
|
|
12
12
|
import type { Project } from '../project';
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
TransferCreatedDocument,
|
|
15
|
+
TransferDocument,
|
|
16
|
+
TransferSavedDocument,
|
|
17
|
+
TransferWatchedDocument,
|
|
18
|
+
TransferWrittenDocument
|
|
19
|
+
} from '../transfer-document';
|
|
14
20
|
import type { CloseModelArgs, FindNextNameArgs, OpenModelArgs, ReferenceContext, ReferenceRequest } from '../model-server';
|
|
15
21
|
import type { ReferenceCandidate, ReferenceTarget } from '../model-service/reference-candidate';
|
|
16
22
|
import type {
|
|
17
23
|
ProjectsChangedEvent,
|
|
18
24
|
TransferDocumentDeletedEvent,
|
|
25
|
+
TransferDocumentDirtyChangedEvent,
|
|
19
26
|
TransferDocumentSavedEvent,
|
|
20
27
|
TransferDocumentsBuiltEvent,
|
|
21
28
|
TransferDocumentUpdatedEvent
|
|
22
29
|
} from './events';
|
|
23
30
|
import type {
|
|
31
|
+
CloseSessionArgs,
|
|
32
|
+
CreateModelDocumentArgs,
|
|
33
|
+
CreateSessionArgs,
|
|
24
34
|
GetModelDocumentArgs,
|
|
25
35
|
GetProjectForUriArgs,
|
|
36
|
+
TransferDeleteDocumentArgs,
|
|
37
|
+
TransferPersistDocumentArgs,
|
|
26
38
|
TransferSaveDocumentArgs,
|
|
27
39
|
WatchModelDocumentArgs,
|
|
28
|
-
TransferUpdateDocumentArgs
|
|
40
|
+
TransferUpdateDocumentArgs,
|
|
41
|
+
TransferUpdateDocumentsArgs
|
|
29
42
|
} from './requests';
|
|
30
43
|
|
|
31
44
|
/**
|
|
@@ -46,35 +59,82 @@ import type {
|
|
|
46
59
|
*/
|
|
47
60
|
export interface DocumentServerProtocol<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic> {
|
|
48
61
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* document
|
|
62
|
+
* Register `args.clientId` as a client session owned by this connection.
|
|
63
|
+
* Rejects with a `DuplicateClientIdError` code when the id is live anywhere
|
|
64
|
+
* in the server process, and with a `ReservedClientIdError` code when the
|
|
65
|
+
* framework reserves it.
|
|
66
|
+
*
|
|
67
|
+
* A request carrying a registered id acts as that session: it writes only
|
|
68
|
+
* what the session has open, failing with a `DocumentNotOpenError` code
|
|
69
|
+
* otherwise, and opens nothing implicitly; its open reads the file and takes
|
|
70
|
+
* no `languageId`, `version` or `text` seed. The session ends with
|
|
71
|
+
* {@link closeSession} or when the connection closes, and either closes
|
|
72
|
+
* every document it has open.
|
|
73
|
+
*
|
|
74
|
+
* A registration carrying the `resumeToken` an earlier registration of the
|
|
75
|
+
* same id carried ends that session first, from any connection, so a client
|
|
76
|
+
* whose connection dropped can register again before the server notices.
|
|
77
|
+
*/
|
|
78
|
+
createSession(args: CreateSessionArgs): Promise<void>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* End a session this connection registered: close every document it has
|
|
82
|
+
* open, drop its watches, and free its id. A no-op for an id this
|
|
83
|
+
* connection did not register.
|
|
84
|
+
*/
|
|
85
|
+
closeSession(args: CloseSessionArgs): Promise<void>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Create a document with `args.text`, open for the session, and return it
|
|
89
|
+
* as {@link openModelDocument} does, with the version the create made in
|
|
90
|
+
* `created`. The answer is read after the create, so it can already hold
|
|
91
|
+
* another client's write or an integrity repair; a write based on
|
|
92
|
+
* `created.version` then conflicts. It reaches disk with the first save.
|
|
93
|
+
* Fails when the file exists, any client has the URI open, or a lost
|
|
94
|
+
* client's unsaved text is held for it, and with a
|
|
95
|
+
* `SessionClosedError` code when `args.clientId` is not a session
|
|
96
|
+
* registered on this connection.
|
|
97
|
+
*/
|
|
98
|
+
createModelDocument(args: CreateModelDocumentArgs): Promise<TransferCreatedDocument<TTransfer, TDiagnostic>>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Write several documents the session has open, all or none: a conflict, a
|
|
102
|
+
* document not open, or a model for a document whose parse lacks some of
|
|
103
|
+
* its text fails the whole set before any text applies.
|
|
104
|
+
* Resolves to the documents in the order given, each with the version its
|
|
105
|
+
* text took in `written`, once the language client has answered the push
|
|
106
|
+
* of each, or the server-side bound on that wait passes, as
|
|
107
|
+
* {@link updateModelDocument} does. Only for a session registered on this
|
|
108
|
+
* connection.
|
|
109
|
+
*/
|
|
110
|
+
updateModelDocuments(args: TransferUpdateDocumentsArgs<TTransfer>): Promise<TransferWrittenDocument<TTransfer, TDiagnostic>[]>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Open a document for the client session `clientId` and return its current
|
|
114
|
+
* state. `clientId` must be a session this connection registered with
|
|
115
|
+
* {@link createSession}; any other id fails with the closed-session code,
|
|
116
|
+
* as every document request here does. The document is read from disk
|
|
117
|
+
* unless a client has it open already, so the request carries no
|
|
118
|
+
* `languageId`, `version` or `text` seed. Returns the document at
|
|
119
|
+
* the server's configured target phase, as {@link getModelDocument} does.
|
|
120
|
+
* A repeat open changes nothing.
|
|
60
121
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* later validation diagnostics arrive on the watch channel).
|
|
122
|
+
* Pair with {@link watchModelDocument} to receive subsequent build-phase
|
|
123
|
+
* events (open returns a one-shot snapshot; later validation diagnostics
|
|
124
|
+
* arrive on the watch channel).
|
|
65
125
|
*/
|
|
66
|
-
openModelDocument(args: OpenModelArgs): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
126
|
+
openModelDocument(args: Pick<OpenModelArgs, 'uri' | 'clientId' | 'options'>): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
67
127
|
|
|
68
128
|
/**
|
|
69
|
-
* Close
|
|
70
|
-
* {@link openModelDocument}; the
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* forgotten {@link unwatchModelDocument} would
|
|
75
|
-
* the implicit unwatch is idempotent).
|
|
76
|
-
* coupled the other way: opening does not force
|
|
77
|
-
* reader can open without streaming.
|
|
129
|
+
* Close the session's open of `uri`. Counterpart to
|
|
130
|
+
* {@link openModelDocument}; the document stays open until every client
|
|
131
|
+
* has closed it, and then the server releases it, by default reverting it
|
|
132
|
+
* to disk. The default
|
|
133
|
+
* `DataServer` impl ALSO releases any watch for the same
|
|
134
|
+
* `(uri, clientId)` (a forgotten {@link unwatchModelDocument} would
|
|
135
|
+
* otherwise leak dispatch; the implicit unwatch is idempotent).
|
|
136
|
+
* `watchModelDocument` is NOT coupled the other way: opening does not force
|
|
137
|
+
* a watch, so a snapshot reader can open without streaming.
|
|
78
138
|
*/
|
|
79
139
|
closeModelDocument(args: CloseModelArgs): Promise<void>;
|
|
80
140
|
|
|
@@ -87,34 +147,77 @@ export interface DocumentServerProtocol<TTransfer extends TransferElement, TDiag
|
|
|
87
147
|
getModelDocument(args: GetModelDocumentArgs): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
88
148
|
|
|
89
149
|
/**
|
|
90
|
-
* Update a document's content
|
|
91
|
-
*
|
|
92
|
-
* response.
|
|
150
|
+
* Update a document's content as the session `clientId`, which must have
|
|
151
|
+
* it open. The response carries the latest built state including
|
|
152
|
+
* diagnostics. Callers observe convergence via that response. `written`
|
|
153
|
+
* carries the version the write's text took, which tells a writer whether
|
|
154
|
+
* the build holds a later text too. It is sent once the language client
|
|
155
|
+
* has answered the push of the text, or the server-side bound on that wait
|
|
156
|
+
* passes, as {@link saveModelDocument}'s is, so an editor already shows
|
|
157
|
+
* the write when it arrives. A model, not text, for a document whose parse
|
|
158
|
+
* lacks some of its text fails with a `DocumentSyntaxError` code, unless
|
|
159
|
+
* the write is a `restore`.
|
|
93
160
|
*/
|
|
94
|
-
updateModelDocument(args: TransferUpdateDocumentArgs<TTransfer>): Promise<
|
|
161
|
+
updateModelDocument(args: TransferUpdateDocumentArgs<TTransfer>): Promise<TransferWrittenDocument<TTransfer, TDiagnostic>>;
|
|
95
162
|
|
|
96
163
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
164
|
+
* Write a document as the session `clientId`, which must have it open, and
|
|
165
|
+
* persist it to disk. The response is the build of the text written, with
|
|
166
|
+
* its version in `persisted`, sent once the language client has answered
|
|
167
|
+
* the push of that text, applied or refused, or a server-side bound on
|
|
168
|
+
* that wait passes; it does not wait again for a push that wait already
|
|
169
|
+
* gave up on and the client has not answered since. Save semantics depend
|
|
170
|
+
* on the filesystem-provider wiring; rejection paths surface as awaited
|
|
171
|
+
* promise rejections, as a model for a document whose parse lacks some of
|
|
172
|
+
* its text does with a `DocumentSyntaxError` code.
|
|
101
173
|
*/
|
|
102
|
-
saveModelDocument(args: TransferSaveDocumentArgs<TTransfer>): Promise<
|
|
174
|
+
saveModelDocument(args: TransferSaveDocumentArgs<TTransfer>): Promise<TransferSavedDocument<TTransfer, TDiagnostic>>;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Persist the text the server holds for a document the session `clientId`
|
|
178
|
+
* has open, as it is: no update and no serialisation, so another client's
|
|
179
|
+
* unsaved text keeps its formatting. `baseVersion` is checked in the step
|
|
180
|
+
* that takes the text, so text that moved on fails with a `ConflictError`
|
|
181
|
+
* code. The saved event names this session, whoever wrote the text.
|
|
182
|
+
* Answers after the same language-client wait as {@link saveModelDocument},
|
|
183
|
+
* with the document's latest build, read after that wait, so another
|
|
184
|
+
* session's write during it shows; `persisted` carries the version written.
|
|
185
|
+
*/
|
|
186
|
+
persistModelDocument(args: TransferPersistDocumentArgs): Promise<TransferSavedDocument<TTransfer, TDiagnostic>>;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Delete a document the session `clientId` has open, at once: its file,
|
|
190
|
+
* then the document, as a deletion a file watcher reports removes it. Every
|
|
191
|
+
* session's open of it closes and every client hears
|
|
192
|
+
* {@link DocumentClientProtocol.onDocumentDeleted} naming this session; the
|
|
193
|
+
* session's own watch is released, as {@link closeModelDocument} releases
|
|
194
|
+
* it. `baseVersion` is checked in the step that marks the document for
|
|
195
|
+
* deletion, so text that moved on fails with a `ConflictError` code. A file
|
|
196
|
+
* already gone deletes only the document; a file that cannot be removed
|
|
197
|
+
* fails the call and changes nothing. Resolves once the build that removes
|
|
198
|
+
* the document has run; a read then answers the URI without a model, unless
|
|
199
|
+
* an editor still has it open, whose buffer the document is built from.
|
|
200
|
+
*/
|
|
201
|
+
deleteModelDocument(args: TransferDeleteDocumentArgs): Promise<void>;
|
|
103
202
|
|
|
104
203
|
/**
|
|
105
204
|
* Start watching `(uri, clientId)`. The server starts dispatching
|
|
106
205
|
* {@link DocumentClientProtocol.onDocumentUpdated} on the paired wire
|
|
107
206
|
* for every build-phase event on `uri`.
|
|
108
207
|
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
208
|
+
* Answers with the key the watch's events name the document by, whether
|
|
209
|
+
* a document exists, taken once the watch is in place and the document
|
|
210
|
+
* is loaded as a read loads it, the text held at that moment, and the
|
|
211
|
+
* position of the last update or deletion event sent as of it, so an event
|
|
212
|
+
* the client heard while the watch was in flight tells by its own position
|
|
213
|
+
* whether it is newer than the answer. No handle: the event channel is the
|
|
214
|
+
* client interface. Callers fan out a single inbound `onDocumentUpdated` to
|
|
215
|
+
* multiple local listeners with their own `Emitter<T>` (matching Theia's
|
|
216
|
+
* pattern). Pair every `watchModelDocument` with
|
|
217
|
+
* {@link unwatchModelDocument} when no longer needed; the server holds the
|
|
218
|
+
* watch record until the matching unwatch lands.
|
|
116
219
|
*/
|
|
117
|
-
watchModelDocument(args: WatchModelDocumentArgs): Promise<
|
|
220
|
+
watchModelDocument(args: WatchModelDocumentArgs): Promise<TransferWatchedDocument>;
|
|
118
221
|
|
|
119
222
|
/**
|
|
120
223
|
* Stop watching `(uri, clientId)` previously started by
|
|
@@ -200,6 +303,22 @@ export interface DataServerProtocol<
|
|
|
200
303
|
>
|
|
201
304
|
extends DocumentServerProtocol<TTransfer, TDiagnostic>, ProjectServerProtocol<TProject> {}
|
|
202
305
|
|
|
306
|
+
/**
|
|
307
|
+
* The diagnostic shape a server answers with, read back off its own
|
|
308
|
+
* declaration.
|
|
309
|
+
*
|
|
310
|
+
* This is what lets a client tier stay generic over the server alone and still
|
|
311
|
+
* describe what it hands back. Both parameters must be inferred: naming
|
|
312
|
+
* {@link TransferElement} for the transfer instead fails to match while that
|
|
313
|
+
* parameter is still generic, and a default declared against the constraint
|
|
314
|
+
* then stops satisfying it.
|
|
315
|
+
*/
|
|
316
|
+
export type DiagnosticOf<TServer> =
|
|
317
|
+
TServer extends DocumentServerProtocol<infer _TTransfer, infer TDiagnostic> ? TDiagnostic : TransferDiagnostic;
|
|
318
|
+
|
|
319
|
+
/** The project shape a server answers with, read back off its own declaration. */
|
|
320
|
+
export type ProjectOf<TServer> = TServer extends ProjectServerProtocol<infer TProject> ? TProject : Project;
|
|
321
|
+
|
|
203
322
|
/**
|
|
204
323
|
* Cross-reference / naming slice of the server surface — scope-aware
|
|
205
324
|
* queries that resolve against the language's reference services. NOT part
|
|
@@ -210,11 +329,11 @@ export interface DataServerProtocol<
|
|
|
210
329
|
* source/URI (an `ElementSource` with no URI resolves to the sole
|
|
211
330
|
* registered language; a multi-language workspace overrides).
|
|
212
331
|
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
332
|
+
* Not generic over a server's root type: {@link resolveReference} answers with
|
|
333
|
+
* a node a reference names, which is no document root, and candidates and
|
|
334
|
+
* names are diagnostic-free.
|
|
216
335
|
*/
|
|
217
|
-
export interface ReferenceServerProtocol
|
|
336
|
+
export interface ReferenceServerProtocol {
|
|
218
337
|
/**
|
|
219
338
|
* List the reference candidates reachable for the property named in `ctx`
|
|
220
339
|
* from its (possibly synthetic) source. Backed by the language's
|
|
@@ -227,8 +346,13 @@ export interface ReferenceServerProtocol<TTransfer extends TransferElement> {
|
|
|
227
346
|
* target's document URI, display fields, and the resolved node's encoded
|
|
228
347
|
* transfer subtree. Resolves via the language's reference services;
|
|
229
348
|
* `undefined` when the reference does not resolve.
|
|
349
|
+
*
|
|
350
|
+
* `TElement` is the caller's claim about the target node's type; nothing
|
|
351
|
+
* checks it, so leave it at the default unless the reference names one type.
|
|
230
352
|
*/
|
|
231
|
-
resolveReference
|
|
353
|
+
resolveReference<TElement extends TransferElement = TransferElement>(
|
|
354
|
+
ref: ReferenceRequest
|
|
355
|
+
): Promise<ReferenceTarget<TElement> | undefined>;
|
|
232
356
|
|
|
233
357
|
/**
|
|
234
358
|
* Compute the next free name for a new element of `args.type` based on
|
|
@@ -269,6 +393,17 @@ export interface DocumentClientProtocol<TTransfer extends TransferElement, TDiag
|
|
|
269
393
|
*/
|
|
270
394
|
onDocumentSaved(event: TransferDocumentSavedEvent<TTransfer, TDiagnostic>): void;
|
|
271
395
|
|
|
396
|
+
/**
|
|
397
|
+
* Delivered when a subscribed document's text starts or stops differing
|
|
398
|
+
* from its file, as the server last knew it. Gated like
|
|
399
|
+
* {@link onDocumentSaved}; the answer at any one moment is the `dirty` of
|
|
400
|
+
* the documents the server sends. After a reconnect, a `DataSession`
|
|
401
|
+
* delivers here the answer of each document it restored, when that differs
|
|
402
|
+
* from the last this client was told: the flips while the connection was
|
|
403
|
+
* down reached no one.
|
|
404
|
+
*/
|
|
405
|
+
onDocumentDirtyChanged(event: TransferDocumentDirtyChangedEvent): void;
|
|
406
|
+
|
|
272
407
|
/**
|
|
273
408
|
* Delivered when a document's backing file was removed. Separate from
|
|
274
409
|
* {@link onDocumentUpdated} for the same reason as {@link onDocumentSaved},
|