@hydranium/core 1.0.0-next.109 → 1.0.0-next.111

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.
Files changed (44) hide show
  1. package/lib/lsp/connection-features.d.ts +23 -0
  2. package/lib/lsp/connection-features.d.ts.map +1 -0
  3. package/lib/lsp/connection-features.js +60 -0
  4. package/lib/lsp/connection-features.js.map +1 -0
  5. package/lib/lsp/diagnostics-connection.d.ts +27 -0
  6. package/lib/lsp/diagnostics-connection.d.ts.map +1 -0
  7. package/lib/lsp/diagnostics-connection.js +53 -0
  8. package/lib/lsp/diagnostics-connection.js.map +1 -0
  9. package/lib/lsp/hydranium-document-update-handler.d.ts.map +1 -1
  10. package/lib/lsp/hydranium-document-update-handler.js +9 -0
  11. package/lib/lsp/hydranium-document-update-handler.js.map +1 -1
  12. package/lib/lsp/index.d.ts +2 -0
  13. package/lib/lsp/index.d.ts.map +1 -1
  14. package/lib/lsp/index.js +2 -0
  15. package/lib/lsp/index.js.map +1 -1
  16. package/lib/lsp/start-language-server.d.ts +5 -3
  17. package/lib/lsp/start-language-server.d.ts.map +1 -1
  18. package/lib/lsp/start-language-server.js +10 -3
  19. package/lib/lsp/start-language-server.js.map +1 -1
  20. package/lib/testing/node/index.d.ts +1 -0
  21. package/lib/testing/node/index.d.ts.map +1 -1
  22. package/lib/testing/node/index.js +1 -0
  23. package/lib/testing/node/index.js.map +1 -1
  24. package/lib/testing/node/lsp-server-connection.d.ts.map +1 -1
  25. package/lib/testing/node/lsp-server-connection.js +5 -6
  26. package/lib/testing/node/lsp-server-connection.js.map +1 -1
  27. package/lib/testing/node/unhandled-rejections.d.ts +20 -0
  28. package/lib/testing/node/unhandled-rejections.d.ts.map +1 -0
  29. package/lib/testing/node/unhandled-rejections.js +32 -0
  30. package/lib/testing/node/unhandled-rejections.js.map +1 -0
  31. package/lib/util/connection-liveness.d.ts +7 -6
  32. package/lib/util/connection-liveness.d.ts.map +1 -1
  33. package/lib/util/connection-liveness.js +35 -14
  34. package/lib/util/connection-liveness.js.map +1 -1
  35. package/package.json +5 -5
  36. package/src/lsp/connection-features.ts +67 -0
  37. package/src/lsp/diagnostics-connection.ts +56 -0
  38. package/src/lsp/hydranium-document-update-handler.ts +9 -0
  39. package/src/lsp/index.ts +2 -0
  40. package/src/lsp/start-language-server.ts +10 -3
  41. package/src/testing/node/index.ts +1 -0
  42. package/src/testing/node/lsp-server-connection.ts +5 -6
  43. package/src/testing/node/unhandled-rejections.ts +31 -0
  44. package/src/util/connection-liveness.ts +37 -14
@@ -0,0 +1,23 @@
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
+ import { type Features } from 'vscode-languageserver';
10
+ /**
11
+ * Add Hydranium's connection-liveness handling to a language-server
12
+ * connection's console. The upstream `RemoteConsole` catches every failed log
13
+ * notification and prints `Sending log message failed`, so every ordinary
14
+ * teardown reports a failure; this console drops only a failure that
15
+ * {@link isConnectionGoneError} recognises and re-raises any other as an
16
+ * unhandled rejection.
17
+ *
18
+ * Supply it where the connection is created. `createConnection` builds the
19
+ * console from these features, so a connection that already exists keeps the
20
+ * upstream console for its whole lifetime.
21
+ */
22
+ export declare function withHydraniumLspFeatures<T extends Features>(features: T): T;
23
+ //# sourceMappingURL=connection-features.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-features.d.ts","sourceRoot":"","sources":["../../src/lsp/connection-features.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAuC,KAAK,QAAQ,EAAsB,MAAM,uBAAuB,CAAC;AAG/G;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CA0C3E"}
@@ -0,0 +1,60 @@
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
+ import { LogMessageNotification, MessageType } from 'vscode-languageserver';
10
+ import { isConnectionGoneError } from '../util/connection-liveness.js';
11
+ /**
12
+ * Add Hydranium's connection-liveness handling to a language-server
13
+ * connection's console. The upstream `RemoteConsole` catches every failed log
14
+ * notification and prints `Sending log message failed`, so every ordinary
15
+ * teardown reports a failure; this console drops only a failure that
16
+ * {@link isConnectionGoneError} recognises and re-raises any other as an
17
+ * unhandled rejection.
18
+ *
19
+ * Supply it where the connection is created. `createConnection` builds the
20
+ * console from these features, so a connection that already exists keeps the
21
+ * upstream console for its whole lifetime.
22
+ */
23
+ export function withHydraniumLspFeatures(features) {
24
+ return {
25
+ ...features,
26
+ console: (Base) => class extends Base {
27
+ error(message) {
28
+ this.sendLogMessage(MessageType.Error, message);
29
+ }
30
+ warn(message) {
31
+ this.sendLogMessage(MessageType.Warning, message);
32
+ }
33
+ info(message) {
34
+ this.sendLogMessage(MessageType.Info, message);
35
+ }
36
+ log(message) {
37
+ this.sendLogMessage(MessageType.Log, message);
38
+ }
39
+ debug(message) {
40
+ this.sendLogMessage(MessageType.Debug, message);
41
+ }
42
+ sendLogMessage(type, message) {
43
+ try {
44
+ void this.connection.sendNotification(LogMessageNotification.type, { type, message }).catch(error => {
45
+ this.handleLogSendFailure(error);
46
+ });
47
+ }
48
+ catch (error) {
49
+ this.handleLogSendFailure(error);
50
+ }
51
+ }
52
+ handleLogSendFailure(error) {
53
+ if (!isConnectionGoneError(error)) {
54
+ void Promise.reject(error);
55
+ }
56
+ }
57
+ }
58
+ };
59
+ }
60
+ //# sourceMappingURL=connection-features.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-features.js","sourceRoot":"","sources":["../../src/lsp/connection-features.ts"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,KAAK,CAAC,CAAC;gBACpC,CAAC;YACJ,CAAC;YAEO,oBAAoB,CAAC,KAAc;gBACxC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;oBACjC,KAAK,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC9B,CAAC;YACJ,CAAC;SACH;KACD,CAAC;AACV,CAAC"}
@@ -0,0 +1,27 @@
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
+ import type { Connection } from 'vscode-languageserver';
10
+ /**
11
+ * Protect Langium's fire-and-forget diagnostics publish from the expected
12
+ * failure caused by a peer disconnecting during teardown.
13
+ *
14
+ * A publish issued after the connection is disposed throws synchronously
15
+ * instead of rejecting, and Langium's publisher is a document-phase listener,
16
+ * so an unguarded throw fails the build that validated the document. The
17
+ * `try` answers that case with a resolved promise; a guard on the promise
18
+ * alone never sees it.
19
+ *
20
+ * Otherwise the original promise is returned unchanged. The detached catch is
21
+ * deliberate: it marks the original promise as observed, suppresses only the
22
+ * expected connection-liveness error, and rethrows unexpected failures so they
23
+ * stay visible as unhandled rejections, as an unguarded fire-and-forget send
24
+ * would leave them.
25
+ */
26
+ export declare function guardDiagnosticsConnection(connection: Connection): void;
27
+ //# sourceMappingURL=diagnostics-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics-connection.d.ts","sourceRoot":"","sources":["../../src/lsp/diagnostics-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAKxD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAyBvE"}
@@ -0,0 +1,53 @@
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
+ import { isConnectionGoneError } from '../util/connection-liveness.js';
10
+ const wrappedConnections = new WeakSet();
11
+ /**
12
+ * Protect Langium's fire-and-forget diagnostics publish from the expected
13
+ * failure caused by a peer disconnecting during teardown.
14
+ *
15
+ * A publish issued after the connection is disposed throws synchronously
16
+ * instead of rejecting, and Langium's publisher is a document-phase listener,
17
+ * so an unguarded throw fails the build that validated the document. The
18
+ * `try` answers that case with a resolved promise; a guard on the promise
19
+ * alone never sees it.
20
+ *
21
+ * Otherwise the original promise is returned unchanged. The detached catch is
22
+ * deliberate: it marks the original promise as observed, suppresses only the
23
+ * expected connection-liveness error, and rethrows unexpected failures so they
24
+ * stay visible as unhandled rejections, as an unguarded fire-and-forget send
25
+ * would leave them.
26
+ */
27
+ export function guardDiagnosticsConnection(connection) {
28
+ if (wrappedConnections.has(connection)) {
29
+ return;
30
+ }
31
+ wrappedConnections.add(connection);
32
+ const sendDiagnostics = connection.sendDiagnostics.bind(connection);
33
+ connection.sendDiagnostics = params => {
34
+ let result;
35
+ try {
36
+ result = sendDiagnostics(params);
37
+ }
38
+ catch (error) {
39
+ if (isConnectionGoneError(error)) {
40
+ return Promise.resolve();
41
+ }
42
+ throw error;
43
+ }
44
+ void result.catch(error => {
45
+ if (isConnectionGoneError(error)) {
46
+ return;
47
+ }
48
+ throw error;
49
+ });
50
+ return result;
51
+ };
52
+ }
53
+ //# sourceMappingURL=diagnostics-connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics-connection.js","sourceRoot":"","sources":["../../src/lsp/diagnostics-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,MAAM,kBAAkB,GAAG,IAAI,OAAO,EAAU,CAAC;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,0BAA0B,CAAC,UAAsB;IAC9D,IAAI,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,OAAO;IACV,CAAC;IACD,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEnC,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpE,UAAU,CAAC,eAAe,GAAG,MAAM,CAAC,EAAE;QACnC,IAAI,MAAqB,CAAC;QAC1B,IAAI,CAAC;YACF,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACvB,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;YAC5B,CAAC;YACD,MAAM,KAAK,CAAC;QACf,CAAC;QACD,KAAK,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACvB,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,OAAO;YACV,CAAC;YACD,MAAM,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IACjB,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hydranium-document-update-handler.d.ts","sourceRoot":"","sources":["../../src/lsp/hydranium-document-update-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAE,GAAG,EAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,KAAK,wBA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D"}
@@ -10,6 +10,7 @@ import { Debouncer, ObservableValue } from '@hydranium/protocol';
10
10
  import { URI, UriUtils } from '@hydranium/langium';
11
11
  import { DefaultDocumentUpdateHandler } from '@hydranium/langium/lsp';
12
12
  import { LANGUAGE_CLIENT_ID } from '../documents/client-ids.js';
13
+ import { isConnectionGoneError } from '../util/connection-liveness.js';
13
14
  import { FileChangeType } from 'vscode-languageserver';
14
15
  /**
15
16
  * Default LSP-event reasons stamped by {@link HydraniumDocumentUpdateHandler}
@@ -280,6 +281,14 @@ export class HydraniumDocumentUpdateHandler extends DefaultDocumentUpdateHandler
280
281
  return this.documentBuilder.update(changed, deleted, token);
281
282
  }))
282
283
  .catch(err => {
284
+ // A deferred rebuild can finish after the LSP peer has gone away.
285
+ // Unless the head was started through `startLanguageServer`, whose
286
+ // guard absorbs it, the diagnostics publish then fails this build:
287
+ // a routine teardown race, not a failed workspace update. Keep
288
+ // genuine update failures visible.
289
+ if (isConnectionGoneError(err)) {
290
+ return;
291
+ }
283
292
  const detail = err instanceof Error ? (err.stack ?? err.message) : String(err);
284
293
  this.logger.error(`Workspace initialization failed. Could not perform document update. ${detail}`);
285
294
  });
@@ -1 +1 @@
1
- {"version":3,"file":"hydranium-document-update-handler.js","sourceRoot":"","sources":["../../src/lsp/hydranium-document-update-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,SAAS,EAAe,eAAe,EAA6B,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,EAAoD,cAAc,EAAgC,MAAM,uBAAuB,CAAC;AAGvI;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC;IAClD,OAAO,EAA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AC;QAC/D,CAAC,CAAC,CACJ;aACA,KAAK,CAAC,GAAG,CAAC,EAAE;YACV,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC/E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uEAAuE,MAAM,EAAE,CAAC,CAAC;QACtG,CAAC,CAAC,CAAC;IACT,CAAC;CACH"}
1
+ {"version":3,"file":"hydranium-document-update-handler.js","sourceRoot":"","sources":["../../src/lsp/hydranium-document-update-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,SAAS,EAAe,eAAe,EAA6B,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAoD,cAAc,EAAgC,MAAM,uBAAuB,CAAC;AAGvI;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,SAAS;IAClB,gBAAgB,EAAE,kBAAkB;IACpC,qBAAqB,EAAE,uBAAuB;IAC9C,QAAQ,EAAE,UAAU;CACb,CAAC,CAAC;AA4BZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,8BAA+B,SAAQ,4BAA4B;IAQ1D,MAAM,CAAS;IACf,gBAAgB,CAAmB;IACnC,kBAAkB,CAA6B;IAC/C,aAAa,CAAuC;IAEvE,0FAA0F;IACvE,QAAQ,CAA0B;IAClC,8BAA8B,CA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AC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC/E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uEAAuE,MAAM,EAAE,CAAC,CAAC;QACtG,CAAC,CAAC,CAAC;IACT,CAAC;CACH"}
@@ -8,6 +8,8 @@
8
8
  ********************************************************************************/
9
9
  export * from './completion/hydranium-completion-provider.js';
10
10
  export * from './lsp-latency.js';
11
+ export * from './connection-features.js';
12
+ export * from './diagnostics-connection.js';
11
13
  export * from './semantic-token-provider.js';
12
14
  export * from './language-module.js';
13
15
  export * from './shared-module.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lsp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wCAAwC,CAAC;AAEvD;;;;;;GAMG;AACH,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lsp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wCAAwC,CAAC;AAEvD;;;;;;GAMG;AACH,cAAc,4BAA4B,CAAC"}
package/lib/lsp/index.js CHANGED
@@ -8,6 +8,8 @@
8
8
  ********************************************************************************/
9
9
  export * from './completion/hydranium-completion-provider.js';
10
10
  export * from './lsp-latency.js';
11
+ export * from './connection-features.js';
12
+ export * from './diagnostics-connection.js';
11
13
  export * from './semantic-token-provider.js';
12
14
  export * from './language-module.js';
13
15
  export * from './shared-module.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lsp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wCAAwC,CAAC;AAEvD;;;;;;GAMG;AACH,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lsp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wCAAwC,CAAC;AAEvD;;;;;;GAMG;AACH,cAAc,4BAA4B,CAAC"}
@@ -35,9 +35,11 @@ import { type LangiumSharedServices, type ServiceRequirements } from '@hydranium
35
35
  export declare function assertLspHeadComposed(services: LangiumSharedServices): void;
36
36
  /**
37
37
  * The framework's LSP server entry point: {@link assertLspHeadComposed}, then
38
- * Langium's `startLanguageServer` unchanged. Signature-compatible with
39
- * Langium's, so it is a drop-in for adopters importing from
40
- * `@hydranium/core/lsp`.
38
+ * {@link guardDiagnosticsConnection} on the tree's connection, then Langium's
39
+ * `startLanguageServer`. Signature-compatible with Langium's, so it is a
40
+ * drop-in for adopters importing from `@hydranium/core/lsp`. Calling Langium's
41
+ * directly skips both: the composition check, and the guard without which a
42
+ * publish racing teardown fails the build that validated the document.
41
43
  */
42
44
  export declare function startLanguageServer(services: LangiumSharedServices, serviceRequirements?: Partial<ServiceRequirements>): void;
43
45
  //# sourceMappingURL=start-language-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-language-server.d.ts","sourceRoot":"","sources":["../../src/lsp/start-language-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAEJ,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAC1B,MAAM,wBAAwB,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAe3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,mBAAmB,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,IAAI,CAGjI"}
1
+ {"version":3,"file":"start-language-server.d.ts","sourceRoot":"","sources":["../../src/lsp/start-language-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAEJ,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAC1B,MAAM,wBAAwB,CAAC;AAIhC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAe3E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,mBAAmB,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,IAAI,CAOjI"}
@@ -8,6 +8,7 @@
8
8
  ********************************************************************************/
9
9
  import { startLanguageServer as startLangiumLanguageServer } from '@hydranium/langium/lsp';
10
10
  import { HydraniumDocumentUpdateHandler } from './hydranium-document-update-handler.js';
11
+ import { guardDiagnosticsConnection } from './diagnostics-connection.js';
11
12
  /**
12
13
  * Fail the LSP head's start when its shared module was never composed.
13
14
  *
@@ -49,12 +50,18 @@ export function assertLspHeadComposed(services) {
49
50
  }
50
51
  /**
51
52
  * The framework's LSP server entry point: {@link assertLspHeadComposed}, then
52
- * Langium's `startLanguageServer` unchanged. Signature-compatible with
53
- * Langium's, so it is a drop-in for adopters importing from
54
- * `@hydranium/core/lsp`.
53
+ * {@link guardDiagnosticsConnection} on the tree's connection, then Langium's
54
+ * `startLanguageServer`. Signature-compatible with Langium's, so it is a
55
+ * drop-in for adopters importing from `@hydranium/core/lsp`. Calling Langium's
56
+ * directly skips both: the composition check, and the guard without which a
57
+ * publish racing teardown fails the build that validated the document.
55
58
  */
56
59
  export function startLanguageServer(services, serviceRequirements = {}) {
57
60
  assertLspHeadComposed(services);
61
+ const connection = services.lsp.Connection;
62
+ if (connection) {
63
+ guardDiagnosticsConnection(connection);
64
+ }
58
65
  startLangiumLanguageServer(services, serviceRequirements);
59
66
  }
60
67
  //# sourceMappingURL=start-language-server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-language-server.js","sourceRoot":"","sources":["../../src/lsp/start-language-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,mBAAmB,IAAI,0BAA0B,EAGnD,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAA+B;IAClE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;QAC7B,OAAO;IACV,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,qBAAqB,CAAC;IACnD,IAAI,CAAC,CAAC,OAAO,YAAY,8BAA8B,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACZ,oGAAoG;YACjG,IAAI,OAAO,EAAE,WAAW,EAAE,IAAI,IAAI,SAAS,uEAAuE;YAClH,kHAAkH;YAClH,kGAAkG;YAClG,4GAA4G;YAC5G,4CAA4C,CACjD,CAAC;IACL,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAA+B,EAAE,sBAAoD,EAAE;IACxH,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAChC,0BAA0B,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAC7D,CAAC"}
1
+ {"version":3,"file":"start-language-server.js","sourceRoot":"","sources":["../../src/lsp/start-language-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,mBAAmB,IAAI,0BAA0B,EAGnD,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAA+B;IAClE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;QAC7B,OAAO;IACV,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,qBAAqB,CAAC;IACnD,IAAI,CAAC,CAAC,OAAO,YAAY,8BAA8B,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACZ,oGAAoG;YACjG,IAAI,OAAO,EAAE,WAAW,EAAE,IAAI,IAAI,SAAS,uEAAuE;YAClH,kHAAkH;YAClH,kGAAkG;YAClG,4GAA4G;YAC5G,4CAA4C,CACjD,CAAC;IACL,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAA+B,EAAE,sBAAoD,EAAE;IACxH,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC;IAC3C,IAAI,UAAU,EAAE,CAAC;QACd,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IACD,0BAA0B,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAC7D,CAAC"}
@@ -25,4 +25,5 @@ export * from './lsp-harness.js';
25
25
  export * from './lsp-server-connection.js';
26
26
  export * from './scratch-workspace.js';
27
27
  export * from './spawned-server.js';
28
+ export * from './unhandled-rejections.js';
28
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;GAYG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;GAYG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC"}
@@ -25,4 +25,5 @@ export * from './lsp-harness.js';
25
25
  export * from './lsp-server-connection.js';
26
26
  export * from './scratch-workspace.js';
27
27
  export * from './spawned-server.js';
28
+ export * from './unhandled-rejections.js';
28
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;GAYG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;GAYG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"lsp-server-connection.d.ts","sourceRoot":"","sources":["../../../src/testing/node/lsp-server-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,4BAA4B,CAAC;AAgB/E,OAAO,EAYJ,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EAErB,MAAM,qCAAqC,CAAC;AAc7C;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACpC;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,oGAAoG;IACpG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IACzB,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,EAAE,wBAAwB,CAAC;IAC1C;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACxB;AAED,+DAA+D;AAC/D,MAAM,WAAW,sBAAsB;IACpC;;;;OAIG;IACH,QAAQ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EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpF,8FAA8F;IAC9F,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjE;;;;OAIG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACrE,mCAAmC;IACnC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC9D,uDAAuD;IACvD,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAE5D;;;;;;;;;;;;;;;;;OAiBG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAE1G;;;;;;;;;;;;;;;OAeG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEzG;;;;;;;;;OASG;IACH,mBAAmB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,wBAAwB,GAAG,IAAI,CAAC;IAEnG;;;;OAIG;IACH,OAAO,IAAI,IAAI,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,IAAI,mBAAmB,CAkP7D"}
@@ -9,14 +9,13 @@
9
9
  import { makeDuplexStreamPair } from '@hydranium/protocol/testing/node';
10
10
  import { StreamMessageReader, StreamMessageWriter } from 'vscode-jsonrpc/node';
11
11
  import { ProposedFeatures } from 'vscode-languageserver/node';
12
+ import { withHydraniumLspFeatures } from '../../lsp/connection-features.js';
12
13
  // The node `createConnection` from `vscode-languageserver/node` is built for a
13
14
  // standalone server PROCESS: it wires `process.exit()` onto the input stream's
14
15
  // `end`/`close` events, onto the `exit` notification (via its watchDog), and onto
15
- // a parent-pid liveness timer, and it calls `endProtocolConnection()` (a write)
16
- // on stream close. In-process every one of those is fatal — destroying the
17
- // streams at teardown trips the `close` handler, which writes into the destroyed
18
- // stream (an uncatchable synchronous `ERR_STREAM_DESTROYED`) and/or exits the host
19
- // test runner. The lower-level common `createConnection(connectionFactory,
16
+ // a parent-pid liveness timer. In-process every one of those is fatal —
17
+ // destroying the streams at teardown trips the `close` handler, which exits the
18
+ // host test runner. The lower-level common `createConnection(connectionFactory,
20
19
  // watchDog, features)` form does none of that: it lets us inject a no-op-`exit`
21
20
  // WatchDog and build the connection over the in-memory streams, so teardown is the
22
21
  // primitive's responsibility alone.
@@ -94,7 +93,7 @@ export function makeLspServerConnection() {
94
93
  };
95
94
  // Server side reads what the client wrote (clientToServer) and writes what the
96
95
  // client reads (serverToClient), over a ProtocolConnection on the in-memory pair.
97
- const serverConnection = createConnection(logger => createProtocolConnection(new StreamMessageReader(pair.clientToServer), new StreamMessageWriter(pair.serverToClient), logger), watchDog, ProposedFeatures.all);
96
+ const serverConnection = createConnection(logger => createProtocolConnection(new StreamMessageReader(pair.clientToServer), new StreamMessageWriter(pair.serverToClient), logger), watchDog, withHydraniumLspFeatures(ProposedFeatures.all));
98
97
  // Client side mirrors the directions: reads serverToClient, writes clientToServer.
99
98
  const client = createProtocolConnection(new StreamMessageReader(pair.serverToClient), new StreamMessageWriter(pair.clientToServer));
100
99
  client.listen();
@@ -1 +1 @@
1
- {"version":3,"file":"lsp-server-connection.js","sourceRoot":"","sources":["../../../src/testing/node/lsp-server-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAA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C,uBAAuB,CAAC,OAAO,EAAE,CAAC;YAClC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;KACH,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"lsp-server-connection.js","sourceRoot":"","sources":["../../../src/testing/node/lsp-server-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAmB,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,kFAAkF;AAClF,wEAAwE;AACxE,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAChF,mFAAmF;AACnF,oCAAoC;AACpC,8EAA8E;AAC9E,6EAA6E;AAC7E,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAiB,MAAM,uBAAuB,CAAC;AACxE,OAAO,EACJ,yBAAyB,EACzB,iBAAiB,EACjB,iCAAiC,EACjC,+BAA+B,EAC/B,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,8BAA8B,EAC9B,qBAAqB,EACrB,eAAe,EACf,wBAAwB,EAa1B,MAAM,qCAAqC,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,8BAA8B,GAAG,KAAK,CAAC;AAE7C,oGAAoG;AACpG,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAuEnC,8FAA8F;AAC9F,SAAS,UAAU,CAAC,IAAmB;IACpC,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,eAAe,IAAI,EAAE,EAAE,CAAC;QAC/C,IAAI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D,MAAM,CAAC,IAAI,KAAK,CAAC,0DAA0D,GAAG,EAAE,CAAC,CAAC,CAAC;gBACtF,CAAC,EAAE,SAAS,CAAC,CAAC;gBACd,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;QACN,CAAC;QAED,mBAAmB,CAAC,OAAuE;YACxF,gBAAgB,GAAG,OAAO,CAAC;QAC9B,CAAC;QAED,OAAO;YACJ,IAAI,QAAQ,EAAE,CAAC;gBACZ,OAAO;YACV,CAAC;YACD,QAAQ,GAAG,IAAI,CAAC;YAChB,uBAAuB,CAAC,OAAO,EAAE,CAAC;YAClC,uBAAuB,CAAC,OAAO,EAAE,CAAC;YAClC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;KACH,CAAC;AACL,CAAC"}
@@ -0,0 +1,20 @@
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
+ * Run a Node-only assertion while collecting process-level unhandled rejection
11
+ * events. The callback owns the event-loop drain and can therefore choose the
12
+ * right observation window for the operation under test.
13
+ *
14
+ * Inside the window a rejection reaches only the array: while any listener is
15
+ * registered, Node hands none to its default handler and Vitest reports none as
16
+ * an error. A callback that never asserts on the array therefore hides every
17
+ * rejection it provokes.
18
+ */
19
+ export declare function captureUnhandledRejections<T>(callback: (rejections: unknown[]) => Promise<T>): Promise<T>;
20
+ //# sourceMappingURL=unhandled-rejections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unhandled-rejections.d.ts","sourceRoot":"","sources":["../../../src/testing/node/unhandled-rejections.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;GASG;AACH,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAW/G"}
@@ -0,0 +1,32 @@
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
+ * Run a Node-only assertion while collecting process-level unhandled rejection
11
+ * events. The callback owns the event-loop drain and can therefore choose the
12
+ * right observation window for the operation under test.
13
+ *
14
+ * Inside the window a rejection reaches only the array: while any listener is
15
+ * registered, Node hands none to its default handler and Vitest reports none as
16
+ * an error. A callback that never asserts on the array therefore hides every
17
+ * rejection it provokes.
18
+ */
19
+ export async function captureUnhandledRejections(callback) {
20
+ const rejections = [];
21
+ const listener = (reason) => {
22
+ rejections.push(reason);
23
+ };
24
+ process.on('unhandledRejection', listener);
25
+ try {
26
+ return await callback(rejections);
27
+ }
28
+ finally {
29
+ process.off('unhandledRejection', listener);
30
+ }
31
+ }
32
+ //# sourceMappingURL=unhandled-rejections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unhandled-rejections.js","sourceRoot":"","sources":["../../../src/testing/node/unhandled-rejections.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAI,QAA+C;IAChG,MAAM,UAAU,GAAc,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,CAAC,MAAe,EAAQ,EAAE;QACxC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;IAC3C,IAAI,CAAC;QACF,OAAO,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;YAAS,CAAC;QACR,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;AACJ,CAAC"}
@@ -10,12 +10,13 @@
10
10
  * Whether `err` means "the peer is gone", as opposed to a genuine failure of
11
11
  * the operation.
12
12
  *
13
- * The distinction is a **log-severity** one, and it matters because the two are
14
- * indistinguishable at the call site otherwise. Pushing an edit to a language
15
- * client that has already disconnected is a no-op, not a fault — it happens on
16
- * every ordinary shutdown, and reporting it at `error` turns routine teardown
17
- * into something that looks like it needs investigation. A real `applyEdit`
18
- * failure (the client refused, the request malformed) still deserves `error`.
13
+ * The two are indistinguishable at the call site otherwise, and callers act on
14
+ * the answer: a gone peer is logged at `debug` or dropped, a genuine failure is
15
+ * logged at `error` or re-raised as an unhandled rejection. Pushing an edit to
16
+ * a language client that has already disconnected is a no-op, not a fault — it
17
+ * happens on every ordinary shutdown — so a `false` here turns routine teardown
18
+ * into errors that look like they need investigation. A `true` for a real
19
+ * `applyEdit` failure (the client refused, the request malformed) hides it.
19
20
  *
20
21
  * Callers that only need to *survive* a dead connection rather than classify it
21
22
  * should just catch — see `LspLogger.emit`, whose fallback path does exactly
@@ -1 +1 @@
1
- {"version":3,"file":"connection-liveness.d.ts","sourceRoot":"","sources":["../../src/util/connection-liveness.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAoBlF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAI3D"}
1
+ {"version":3,"file":"connection-liveness.d.ts","sourceRoot":"","sources":["../../src/util/connection-liveness.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAuClF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAO3D"}
@@ -7,38 +7,59 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  /**
10
- * Phrases `vscode-jsonrpc` uses when a call loses its connection. Matched on the
11
- * message because the condition surfaces in two different shapes:
10
+ * Phrases that mean a call lost its connection. Matched on the message because
11
+ * the condition surfaces in shapes that share no discriminator:
12
12
  *
13
13
  * - a **throw** from `throwIfClosedOrDisposed` (`Connection is disposed.` /
14
14
  * `Connection is closed.`), a `ConnectionError` raised synchronously by
15
15
  * `sendRequest` / `sendNotification` and by `RemoteConsole.send`;
16
16
  * - a **rejection** of an already-issued request (`Pending response rejected
17
17
  * since connection got disposed`), a `ResponseError` produced when the
18
- * pending-response map is drained on teardown.
18
+ * pending-response map is drained on teardown;
19
+ * - a **write into a destroyed transport** (`Cannot call write after a stream
20
+ * was destroyed`), Node's own error for a message the writer queued before
21
+ * the connection was disposed and flushed after its stream was destroyed.
22
+ * A notification rejects with Node's error itself, which
23
+ * {@link isDestroyedStreamError} catches by its code; a request rejects with
24
+ * a `ResponseError` that copies only the message, so the phrase is needed
25
+ * too.
19
26
  *
20
- * Both are typed, but they are different error classes carrying codes from
21
- * different enums, so no single code check covers both. Kept
22
- * lowercase-normalised and anchored on `connection` so an unrelated "disposed"
23
- * message cannot match.
27
+ * The typed errors come from different classes carrying codes from different
28
+ * enums, so no single code check covers them. Kept lowercase-normalised and
29
+ * anchored on `connection` or `stream` so an unrelated "disposed" message
30
+ * cannot match.
24
31
  */
25
- const CONNECTION_GONE_PATTERNS = [/connection is disposed/, /connection is closed/, /connection got disposed/, /connection got closed/];
32
+ const CONNECTION_GONE_PATTERNS = [
33
+ /connection is disposed/,
34
+ /connection is closed/,
35
+ /connection got disposed/,
36
+ /connection got closed/,
37
+ /after a stream was destroyed/
38
+ ];
39
+ const DESTROYED_STREAM_CODE = 'ERR_STREAM_DESTROYED';
40
+ function isDestroyedStreamError(err) {
41
+ return err instanceof Error && 'code' in err && err.code === DESTROYED_STREAM_CODE;
42
+ }
26
43
  /**
27
44
  * Whether `err` means "the peer is gone", as opposed to a genuine failure of
28
45
  * the operation.
29
46
  *
30
- * The distinction is a **log-severity** one, and it matters because the two are
31
- * indistinguishable at the call site otherwise. Pushing an edit to a language
32
- * client that has already disconnected is a no-op, not a fault — it happens on
33
- * every ordinary shutdown, and reporting it at `error` turns routine teardown
34
- * into something that looks like it needs investigation. A real `applyEdit`
35
- * failure (the client refused, the request malformed) still deserves `error`.
47
+ * The two are indistinguishable at the call site otherwise, and callers act on
48
+ * the answer: a gone peer is logged at `debug` or dropped, a genuine failure is
49
+ * logged at `error` or re-raised as an unhandled rejection. Pushing an edit to
50
+ * a language client that has already disconnected is a no-op, not a fault — it
51
+ * happens on every ordinary shutdown — so a `false` here turns routine teardown
52
+ * into errors that look like they need investigation. A `true` for a real
53
+ * `applyEdit` failure (the client refused, the request malformed) hides it.
36
54
  *
37
55
  * Callers that only need to *survive* a dead connection rather than classify it
38
56
  * should just catch — see `LspLogger.emit`, whose fallback path does exactly
39
57
  * that, since a logger has nowhere to report a logging failure anyway.
40
58
  */
41
59
  export function isConnectionGoneError(err) {
60
+ if (isDestroyedStreamError(err)) {
61
+ return true;
62
+ }
42
63
  const message = err instanceof Error ? err.message : String(err);
43
64
  const normalized = message.toLowerCase();
44
65
  return CONNECTION_GONE_PATTERNS.some(pattern => pattern.test(normalized));
@@ -1 +1 @@
1
- {"version":3,"file":"connection-liveness.js","sourceRoot":"","sources":["../../src/util/connection-liveness.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,wBAAwB,GAAG,CAAC,wBAAwB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AAExI;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAC/C,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7E,CAAC"}
1
+ {"version":3,"file":"connection-liveness.js","sourceRoot":"","sources":["../../src/util/connection-liveness.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,wBAAwB,GAAG;IAC9B,wBAAwB;IACxB,sBAAsB;IACtB,yBAAyB;IACzB,uBAAuB;IACvB,8BAA8B;CAChC,CAAC;AAEF,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAErD,SAAS,sBAAsB,CAAC,GAAY;IACzC,OAAO,GAAG,YAAY,KAAK,IAAI,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,qBAAqB,CAAC;AACtF,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAC/C,IAAI,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydranium/core",
3
- "version": "1.0.0-next.109",
3
+ "version": "1.0.0-next.111",
4
4
  "description": "Foundational runtime of the hydranium framework: AST coordination layer (services, integrity, AST extension, serialization, multi-client documents) plus the LSP textual head at the /lsp subpath. Consumed by protocol-head packages (@hydranium/data-server, @hydranium/glsp-server).",
5
5
  "keywords": [
6
6
  "hydranium",
@@ -104,8 +104,8 @@
104
104
  "diff": "^5.2.0"
105
105
  },
106
106
  "devDependencies": {
107
- "@hydranium/langium": "1.0.0-next.109",
108
- "@hydranium/protocol": "1.0.0-next.109",
107
+ "@hydranium/langium": "1.0.0-next.111",
108
+ "@hydranium/protocol": "1.0.0-next.111",
109
109
  "@playwright/test": "^1.40.0",
110
110
  "@types/diff": "^5.2.0",
111
111
  "rimraf": "^5.0.0",
@@ -117,8 +117,8 @@
117
117
  "vscode-languageserver-types": "^3.17.5"
118
118
  },
119
119
  "peerDependencies": {
120
- "@hydranium/langium": "1.0.0-next.109",
121
- "@hydranium/protocol": "1.0.0-next.109",
120
+ "@hydranium/langium": "1.0.0-next.111",
121
+ "@hydranium/protocol": "1.0.0-next.111",
122
122
  "@playwright/test": "^1.40.0",
123
123
  "vscode-jsonrpc": "9.0.1",
124
124
  "vscode-languageserver": "~10.0.1",
@@ -0,0 +1,67 @@
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
+ import { LogMessageNotification, MessageType, type Features, type RemoteConsole } from 'vscode-languageserver';
11
+ import { isConnectionGoneError } from '../util/connection-liveness.js';
12
+
13
+ /**
14
+ * Add Hydranium's connection-liveness handling to a language-server
15
+ * connection's console. The upstream `RemoteConsole` catches every failed log
16
+ * notification and prints `Sending log message failed`, so every ordinary
17
+ * teardown reports a failure; this console drops only a failure that
18
+ * {@link isConnectionGoneError} recognises and re-raises any other as an
19
+ * unhandled rejection.
20
+ *
21
+ * Supply it where the connection is created. `createConnection` builds the
22
+ * console from these features, so a connection that already exists keeps the
23
+ * upstream console for its whole lifetime.
24
+ */
25
+ export function withHydraniumLspFeatures<T extends Features>(features: T): T {
26
+ return {
27
+ ...features,
28
+ console: (Base: new () => RemoteConsole) =>
29
+ class extends Base {
30
+ override error(message: string): void {
31
+ this.sendLogMessage(MessageType.Error, message);
32
+ }
33
+
34
+ override warn(message: string): void {
35
+ this.sendLogMessage(MessageType.Warning, message);
36
+ }
37
+
38
+ override info(message: string): void {
39
+ this.sendLogMessage(MessageType.Info, message);
40
+ }
41
+
42
+ override log(message: string): void {
43
+ this.sendLogMessage(MessageType.Log, message);
44
+ }
45
+
46
+ override debug(message: string): void {
47
+ this.sendLogMessage(MessageType.Debug, message);
48
+ }
49
+
50
+ private sendLogMessage(type: MessageType, message: string): void {
51
+ try {
52
+ void this.connection.sendNotification(LogMessageNotification.type, { type, message }).catch(error => {
53
+ this.handleLogSendFailure(error);
54
+ });
55
+ } catch (error) {
56
+ this.handleLogSendFailure(error);
57
+ }
58
+ }
59
+
60
+ private handleLogSendFailure(error: unknown): void {
61
+ if (!isConnectionGoneError(error)) {
62
+ void Promise.reject(error);
63
+ }
64
+ }
65
+ }
66
+ } as T;
67
+ }
@@ -0,0 +1,56 @@
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
+ import type { Connection } from 'vscode-languageserver';
11
+ import { isConnectionGoneError } from '../util/connection-liveness.js';
12
+
13
+ const wrappedConnections = new WeakSet<object>();
14
+
15
+ /**
16
+ * Protect Langium's fire-and-forget diagnostics publish from the expected
17
+ * failure caused by a peer disconnecting during teardown.
18
+ *
19
+ * A publish issued after the connection is disposed throws synchronously
20
+ * instead of rejecting, and Langium's publisher is a document-phase listener,
21
+ * so an unguarded throw fails the build that validated the document. The
22
+ * `try` answers that case with a resolved promise; a guard on the promise
23
+ * alone never sees it.
24
+ *
25
+ * Otherwise the original promise is returned unchanged. The detached catch is
26
+ * deliberate: it marks the original promise as observed, suppresses only the
27
+ * expected connection-liveness error, and rethrows unexpected failures so they
28
+ * stay visible as unhandled rejections, as an unguarded fire-and-forget send
29
+ * would leave them.
30
+ */
31
+ export function guardDiagnosticsConnection(connection: Connection): void {
32
+ if (wrappedConnections.has(connection)) {
33
+ return;
34
+ }
35
+ wrappedConnections.add(connection);
36
+
37
+ const sendDiagnostics = connection.sendDiagnostics.bind(connection);
38
+ connection.sendDiagnostics = params => {
39
+ let result: Promise<void>;
40
+ try {
41
+ result = sendDiagnostics(params);
42
+ } catch (error: unknown) {
43
+ if (isConnectionGoneError(error)) {
44
+ return Promise.resolve();
45
+ }
46
+ throw error;
47
+ }
48
+ void result.catch(error => {
49
+ if (isConnectionGoneError(error)) {
50
+ return;
51
+ }
52
+ throw error;
53
+ });
54
+ return result;
55
+ };
56
+ }
@@ -16,6 +16,7 @@ import { LANGUAGE_CLIENT_ID } from '../documents/client-ids.js';
16
16
  import { type SelfSaveRegistry } from '../documents/self-save-registry.js';
17
17
  import { type WritableFileSystemProvider } from '../documents/ast-document-manager.js';
18
18
  import { type HydraniumTextDocuments } from '../documents/hydranium-text-documents.js';
19
+ import { isConnectionGoneError } from '../util/connection-liveness.js';
19
20
  import { type DidChangeWatchedFilesParams, type FileEvent, FileChangeType, type TextDocumentChangeEvent } from 'vscode-languageserver';
20
21
  import { type TextDocument } from 'vscode-languageserver-textdocument';
21
22
 
@@ -338,6 +339,14 @@ export class HydraniumDocumentUpdateHandler extends DefaultDocumentUpdateHandler
338
339
  })
339
340
  )
340
341
  .catch(err => {
342
+ // A deferred rebuild can finish after the LSP peer has gone away.
343
+ // Unless the head was started through `startLanguageServer`, whose
344
+ // guard absorbs it, the diagnostics publish then fails this build:
345
+ // a routine teardown race, not a failed workspace update. Keep
346
+ // genuine update failures visible.
347
+ if (isConnectionGoneError(err)) {
348
+ return;
349
+ }
341
350
  const detail = err instanceof Error ? (err.stack ?? err.message) : String(err);
342
351
  this.logger.error(`Workspace initialization failed. Could not perform document update. ${detail}`);
343
352
  });
package/src/lsp/index.ts CHANGED
@@ -9,6 +9,8 @@
9
9
 
10
10
  export * from './completion/hydranium-completion-provider.js';
11
11
  export * from './lsp-latency.js';
12
+ export * from './connection-features.js';
13
+ export * from './diagnostics-connection.js';
12
14
  export * from './semantic-token-provider.js';
13
15
  export * from './language-module.js';
14
16
  export * from './shared-module.js';
@@ -13,6 +13,7 @@ import {
13
13
  type ServiceRequirements
14
14
  } from '@hydranium/langium/lsp';
15
15
  import { HydraniumDocumentUpdateHandler } from './hydranium-document-update-handler.js';
16
+ import { guardDiagnosticsConnection } from './diagnostics-connection.js';
16
17
 
17
18
  /**
18
19
  * Fail the LSP head's start when its shared module was never composed.
@@ -58,11 +59,17 @@ export function assertLspHeadComposed(services: LangiumSharedServices): void {
58
59
 
59
60
  /**
60
61
  * The framework's LSP server entry point: {@link assertLspHeadComposed}, then
61
- * Langium's `startLanguageServer` unchanged. Signature-compatible with
62
- * Langium's, so it is a drop-in for adopters importing from
63
- * `@hydranium/core/lsp`.
62
+ * {@link guardDiagnosticsConnection} on the tree's connection, then Langium's
63
+ * `startLanguageServer`. Signature-compatible with Langium's, so it is a
64
+ * drop-in for adopters importing from `@hydranium/core/lsp`. Calling Langium's
65
+ * directly skips both: the composition check, and the guard without which a
66
+ * publish racing teardown fails the build that validated the document.
64
67
  */
65
68
  export function startLanguageServer(services: LangiumSharedServices, serviceRequirements: Partial<ServiceRequirements> = {}): void {
66
69
  assertLspHeadComposed(services);
70
+ const connection = services.lsp.Connection;
71
+ if (connection) {
72
+ guardDiagnosticsConnection(connection);
73
+ }
67
74
  startLangiumLanguageServer(services, serviceRequirements);
68
75
  }
@@ -27,3 +27,4 @@ export * from './lsp-harness.js';
27
27
  export * from './lsp-server-connection.js';
28
28
  export * from './scratch-workspace.js';
29
29
  export * from './spawned-server.js';
30
+ export * from './unhandled-rejections.js';
@@ -11,14 +11,13 @@ import { type Harness } from '@hydranium/protocol/testing';
11
11
  import { makeDuplexStreamPair } from '@hydranium/protocol/testing/node';
12
12
  import { StreamMessageReader, StreamMessageWriter } from 'vscode-jsonrpc/node';
13
13
  import { type Connection, ProposedFeatures } from 'vscode-languageserver/node';
14
+ import { withHydraniumLspFeatures } from '../../lsp/connection-features.js';
14
15
  // The node `createConnection` from `vscode-languageserver/node` is built for a
15
16
  // standalone server PROCESS: it wires `process.exit()` onto the input stream's
16
17
  // `end`/`close` events, onto the `exit` notification (via its watchDog), and onto
17
- // a parent-pid liveness timer, and it calls `endProtocolConnection()` (a write)
18
- // on stream close. In-process every one of those is fatal — destroying the
19
- // streams at teardown trips the `close` handler, which writes into the destroyed
20
- // stream (an uncatchable synchronous `ERR_STREAM_DESTROYED`) and/or exits the host
21
- // test runner. The lower-level common `createConnection(connectionFactory,
18
+ // a parent-pid liveness timer. In-process every one of those is fatal —
19
+ // destroying the streams at teardown trips the `close` handler, which exits the
20
+ // host test runner. The lower-level common `createConnection(connectionFactory,
22
21
  // watchDog, features)` form does none of that: it lets us inject a no-op-`exit`
23
22
  // WatchDog and build the connection over the in-memory streams, so teardown is the
24
23
  // primitive's responsibility alone.
@@ -347,7 +346,7 @@ export function makeLspServerConnection(): LspServerConnection {
347
346
  logger =>
348
347
  createProtocolConnection(new StreamMessageReader(pair.clientToServer), new StreamMessageWriter(pair.serverToClient), logger),
349
348
  watchDog,
350
- ProposedFeatures.all
349
+ withHydraniumLspFeatures(ProposedFeatures.all)
351
350
  );
352
351
 
353
352
  // Client side mirrors the directions: reads serverToClient, writes clientToServer.
@@ -0,0 +1,31 @@
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
+ * Run a Node-only assertion while collecting process-level unhandled rejection
12
+ * events. The callback owns the event-loop drain and can therefore choose the
13
+ * right observation window for the operation under test.
14
+ *
15
+ * Inside the window a rejection reaches only the array: while any listener is
16
+ * registered, Node hands none to its default handler and Vitest reports none as
17
+ * an error. A callback that never asserts on the array therefore hides every
18
+ * rejection it provokes.
19
+ */
20
+ export async function captureUnhandledRejections<T>(callback: (rejections: unknown[]) => Promise<T>): Promise<T> {
21
+ const rejections: unknown[] = [];
22
+ const listener = (reason: unknown): void => {
23
+ rejections.push(reason);
24
+ };
25
+ process.on('unhandledRejection', listener);
26
+ try {
27
+ return await callback(rejections);
28
+ } finally {
29
+ process.off('unhandledRejection', listener);
30
+ }
31
+ }
@@ -8,39 +8,62 @@
8
8
  ********************************************************************************/
9
9
 
10
10
  /**
11
- * Phrases `vscode-jsonrpc` uses when a call loses its connection. Matched on the
12
- * message because the condition surfaces in two different shapes:
11
+ * Phrases that mean a call lost its connection. Matched on the message because
12
+ * the condition surfaces in shapes that share no discriminator:
13
13
  *
14
14
  * - a **throw** from `throwIfClosedOrDisposed` (`Connection is disposed.` /
15
15
  * `Connection is closed.`), a `ConnectionError` raised synchronously by
16
16
  * `sendRequest` / `sendNotification` and by `RemoteConsole.send`;
17
17
  * - a **rejection** of an already-issued request (`Pending response rejected
18
18
  * since connection got disposed`), a `ResponseError` produced when the
19
- * pending-response map is drained on teardown.
19
+ * pending-response map is drained on teardown;
20
+ * - a **write into a destroyed transport** (`Cannot call write after a stream
21
+ * was destroyed`), Node's own error for a message the writer queued before
22
+ * the connection was disposed and flushed after its stream was destroyed.
23
+ * A notification rejects with Node's error itself, which
24
+ * {@link isDestroyedStreamError} catches by its code; a request rejects with
25
+ * a `ResponseError` that copies only the message, so the phrase is needed
26
+ * too.
20
27
  *
21
- * Both are typed, but they are different error classes carrying codes from
22
- * different enums, so no single code check covers both. Kept
23
- * lowercase-normalised and anchored on `connection` so an unrelated "disposed"
24
- * message cannot match.
28
+ * The typed errors come from different classes carrying codes from different
29
+ * enums, so no single code check covers them. Kept lowercase-normalised and
30
+ * anchored on `connection` or `stream` so an unrelated "disposed" message
31
+ * cannot match.
25
32
  */
26
- const CONNECTION_GONE_PATTERNS = [/connection is disposed/, /connection is closed/, /connection got disposed/, /connection got closed/];
33
+ const CONNECTION_GONE_PATTERNS = [
34
+ /connection is disposed/,
35
+ /connection is closed/,
36
+ /connection got disposed/,
37
+ /connection got closed/,
38
+ /after a stream was destroyed/
39
+ ];
40
+
41
+ const DESTROYED_STREAM_CODE = 'ERR_STREAM_DESTROYED';
42
+
43
+ function isDestroyedStreamError(err: unknown): boolean {
44
+ return err instanceof Error && 'code' in err && err.code === DESTROYED_STREAM_CODE;
45
+ }
27
46
 
28
47
  /**
29
48
  * Whether `err` means "the peer is gone", as opposed to a genuine failure of
30
49
  * the operation.
31
50
  *
32
- * The distinction is a **log-severity** one, and it matters because the two are
33
- * indistinguishable at the call site otherwise. Pushing an edit to a language
34
- * client that has already disconnected is a no-op, not a fault — it happens on
35
- * every ordinary shutdown, and reporting it at `error` turns routine teardown
36
- * into something that looks like it needs investigation. A real `applyEdit`
37
- * failure (the client refused, the request malformed) still deserves `error`.
51
+ * The two are indistinguishable at the call site otherwise, and callers act on
52
+ * the answer: a gone peer is logged at `debug` or dropped, a genuine failure is
53
+ * logged at `error` or re-raised as an unhandled rejection. Pushing an edit to
54
+ * a language client that has already disconnected is a no-op, not a fault — it
55
+ * happens on every ordinary shutdown — so a `false` here turns routine teardown
56
+ * into errors that look like they need investigation. A `true` for a real
57
+ * `applyEdit` failure (the client refused, the request malformed) hides it.
38
58
  *
39
59
  * Callers that only need to *survive* a dead connection rather than classify it
40
60
  * should just catch — see `LspLogger.emit`, whose fallback path does exactly
41
61
  * that, since a logger has nowhere to report a logging failure anyway.
42
62
  */
43
63
  export function isConnectionGoneError(err: unknown): boolean {
64
+ if (isDestroyedStreamError(err)) {
65
+ return true;
66
+ }
44
67
  const message = err instanceof Error ? err.message : String(err);
45
68
  const normalized = message.toLowerCase();
46
69
  return CONNECTION_GONE_PATTERNS.some(pattern => pattern.test(normalized));