@hydranium/core 1.0.0-next.31 → 1.0.0-next.32
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/lib/documents/hydranium-text-documents.d.ts.map +1 -1
- package/lib/documents/hydranium-text-documents.js +12 -1
- package/lib/documents/hydranium-text-documents.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/langium/bootstrap.d.ts.map +1 -1
- package/lib/langium/bootstrap.js +8 -1
- package/lib/langium/bootstrap.js.map +1 -1
- package/lib/langium/document-builder/document-builder.d.ts +33 -1
- package/lib/langium/document-builder/document-builder.d.ts.map +1 -1
- package/lib/langium/document-builder/document-builder.js +68 -2
- package/lib/langium/document-builder/document-builder.js.map +1 -1
- package/lib/langium/model-service/model-service.d.ts +26 -0
- package/lib/langium/model-service/model-service.d.ts.map +1 -1
- package/lib/langium/model-service/model-service.js +31 -3
- package/lib/langium/model-service/model-service.js.map +1 -1
- package/lib/langium/module.d.ts +20 -0
- package/lib/langium/module.d.ts.map +1 -1
- package/lib/langium/module.js +4 -0
- package/lib/langium/module.js.map +1 -1
- package/lib/langium/naming/name-provider.d.ts +10 -0
- package/lib/langium/naming/name-provider.d.ts.map +1 -1
- package/lib/langium/naming/name-provider.js.map +1 -1
- package/lib/langium/naming/name-separator-validation.d.ts +23 -1
- package/lib/langium/naming/name-separator-validation.d.ts.map +1 -1
- package/lib/langium/naming/name-separator-validation.js +22 -0
- package/lib/langium/naming/name-separator-validation.js.map +1 -1
- package/lib/langium/shared-services.d.ts +13 -2
- package/lib/langium/shared-services.d.ts.map +1 -1
- package/lib/langium/shared-services.js.map +1 -1
- package/lib/langium/validation/document-validator.d.ts +66 -1
- package/lib/langium/validation/document-validator.d.ts.map +1 -1
- package/lib/langium/validation/document-validator.js +101 -1
- package/lib/langium/validation/document-validator.js.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts +11 -1
- package/lib/langium/workspace/hydranium-workspace-manager.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-workspace-manager.js +15 -0
- package/lib/langium/workspace/hydranium-workspace-manager.js.map +1 -1
- package/lib/langium/workspace/initialize-workspace.d.ts +22 -2
- package/lib/langium/workspace/initialize-workspace.d.ts.map +1 -1
- package/lib/langium/workspace/initialize-workspace.js +13 -5
- package/lib/langium/workspace/initialize-workspace.js.map +1 -1
- package/lib/locale/index.d.ts +10 -0
- package/lib/locale/index.d.ts.map +1 -0
- package/lib/locale/index.js +10 -0
- package/lib/locale/index.js.map +1 -0
- package/lib/locale/server-locale.d.ts +49 -0
- package/lib/locale/server-locale.d.ts.map +1 -0
- package/lib/locale/server-locale.js +51 -0
- package/lib/locale/server-locale.js.map +1 -0
- package/lib/messages/carriers.d.ts +7 -6
- package/lib/messages/carriers.d.ts.map +1 -1
- package/lib/messages/carriers.js +8 -7
- package/lib/messages/carriers.js.map +1 -1
- package/lib/messages/index.d.ts +3 -0
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +3 -0
- package/lib/messages/index.js.map +1 -1
- package/lib/messages/renderer.d.ts +117 -0
- package/lib/messages/renderer.d.ts.map +1 -0
- package/lib/messages/renderer.js +159 -0
- package/lib/messages/renderer.js.map +1 -0
- package/lib/testing/make-noop-shared-services.d.ts +14 -0
- package/lib/testing/make-noop-shared-services.d.ts.map +1 -1
- package/lib/testing/make-noop-shared-services.js +28 -2
- package/lib/testing/make-noop-shared-services.js.map +1 -1
- package/lib/testing/make-test-services.d.ts +27 -0
- package/lib/testing/make-test-services.d.ts.map +1 -1
- package/lib/testing/make-test-services.js +17 -1
- package/lib/testing/make-test-services.js.map +1 -1
- package/package.json +5 -5
- package/src/documents/hydranium-text-documents.ts +12 -1
- package/src/index.ts +1 -0
- package/src/langium/bootstrap.ts +8 -1
- package/src/langium/document-builder/document-builder.ts +70 -2
- package/src/langium/model-service/model-service.ts +33 -2
- package/src/langium/module.ts +22 -0
- package/src/langium/naming/name-provider.ts +10 -0
- package/src/langium/naming/name-separator-validation.ts +25 -3
- package/src/langium/shared-services.ts +13 -2
- package/src/langium/validation/document-validator.ts +117 -1
- package/src/langium/workspace/hydranium-workspace-manager.ts +18 -1
- package/src/langium/workspace/initialize-workspace.ts +34 -5
- package/src/locale/index.ts +10 -0
- package/src/locale/server-locale.ts +61 -0
- package/src/messages/carriers.ts +8 -8
- package/src/messages/index.ts +3 -0
- package/src/messages/renderer.ts +184 -0
- package/src/testing/make-noop-shared-services.ts +50 -2
- package/src/testing/make-test-services.ts +43 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-validator.d.ts","sourceRoot":"","sources":["../../../src/langium/validation/document-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"document-validator.d.ts","sourceRoot":"","sources":["../../../src/langium/validation/document-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAIJ,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,eAAe,EACf,KAAK,MAAM,EAEb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACJ,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACtD,OAAO,CAAC,E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C,EAAE,iBAAiB,EAC3B,WAAW,CAAC,EAAE,iBAAiB,GAC/B,OAAO,CAAC,UAAU,EAAE,CAAC;IAqBxB;;;OAGG;cACgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,GAAG,yBAAyB;IAOlH;;;;;;;OAOG;IACH,SAAS,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAItD;;;;;;;;;;;;;;;;;;;OAmBG;cACgB,oBAAoB,CAAC,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAQ/H;;;;;;;;OAQG;IACH,SAAS,CAAC,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;IAkBlE;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;cAapF,YAAY,CAAC,CAAC,SAAS,OAAO,EAC9C,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,GAC/B,qBAAqB;IAWxB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,gBAAgB,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,MAAM;CAejG"}
|
|
@@ -6,10 +6,26 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { ObservableValue, TransferDiagnostic } from '@hydranium/protocol';
|
|
9
|
+
import { defineMessage, describeError, messageData, ObservableValue, TransferDiagnostic } from '@hydranium/protocol';
|
|
10
10
|
import { DefaultDocumentValidator } from '@hydranium/langium';
|
|
11
11
|
import { isSyntheticNode } from '../workspace/synthetic.js';
|
|
12
12
|
import { isVirtualUri } from '../workspace/virtual-document.js';
|
|
13
|
+
/**
|
|
14
|
+
* A reference resolved to nothing.
|
|
15
|
+
*
|
|
16
|
+
* **The English is byte-identical to Langium's `DefaultLinker.createLinkingError`
|
|
17
|
+
* sentence, and must stay so.** The identity is attached to a diagnostic Langium
|
|
18
|
+
* already worded, so a divergence here would silently change the text every
|
|
19
|
+
* adopter without a catalogue sees. {@link HydraniumDocumentValidator.processLinkingErrors}
|
|
20
|
+
* attaches it only when the two match exactly, which is also what keeps an
|
|
21
|
+
* adopter's own reworded linking error from being mislabelled as this one.
|
|
22
|
+
*
|
|
23
|
+
* It exists because this is the most-seen validation error in any language built
|
|
24
|
+
* on the framework, and Langium puts its own code in `data.code` rather than on
|
|
25
|
+
* `Diagnostic.code` — so without a framework identity every adopter wanting to
|
|
26
|
+
* render it has to special-case Langium's shape.
|
|
27
|
+
*/
|
|
28
|
+
export const UNRESOLVED_REFERENCE = defineMessage('hydranium/core/unresolved-reference', "Could not resolve reference to {referenceType} named '{refText}'.");
|
|
13
29
|
/**
|
|
14
30
|
* Default validator behaviour for `@hydranium/core` consumers:
|
|
15
31
|
*
|
|
@@ -24,6 +40,7 @@ import { isVirtualUri } from '../workspace/virtual-document.js';
|
|
|
24
40
|
export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
25
41
|
tracer;
|
|
26
42
|
astNodeLocator;
|
|
43
|
+
reflection;
|
|
27
44
|
logLevel;
|
|
28
45
|
logAfterMs;
|
|
29
46
|
validateVirtualDocuments;
|
|
@@ -32,6 +49,7 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
32
49
|
super(services);
|
|
33
50
|
this.tracer = services.shared.Tracer.for(options.logName ?? 'DocumentValidator').trace('instantiated');
|
|
34
51
|
this.astNodeLocator = services.workspace.AstNodeLocator;
|
|
52
|
+
this.reflection = services.shared.AstReflection;
|
|
35
53
|
this.logLevel = ObservableValue.from(options.logLevel ?? 'debug');
|
|
36
54
|
this.logAfterMs = ObservableValue.from(options.logAfterMs ?? 20);
|
|
37
55
|
this.validateVirtualDocuments = ObservableValue.from(options.validateVirtualDocuments ?? false);
|
|
@@ -78,6 +96,88 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
|
78
96
|
shouldSkipValidation(node) {
|
|
79
97
|
return !this.validateSyntheticNodes.value && isSyntheticNode(node);
|
|
80
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Langium's linking-error pass, plus the framework identity on each
|
|
101
|
+
* diagnostic it produced.
|
|
102
|
+
*
|
|
103
|
+
* Langium puts its own `linking-error` marker in `data.code` and leaves
|
|
104
|
+
* `Diagnostic.code` unset, so nothing identifies the message on a surface
|
|
105
|
+
* that drops `data` — which is every editor surface. This adds the framework
|
|
106
|
+
* identity to both `code` and `data.hydranium` while LEAVING `data.code` in
|
|
107
|
+
* place: `stopAfterLinkingErrors` and Langium's code-action dispatch both
|
|
108
|
+
* read it.
|
|
109
|
+
*
|
|
110
|
+
* **The identity is attached only when the message is the one
|
|
111
|
+
* {@link UNRESOLVED_REFERENCE} renders.** Two other sentences reach this
|
|
112
|
+
* list: the linker's exception form, raised when resolution itself throws,
|
|
113
|
+
* and whatever an adopter overriding `createLinkingError` chose. Labelling
|
|
114
|
+
* either would make a catalogue render the wrong sentence — and for the
|
|
115
|
+
* exception form it would discard the underlying cause. Comparing against
|
|
116
|
+
* the locally rendered English is what discriminates; there is no structural
|
|
117
|
+
* field that does.
|
|
118
|
+
*/
|
|
119
|
+
processLinkingErrors(document, diagnostics, options) {
|
|
120
|
+
const from = diagnostics.length;
|
|
121
|
+
super.processLinkingErrors(document, diagnostics, options);
|
|
122
|
+
for (let index = from; index < diagnostics.length; index++) {
|
|
123
|
+
diagnostics[index] = this.identifyLinkingError(diagnostics[index]);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Add the {@link UNRESOLVED_REFERENCE} identity to one linking diagnostic,
|
|
128
|
+
* or return it untouched when its message is not the sentence that identity
|
|
129
|
+
* renders.
|
|
130
|
+
*
|
|
131
|
+
* `refText` comes from the `data` Langium populated; `referenceType` is not
|
|
132
|
+
* in it, so it is recovered the same way `createLinkingError` produced it —
|
|
133
|
+
* through the reflection, from the container type and property.
|
|
134
|
+
*/
|
|
135
|
+
identifyLinkingError(diagnostic) {
|
|
136
|
+
const data = diagnostic.data;
|
|
137
|
+
if (typeof data?.refText !== 'string' || typeof data.containerType !== 'string' || typeof data.property !== 'string') {
|
|
138
|
+
return diagnostic;
|
|
139
|
+
}
|
|
140
|
+
const referenceType = this.referenceTypeOf(data.containerType, data.property, data.refText);
|
|
141
|
+
if (referenceType === undefined) {
|
|
142
|
+
return diagnostic;
|
|
143
|
+
}
|
|
144
|
+
const params = { referenceType, refText: data.refText };
|
|
145
|
+
if (diagnostic.message !== UNRESOLVED_REFERENCE.format(params)) {
|
|
146
|
+
return diagnostic;
|
|
147
|
+
}
|
|
148
|
+
// Merged OVER Langium's data rather than replacing it, so `data.code`
|
|
149
|
+
// survives for the readers that switch on it.
|
|
150
|
+
return { ...diagnostic, code: UNRESOLVED_REFERENCE.code, data: { ...data, ...messageData(UNRESOLVED_REFERENCE, params) } };
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The declared target type of the reference this diagnostic came from, or
|
|
154
|
+
* `undefined` when the reflection cannot name one.
|
|
155
|
+
*
|
|
156
|
+
* **The lookup can throw, and that is the reason this is a method rather
|
|
157
|
+
* than an inline call.** `AbstractAstReflection.getReferenceType` raises on
|
|
158
|
+
* an unknown container `$type` and on a property that is not a reference —
|
|
159
|
+
* and the linking error whose type it cannot name is the one most likely to
|
|
160
|
+
* reach here, because `DefaultLinker` catches its OWN failed lookup and
|
|
161
|
+
* turns it into the exception-form message. Rethrowing would take
|
|
162
|
+
* `validateDocument` with it, since Langium wraps `processLinkingErrors` in
|
|
163
|
+
* no try: a diagnostic Langium degraded gracefully would become a failed
|
|
164
|
+
* build. Declining is also the right answer on the merits — a reference
|
|
165
|
+
* whose type cannot be named is not the message
|
|
166
|
+
* {@link UNRESOLVED_REFERENCE} claims.
|
|
167
|
+
*/
|
|
168
|
+
referenceTypeOf(containerType, property, refText) {
|
|
169
|
+
try {
|
|
170
|
+
return this.reflection.getReferenceType({
|
|
171
|
+
container: { $type: containerType },
|
|
172
|
+
property,
|
|
173
|
+
reference: { $refText: refText }
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
this.tracer.debug(`cannot name the reference type for ${containerType}.${property}: ${describeError(err)}`);
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
81
181
|
toDiagnostic(severity, message, info) {
|
|
82
182
|
const base = super.toDiagnostic(severity, message, info);
|
|
83
183
|
const node = info.node;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-validator.js","sourceRoot":"","sources":["../../../src/langium/validation/document-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"document-validator.js","sourceRoot":"","sources":["../../../src/langium/validation/document-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,aAAa,EACb,aAAa,EACb,WAAW,EAGX,eAAe,EAEf,kBAAkB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIJ,wBAAwB,EAO1B,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAyBhE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC9C,qCAAqC,EACrC,mEAAmE,CACrE,CAAC;AAkCF;;;;;;;;;;GAUG;AACH,MAAM,OAAO,0BAA2B,SAAQ,wBAAwB;IAClD,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CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,IAAK,EAAE,KAAK,EAAE,OAAO,EAAc,CAAC,CAAC;QACtI,MAAM,QAAQ,GAAG,UAAU,IAAI,aAAa,CAAC;QAC7C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;YAC9F,OAAO,EAAE,CAAC;QACb,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC,uBAAuB,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC;YAC/G,OAAO,QAAQ,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ;YACjB,CAAC,CAAC,GAAG,QAAQ,GAAG,kBAAkB,CAAC,yBAAyB,GAAG,IAAI,CAAC,QAAQ,GAAG,kBAAkB,CAAC,uBAAuB,GAAG,IAAI,CAAC,KAAK,EAAE;YACxI,CAAC,CAAC,GAAG,QAAQ,GAAG,kBAAkB,CAAC,uBAAuB,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAChF,CAAC;CACH"}
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { Deferred, type Logger, type Tracer } from '@hydranium/protocol';
|
|
10
10
|
import { DefaultWorkspaceManager, type LangiumDocument, type URI } from '@hydranium/langium';
|
|
11
|
-
import { type CancellationToken } from 'vscode-languageserver';
|
|
11
|
+
import { type CancellationToken, type InitializeParams } from 'vscode-languageserver';
|
|
12
12
|
import type { WorkspaceFolder } from 'vscode-languageserver-types';
|
|
13
13
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
14
|
+
import type { ServerLocale } from '../../locale/server-locale.js';
|
|
14
15
|
import type { ProjectChangeEvent } from '../project/project-change-event.js';
|
|
15
16
|
import type { ProjectManager } from '../project/project-manager.js';
|
|
16
17
|
import type { ServerSharedServicesMinimal } from '../shared-services.js';
|
|
@@ -114,6 +115,8 @@ export declare class HydraniumWorkspaceManager extends DefaultWorkspaceManager {
|
|
|
114
115
|
*/
|
|
115
116
|
readonly workspaceInitialized: Promise<unknown>;
|
|
116
117
|
protected readonly uriPolicy: DocumentUriPolicy;
|
|
118
|
+
/** Handed the client's locale at init; read by whoever renders in it. */
|
|
119
|
+
protected readonly serverLocale: ServerLocale;
|
|
117
120
|
protected readonly writableFileSystemProvider: WritableFileSystemProvider;
|
|
118
121
|
protected readonly additionalDocuments: Record<string, AdditionalDocumentContribution>;
|
|
119
122
|
/** Registry consulted by {@link warnIfUnroutable} to check a seeded document routes. */
|
|
@@ -199,6 +202,13 @@ export declare class HydraniumWorkspaceManager extends DefaultWorkspaceManager {
|
|
|
199
202
|
* server's file name and the harness's correlation key agree.
|
|
200
203
|
*/
|
|
201
204
|
protected resolveWorkspaceLogTarget(folders: WorkspaceFolder[]): void;
|
|
205
|
+
/**
|
|
206
|
+
* Forward the locale the client declared, then Langium's own read of the
|
|
207
|
+
* params. `DefaultWorkspaceManager.initialize` reads `workspaceFolders`
|
|
208
|
+
* alone, so `params.locale` would otherwise be discarded — and this is the
|
|
209
|
+
* only place it arrives, which the headless init seams route through too.
|
|
210
|
+
*/
|
|
211
|
+
initialize(params: InitializeParams): void;
|
|
202
212
|
/**
|
|
203
213
|
* Override of Langium's workspace setup to resolve / reject
|
|
204
214
|
* {@link workspaceInitializedDeferred} once setup completes. Adopters with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-workspace-manager.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-workspace-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,QAAQ,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAiB,KAAK,eAAe,EAAY,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACtH,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"hydranium-workspace-manager.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-workspace-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,QAAQ,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAiB,KAAK,eAAe,EAAY,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACtH,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,KAAK,cAAc,EAAsD,MAAM,0BAA0B,CAAC;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAE,KAAK,iBAAiB,EAA0B,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,KAAK,8BAA8B,EAA8B,MAAM,uCAAuC,CAAC;AAmBxH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAKrF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAazE;AAED;;;;;;;;;;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AAE,GAAG,eAAe,EAAE;IAa5H;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,IAAI;IAqB/D;;;;;;OAMG;IACH,SAAS,CAAC,yBAAyB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,IAAI;IAOrE;;;;;OAKG;IACM,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAOnD;;;;;;;OAOG;IACY,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,WAAW,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9G;;;;;;;;;OASG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI;IAS5D;;;;;;;OAOG;IACH,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM;CAI/D"}
|
|
@@ -141,6 +141,8 @@ export class HydraniumWorkspaceManager extends DefaultWorkspaceManager {
|
|
|
141
141
|
*/
|
|
142
142
|
workspaceInitialized = this.workspaceInitializedDeferred.promise;
|
|
143
143
|
uriPolicy;
|
|
144
|
+
/** Handed the client's locale at init; read by whoever renders in it. */
|
|
145
|
+
serverLocale;
|
|
144
146
|
writableFileSystemProvider;
|
|
145
147
|
additionalDocuments;
|
|
146
148
|
/** Registry consulted by {@link warnIfUnroutable} to check a seeded document routes. */
|
|
@@ -150,6 +152,7 @@ export class HydraniumWorkspaceManager extends DefaultWorkspaceManager {
|
|
|
150
152
|
this.projectManager = services.workspace.ProjectManager;
|
|
151
153
|
this.projectManager.onProjectsChanged(event => this.onProjectsChanged(event));
|
|
152
154
|
this.uriPolicy = services.workspace.DocumentUriPolicy;
|
|
155
|
+
this.serverLocale = services.ServerLocale;
|
|
153
156
|
this.writableFileSystemProvider = services.workspace.FileSystemProvider;
|
|
154
157
|
this.additionalDocuments = services.additionalDocuments;
|
|
155
158
|
this.languageRegistry = services.ServiceRegistry;
|
|
@@ -325,6 +328,18 @@ export class HydraniumWorkspaceManager extends DefaultWorkspaceManager {
|
|
|
325
328
|
resolveLogFilePlaceholder('workspace', toLogFileWorkspaceToken(first.uri));
|
|
326
329
|
}
|
|
327
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Forward the locale the client declared, then Langium's own read of the
|
|
333
|
+
* params. `DefaultWorkspaceManager.initialize` reads `workspaceFolders`
|
|
334
|
+
* alone, so `params.locale` would otherwise be discarded — and this is the
|
|
335
|
+
* only place it arrives, which the headless init seams route through too.
|
|
336
|
+
*/
|
|
337
|
+
initialize(params) {
|
|
338
|
+
if (params.locale) {
|
|
339
|
+
this.serverLocale.accept(params.locale);
|
|
340
|
+
}
|
|
341
|
+
super.initialize(params);
|
|
342
|
+
}
|
|
328
343
|
/**
|
|
329
344
|
* Override of Langium's workspace setup to resolve / reject
|
|
330
345
|
* {@link workspaceInitializedDeferred} once setup completes. Adopters with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-workspace-manager.js","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-workspace-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,QAAQ,EAA4B,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAwB,QAAQ,EAAY,MAAM,oBAAoB,CAAC;AAGtH,OAAO,EAAuB,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"hydranium-workspace-manager.js","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-workspace-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,QAAQ,EAA4B,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAwB,QAAQ,EAAY,MAAM,oBAAoB,CAAC;AAGtH,OAAO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AC;gBACZ,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;YACtE,CAAC;QACJ,CAAC;IACJ,CAAC;IAWD,cAAc,CAAC,GAAiB,EAAE,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG;QAC1E,OAAO,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC9G,CAAC;CACH"}
|
|
@@ -10,6 +10,24 @@ import { URI } from '@hydranium/langium';
|
|
|
10
10
|
import type { ServerSharedServicesMinimal } from '../shared-services.js';
|
|
11
11
|
/** A workspace folder root accepted by the headless init seams: a filesystem path or a {@link URI}. */
|
|
12
12
|
export type WorkspaceFolderInput = string | URI;
|
|
13
|
+
/**
|
|
14
|
+
* Options for the headless init seams.
|
|
15
|
+
*
|
|
16
|
+
* **Optional, and the parameter is optional too**, so that no existing caller
|
|
17
|
+
* has to change to gain a field it does not set.
|
|
18
|
+
*/
|
|
19
|
+
export interface ProgrammaticInitOptions {
|
|
20
|
+
/**
|
|
21
|
+
* The locale to render user-facing server messages in — the headless
|
|
22
|
+
* equivalent of LSP `initialize`'s `locale`, for a head with no LSP
|
|
23
|
+
* connection (`startStdioServer`, the CLI subcommands, a test harness).
|
|
24
|
+
*
|
|
25
|
+
* Omitted means no locale, which the default renderer resolves as the
|
|
26
|
+
* framework's English. That is the correct answer for a headless tool: it
|
|
27
|
+
* has no reading user to have a language.
|
|
28
|
+
*/
|
|
29
|
+
readonly locale?: string;
|
|
30
|
+
}
|
|
13
31
|
/**
|
|
14
32
|
* Initialize a hydranium workspace **without an LSP `initialize` request** —
|
|
15
33
|
* the headless counterpart to the editor entry. Drives the workspace manager's
|
|
@@ -37,8 +55,9 @@ export type WorkspaceFolderInput = string | URI;
|
|
|
37
55
|
*
|
|
38
56
|
* @param services the shared services tree the workspace manager lives on
|
|
39
57
|
* @param folders one or more workspace roots (filesystem paths or URIs)
|
|
58
|
+
* @param options the message locale, when the caller has one
|
|
40
59
|
*/
|
|
41
|
-
export declare function initializeWorkspaceProgrammatically(services: ServerSharedServicesMinimal, folders: WorkspaceFolderInput | ReadonlyArray<WorkspaceFolderInput
|
|
60
|
+
export declare function initializeWorkspaceProgrammatically(services: ServerSharedServicesMinimal, folders: WorkspaceFolderInput | ReadonlyArray<WorkspaceFolderInput>, options?: ProgrammaticInitOptions): Promise<void>;
|
|
42
61
|
/**
|
|
43
62
|
* {@link initializeWorkspaceProgrammatically} **and then build every registered
|
|
44
63
|
* document to `Validated`** — the "fully-built workspace" convenience for
|
|
@@ -58,6 +77,7 @@ export declare function initializeWorkspaceProgrammatically(services: ServerShar
|
|
|
58
77
|
*
|
|
59
78
|
* @param services the shared services tree the workspace manager lives on
|
|
60
79
|
* @param folders one or more workspace roots (filesystem paths or URIs)
|
|
80
|
+
* @param options the message locale, when the caller has one
|
|
61
81
|
*/
|
|
62
|
-
export declare function buildWorkspaceProgrammatically(services: ServerSharedServicesMinimal, folders: WorkspaceFolderInput | ReadonlyArray<WorkspaceFolderInput
|
|
82
|
+
export declare function buildWorkspaceProgrammatically(services: ServerSharedServicesMinimal, folders: WorkspaceFolderInput | ReadonlyArray<WorkspaceFolderInput>, options?: ProgrammaticInitOptions): Promise<void>;
|
|
63
83
|
//# sourceMappingURL=initialize-workspace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-workspace.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/initialize-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAY,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAMnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEzE,uGAAuG;AACvG,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize-workspace.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/initialize-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAY,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAMnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEzE,uGAAuG;AACvG,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,GAAG,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACrC;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC3B;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,mCAAmC,CACtD,QAAQ,EAAE,2BAA2B,EACrC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAAC,oBAAoB,CAAC,EACnE,OAAO,GAAE,uBAA4B,GACrC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,8BAA8B,CACjD,QAAQ,EAAE,2BAA2B,EACrC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAAC,oBAAoB,CAAC,EACnE,OAAO,GAAE,uBAA4B,GACrC,OAAO,CAAC,IAAI,CAAC,CAIf"}
|
|
@@ -50,14 +50,21 @@ function toWorkspaceFolders(folders) {
|
|
|
50
50
|
*
|
|
51
51
|
* @param services the shared services tree the workspace manager lives on
|
|
52
52
|
* @param folders one or more workspace roots (filesystem paths or URIs)
|
|
53
|
+
* @param options the message locale, when the caller has one
|
|
53
54
|
*/
|
|
54
|
-
export async function initializeWorkspaceProgrammatically(services, folders) {
|
|
55
|
+
export async function initializeWorkspaceProgrammatically(services, folders, options = {}) {
|
|
55
56
|
const workspaceFolders = toWorkspaceFolders(folders);
|
|
56
57
|
const manager = services.workspace.WorkspaceManager;
|
|
57
|
-
// `
|
|
58
|
+
// `locale` goes through the synthesized params rather than a direct
|
|
59
|
+
// `acceptLocale` call, so this seam and a real LSP `initialize` reach the
|
|
60
|
+
// slot by the SAME path — an adopter overriding the capture in
|
|
61
|
+
// `HydraniumWorkspaceManager.initialize` is honoured headlessly too, which a
|
|
62
|
+
// second write site here would silently bypass.
|
|
63
|
+
//
|
|
64
|
+
// `initialize` records the folders (DefaultWorkspaceManager reads only that
|
|
58
65
|
// field); `initialized` runs `mutex.write(initializeWorkspace)` and resolves
|
|
59
66
|
// once discovery + the init build settle, so awaiting it is the ready gate.
|
|
60
|
-
manager.initialize({ workspaceFolders });
|
|
67
|
+
manager.initialize({ workspaceFolders, locale: options.locale });
|
|
61
68
|
await manager.initialized({});
|
|
62
69
|
}
|
|
63
70
|
/**
|
|
@@ -79,9 +86,10 @@ export async function initializeWorkspaceProgrammatically(services, folders) {
|
|
|
79
86
|
*
|
|
80
87
|
* @param services the shared services tree the workspace manager lives on
|
|
81
88
|
* @param folders one or more workspace roots (filesystem paths or URIs)
|
|
89
|
+
* @param options the message locale, when the caller has one
|
|
82
90
|
*/
|
|
83
|
-
export async function buildWorkspaceProgrammatically(services, folders) {
|
|
84
|
-
await initializeWorkspaceProgrammatically(services, folders);
|
|
91
|
+
export async function buildWorkspaceProgrammatically(services, folders, options = {}) {
|
|
92
|
+
await initializeWorkspaceProgrammatically(services, folders, options);
|
|
85
93
|
const documents = services.workspace.LangiumDocuments.all.toArray();
|
|
86
94
|
await services.workspace.DocumentBuilder.build(documents, { validation: true });
|
|
87
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-workspace.js","sourceRoot":"","sources":["../../../src/langium/workspace/initialize-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,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6EAA6E;IAC7E,gDAAgD;IAChD,EAAE;IACF,4EAA4E;IAC5E,6EAA6E;IAC7E,4EAA4E;IAC5E,OAAO,CAAC,UAAU,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAsB,CAAC,CAAC;IACrF,MAAM,OAAO,CAAC,WAAW,CAAC,EAAuB,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CACjD,QAAqC,EACrC,OAAmE,EACnE,UAAmC,EAAE;IAErC,MAAM,mCAAmC,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACtE,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACpE,MAAM,QAAQ,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './server-locale.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './server-locale.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,oBAAoB,CAAC"}
|
|
@@ -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
|
+
import type { Tracer } from '@hydranium/protocol';
|
|
10
|
+
import { type LogNameOptions } from '../langium/diagnostics/logger.js';
|
|
11
|
+
import type { ServerSharedServicesMinimal } from '../langium/shared-services.js';
|
|
12
|
+
/** Construction options for {@link ServerLocale}. */
|
|
13
|
+
export type ServerLocaleOptions = LogNameOptions;
|
|
14
|
+
/**
|
|
15
|
+
* The locale the server was handed at init, for whoever needs to render in the
|
|
16
|
+
* reading user's language. Held apart from the message renderer that reads it,
|
|
17
|
+
* so replacing the renderer cannot drop locale handling.
|
|
18
|
+
*
|
|
19
|
+
* A plain string in and out. A consumer that must react to a change rather than
|
|
20
|
+
* read the current value wraps this itself — nothing does today, and both real
|
|
21
|
+
* hosts respawn the server on a display-language switch.
|
|
22
|
+
*/
|
|
23
|
+
export declare class ServerLocale {
|
|
24
|
+
protected readonly tracer: Tracer;
|
|
25
|
+
protected current: string | undefined;
|
|
26
|
+
constructor(services: ServerSharedServicesMinimal, options?: ServerLocaleOptions);
|
|
27
|
+
/** The locale, or `undefined` when no init supplied one — which means the framework's English. */
|
|
28
|
+
get value(): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Take the locale an init declared.
|
|
31
|
+
*
|
|
32
|
+
* **One locale per process, and the reason the OTHER heads need none of
|
|
33
|
+
* their own.** The data and GLSP heads publish a port over the LSP
|
|
34
|
+
* connection and are reached by forwarding a socket to it, so they are the
|
|
35
|
+
* same process as the LSP head that was handed this locale — there is no
|
|
36
|
+
* topology in which one of them serves a second frontend. The Theia backend
|
|
37
|
+
* is the case that would break it, and it holds no locale precisely because
|
|
38
|
+
* it serves every frontend at once; nothing there writes here.
|
|
39
|
+
*
|
|
40
|
+
* The framework accepts a locale and never sources one, and neither
|
|
41
|
+
* validates nor normalises the tag: rejecting an unfamiliar one would be
|
|
42
|
+
* selecting a locale.
|
|
43
|
+
*
|
|
44
|
+
* Override to ignore the argument, which is how a host pins a locale it
|
|
45
|
+
* already knows but has no LSP client to declare.
|
|
46
|
+
*/
|
|
47
|
+
accept(locale: string): void;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=server-locale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-locale.d.ts","sourceRoot":"","sources":["../../src/locale/server-locale.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEjF,qDAAqD;AACrD,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAEjD;;;;;;;;GAQG;AACH,qBAAa,YAAY;IACtB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE1B,QAAQ,EAAE,2BAA2B,EAAE,OAAO,GAAE,mBAAwB;IAIpF,kGAAkG;IAClG,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAI9B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
* The locale the server was handed at init, for whoever needs to render in the
|
|
11
|
+
* reading user's language. Held apart from the message renderer that reads it,
|
|
12
|
+
* so replacing the renderer cannot drop locale handling.
|
|
13
|
+
*
|
|
14
|
+
* A plain string in and out. A consumer that must react to a change rather than
|
|
15
|
+
* read the current value wraps this itself — nothing does today, and both real
|
|
16
|
+
* hosts respawn the server on a display-language switch.
|
|
17
|
+
*/
|
|
18
|
+
export class ServerLocale {
|
|
19
|
+
tracer;
|
|
20
|
+
current;
|
|
21
|
+
constructor(services, options = {}) {
|
|
22
|
+
this.tracer = services.Tracer.for(options.logName ?? 'ServerLocale').trace('instantiated');
|
|
23
|
+
}
|
|
24
|
+
/** The locale, or `undefined` when no init supplied one — which means the framework's English. */
|
|
25
|
+
get value() {
|
|
26
|
+
return this.current;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Take the locale an init declared.
|
|
30
|
+
*
|
|
31
|
+
* **One locale per process, and the reason the OTHER heads need none of
|
|
32
|
+
* their own.** The data and GLSP heads publish a port over the LSP
|
|
33
|
+
* connection and are reached by forwarding a socket to it, so they are the
|
|
34
|
+
* same process as the LSP head that was handed this locale — there is no
|
|
35
|
+
* topology in which one of them serves a second frontend. The Theia backend
|
|
36
|
+
* is the case that would break it, and it holds no locale precisely because
|
|
37
|
+
* it serves every frontend at once; nothing there writes here.
|
|
38
|
+
*
|
|
39
|
+
* The framework accepts a locale and never sources one, and neither
|
|
40
|
+
* validates nor normalises the tag: rejecting an unfamiliar one would be
|
|
41
|
+
* selecting a locale.
|
|
42
|
+
*
|
|
43
|
+
* Override to ignore the argument, which is how a host pins a locale it
|
|
44
|
+
* already knows but has no LSP client to declare.
|
|
45
|
+
*/
|
|
46
|
+
accept(locale) {
|
|
47
|
+
this.current = locale;
|
|
48
|
+
this.tracer.debug(`locale set to '${locale}'`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=server-locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-locale.js","sourceRoot":"","sources":["../../src/locale/server-locale.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AASlF;;;;;;;;GAQG;AACH,MAAM,OAAO,YAAY;IACH,MAAM,CAAS;IACxB,OAAO,CAAqB;IAEtC,YAAY,QAAqC,EAAE,UAA+B,EAAE;QACjF,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC9F,CAAC;IAED,kGAAkG;IAClG,IAAI,KAAK;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,MAAc;QAClB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,MAAM,GAAG,CAAC,CAAC;IAClD,CAAC;CACH"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { type MessageDefinition, type ParamsArg, type ResolvedMessage } from '@hydranium/protocol';
|
|
10
10
|
import type { AstNode, DiagnosticData, DiagnosticInfo, Properties, ValidationAcceptor } from '@hydranium/langium';
|
|
11
|
-
import
|
|
11
|
+
import { Diagnostic } from 'vscode-languageserver-protocol';
|
|
12
12
|
/**
|
|
13
13
|
* Raise a validation diagnostic from a declaration, so the call site never
|
|
14
14
|
* restates the code or the sentence.
|
|
@@ -35,12 +35,13 @@ export declare function acceptMessage<S extends string, N extends AstNode, P ext
|
|
|
35
35
|
data?: Partial<DiagnosticData>;
|
|
36
36
|
}, ...params: ParamsArg<S>): void;
|
|
37
37
|
/**
|
|
38
|
-
* Recover the identity from a published diagnostic, for a surface that
|
|
39
|
-
* diagnostics itself.
|
|
38
|
+
* Recover the identity from a published diagnostic, for a surface that
|
|
39
|
+
* identifies or renders diagnostics itself.
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* `Diagnostic.message` is `string | MarkupContent` in LSP 3.17+, so the text
|
|
42
|
+
* comes from upstream's own `Diagnostic.getMessageString` rather than a
|
|
43
|
+
* hand-rolled narrowing — consuming the library in its style, and one fewer
|
|
44
|
+
* place restating the union.
|
|
44
45
|
*/
|
|
45
46
|
export declare function resolvedFromDiagnostic(diagnostic: Diagnostic): ResolvedMessage | undefined;
|
|
46
47
|
//# sourceMappingURL=carriers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carriers.d.ts","sourceRoot":"","sources":["../../src/messages/carriers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAIJ,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,eAAe,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAClH,OAAO,
|
|
1
|
+
{"version":3,"file":"carriers.d.ts","sourceRoot":"","sources":["../../src/messages/carriers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAIJ,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,eAAe,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAClH,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EACvG,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,EAC/C,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC7B,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAAE,EACtF,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GACvB,IAAI,CAGN;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,eAAe,GAAG,SAAS,CAK1F"}
|
package/lib/messages/carriers.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { hasMessageIdentity, messageData } from '@hydranium/protocol';
|
|
10
|
+
import { Diagnostic } from 'vscode-languageserver-protocol';
|
|
10
11
|
/**
|
|
11
12
|
* Raise a validation diagnostic from a declaration, so the call site never
|
|
12
13
|
* restates the code or the sentence.
|
|
@@ -34,18 +35,18 @@ export function acceptMessage(accept, severity, message, info, ...params) {
|
|
|
34
35
|
accept(severity, message.format(...params), { ...info, code: message.code, data });
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
|
-
* Recover the identity from a published diagnostic, for a surface that
|
|
38
|
-
* diagnostics itself.
|
|
38
|
+
* Recover the identity from a published diagnostic, for a surface that
|
|
39
|
+
* identifies or renders diagnostics itself.
|
|
39
40
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* `Diagnostic.message` is `string | MarkupContent` in LSP 3.17+, so the text
|
|
42
|
+
* comes from upstream's own `Diagnostic.getMessageString` rather than a
|
|
43
|
+
* hand-rolled narrowing — consuming the library in its style, and one fewer
|
|
44
|
+
* place restating the union.
|
|
43
45
|
*/
|
|
44
46
|
export function resolvedFromDiagnostic(diagnostic) {
|
|
45
47
|
if (!hasMessageIdentity(diagnostic.data)) {
|
|
46
48
|
return undefined;
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
return { ...diagnostic.data.hydranium, text };
|
|
50
|
+
return { ...diagnostic.data.hydranium, text: Diagnostic.getMessageString(diagnostic) };
|
|
50
51
|
}
|
|
51
52
|
//# sourceMappingURL=carriers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carriers.js","sourceRoot":"","sources":["../../src/messages/carriers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,kBAAkB,EAClB,WAAW,EAKb,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"carriers.js","sourceRoot":"","sources":["../../src/messages/carriers.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,kBAAkB,EAClB,WAAW,EAKb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,aAAa,CAC1B,MAA0B,EAC1B,QAA+C,EAC/C,OAA6B,EAC7B,IAAsF,EACtF,GAAG,MAAoB;IAEvB,MAAM,IAAI,GAAmD,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;IAClH,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAsB;IAC1D,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACpB,CAAC;IACD,OAAO,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;AAC1F,CAAC"}
|