@hydranium/core 1.0.0-next.30 → 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/ast-extension/ast-node-builder.d.ts +32 -9
- package/lib/langium/ast-extension/ast-node-builder.d.ts.map +1 -1
- package/lib/langium/ast-extension/ast-node-builder.js +60 -22
- package/lib/langium/ast-extension/ast-node-builder.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/scope/hydranium-scope-provider.d.ts +10 -6
- package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
- package/lib/langium/scope/hydranium-scope-provider.js +15 -11
- package/lib/langium/scope/hydranium-scope-provider.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/fake-document.d.ts +14 -3
- package/lib/testing/fake-document.d.ts.map +1 -1
- package/lib/testing/fake-document.js +18 -3
- package/lib/testing/fake-document.js.map +1 -1
- 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/ast-extension/ast-node-builder.ts +66 -22
- 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/scope/hydranium-scope-provider.ts +15 -11
- 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/fake-document.ts +22 -4
- package/src/testing/make-noop-shared-services.ts +50 -2
- package/src/testing/make-test-services.ts +43 -1
|
@@ -7,10 +7,32 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { type AstNode, type ValidationAcceptor } from '@hydranium/langium';
|
|
10
|
-
export declare const SEPARATOR_IN_NAME: import("@hydranium/protocol").MessageDefinition<"Name '{name}' contains the configured name separator '{separator}', which is reserved for qualified-name composition — use a different character.">;
|
|
11
10
|
import { type ServerLanguageServices } from '../language-module.js';
|
|
12
11
|
import { type ValidationCheckContribution, type ValidationCheckRegistry } from '../validation/validation-contribution.js';
|
|
13
12
|
import type { NameProvider } from './name-provider.js';
|
|
13
|
+
/**
|
|
14
|
+
* A name value that collides with the qualified-name separator.
|
|
15
|
+
*
|
|
16
|
+
* **The sentence addresses a MODELLER, and the remedy it names is theirs**:
|
|
17
|
+
* where `name` really is the identifier, a different character is the fix and
|
|
18
|
+
* the only one available to whoever is typing.
|
|
19
|
+
*
|
|
20
|
+
* **The adopter-facing failure is a different one, and this message cannot
|
|
21
|
+
* carry it.** With `nameProperties` left at its default `['name']` over a
|
|
22
|
+
* grammar where `name` is a display LABEL — a `STRING` legitimately holding
|
|
23
|
+
* `"Order.Line"` — this fires on every dotted label at once, and "use a
|
|
24
|
+
* different character" is then advice nobody can act on: the content is
|
|
25
|
+
* correct and the configuration is not. A burst of this diagnostic across
|
|
26
|
+
* unrelated nodes is that misconfiguration, not a naming problem, and the fix
|
|
27
|
+
* is `nameProperties`. Widening the sentence to say both was rejected: a
|
|
28
|
+
* modeller cannot act on a DI option, and naming one in an editor squiggle
|
|
29
|
+
* teaches the wrong audience.
|
|
30
|
+
*
|
|
31
|
+
* Unreachable from a grammar whose identifier charset excludes the separator,
|
|
32
|
+
* which is every example here and the reference adopter — so it reads as dead
|
|
33
|
+
* and is not: it guards the configuration, not the content.
|
|
34
|
+
*/
|
|
35
|
+
export declare const SEPARATOR_IN_NAME: import("@hydranium/protocol").MessageDefinition<"Name '{name}' contains the configured name separator '{separator}', which is reserved for qualified-name composition — use a different character.">;
|
|
14
36
|
/**
|
|
15
37
|
* Per-node validation check: flag name-bearing AST nodes whose name
|
|
16
38
|
* value contains the configured name separator. Such values produce
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name-separator-validation.d.ts","sourceRoot":"","sources":["../../../src/langium/naming/name-separator-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"name-separator-validation.d.ts","sourceRoot":"","sources":["../../../src/langium/naming/name-separator-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,oBAAoB,CAAC;AAGlG,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAC1H,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,iBAAiB,sMAG7B,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAelH;AAED;;;;;;;;;GASG;AACH,qBAAa,8BAA+B,YAAW,2BAA2B;IAC/E,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;gBAElC,QAAQ,EAAE,sBAAsB;IAI5C,wBAAwB,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI;CAMnE"}
|
|
@@ -8,6 +8,28 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { defineMessage } from '@hydranium/protocol';
|
|
10
10
|
import { acceptMessage } from '../../messages/carriers.js';
|
|
11
|
+
/**
|
|
12
|
+
* A name value that collides with the qualified-name separator.
|
|
13
|
+
*
|
|
14
|
+
* **The sentence addresses a MODELLER, and the remedy it names is theirs**:
|
|
15
|
+
* where `name` really is the identifier, a different character is the fix and
|
|
16
|
+
* the only one available to whoever is typing.
|
|
17
|
+
*
|
|
18
|
+
* **The adopter-facing failure is a different one, and this message cannot
|
|
19
|
+
* carry it.** With `nameProperties` left at its default `['name']` over a
|
|
20
|
+
* grammar where `name` is a display LABEL — a `STRING` legitimately holding
|
|
21
|
+
* `"Order.Line"` — this fires on every dotted label at once, and "use a
|
|
22
|
+
* different character" is then advice nobody can act on: the content is
|
|
23
|
+
* correct and the configuration is not. A burst of this diagnostic across
|
|
24
|
+
* unrelated nodes is that misconfiguration, not a naming problem, and the fix
|
|
25
|
+
* is `nameProperties`. Widening the sentence to say both was rejected: a
|
|
26
|
+
* modeller cannot act on a DI option, and naming one in an editor squiggle
|
|
27
|
+
* teaches the wrong audience.
|
|
28
|
+
*
|
|
29
|
+
* Unreachable from a grammar whose identifier charset excludes the separator,
|
|
30
|
+
* which is every example here and the reference adopter — so it reads as dead
|
|
31
|
+
* and is not: it guards the configuration, not the content.
|
|
32
|
+
*/
|
|
11
33
|
export const SEPARATOR_IN_NAME = defineMessage('hydranium/core/separator-in-name', "Name '{name}' contains the configured name separator '{separator}', which is reserved for qualified-name composition — use a different character.");
|
|
12
34
|
/**
|
|
13
35
|
* Per-node validation check: flag name-bearing AST nodes whose name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name-separator-validation.js","sourceRoot":"","sources":["../../../src/langium/naming/name-separator-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"name-separator-validation.js","sourceRoot":"","sources":["../../../src/langium/naming/name-separator-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAK3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC3C,kCAAkC,EAClC,mJAAmJ,CACrJ,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB,CAAC,YAA0B;IAC1D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;QACrB,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvD,OAAO;QACV,CAAC;QACD,MAAM,SAAS,GAAG,YAAY,CAAC,aAAa,CAAC;QAC7C,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,kEAAkE;YAClE,mEAAmE;YACnE,wEAAwE;YACxE,+DAA+D;YAC/D,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;QAC7F,CAAC;IACJ,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,8BAA8B;IACrB,YAAY,CAAe;IAE9C,YAAY,QAAgC;QACzC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;IACxD,CAAC;IAED,wBAAwB,CAAC,QAAiC;QACvD,MAAM,MAAM,GAA2C;YACpD,OAAO,EAAE,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC;SAChD,CAAC;QACF,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACH"}
|
|
@@ -308,12 +308,13 @@ export declare class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
|
308
308
|
* Convert a protocol-layer {@link ReferenceContext} into a Langium
|
|
309
309
|
* {@link ReferenceInfo} the rest of the scope/linking machinery accepts.
|
|
310
310
|
*
|
|
311
|
-
* Walks `syntheticPath` by FABRICATING a
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* the
|
|
311
|
+
* Walks `syntheticPath` by FABRICATING a stub per step, so a scope can be
|
|
312
|
+
* queried for an element that does not exist yet — which is what synthetic
|
|
313
|
+
* paths are for. A stub carries the grammar's declared defaults and nothing
|
|
314
|
+
* else, so its containment lists are present but EMPTY: a caller that needs
|
|
315
|
+
* to read a populated collection off the leaf wants
|
|
316
|
+
* {@link resolveReferenceSource} instead, which walks the same path into the
|
|
317
|
+
* real tree.
|
|
317
318
|
*
|
|
318
319
|
* Throws if the context references an unresolvable source; callers
|
|
319
320
|
* that prefer a soft failure should catch and fall back to
|
|
@@ -372,6 +373,9 @@ export declare class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
|
372
373
|
* `createEmptyDocument`. Overriding is still open to a consumer whose
|
|
373
374
|
* "container" is an inner element rather than the parse root, or one that
|
|
374
375
|
* deliberately declines to answer for an absent document.
|
|
376
|
+
*
|
|
377
|
+
* The stub carries the grammar's declared defaults, so an extension reading a
|
|
378
|
+
* containment list off it sees an empty array rather than `undefined`.
|
|
375
379
|
*/
|
|
376
380
|
protected resolveSyntheticSource(source: SyntheticSource): AstNode | undefined;
|
|
377
381
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-scope-provider.d.ts","sourceRoot":"","sources":["../../../src/langium/scope/hydranium-scope-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EAKtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACJ,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,oBAAoB,EAEpB,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,YAAY,EAEjB,KAAK,GAAG,EAER,cAAc,EAEhB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"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AAO,CAAC,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,KAAK;IAYtH;;;;;;;;;;;;;;;OAeG;IACH,sBAAsB,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa;IAuB5D;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO,GAAG,SAAS;IAoBlE;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,GAAG,OAAO,GAAG,SAAS;IAgBvF,wEAAwE;IACxE,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,GAAG,SAAS;IAgBxE;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,SAAS,CAAC,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,GAAG,SAAS;IAQ9E;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS;IAI3D;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAIlF;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,WAAW,EAAE,kBAAkB,GAAG,MAAM;CAGnD"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { isDocumentSource, isElementSource, isReferenceContext, isSyntheticSource } from '@hydranium/protocol';
|
|
10
10
|
import { AstUtils, DefaultScopeProvider, MapScope, StreamScope, UriUtils, WorkspaceCache, stream } from '@hydranium/langium';
|
|
11
|
+
import { buildAstNode } from '../ast-extension/ast-node-builder.js';
|
|
11
12
|
import { isTieredDescription } from './scoped-ast-node-description.js';
|
|
12
13
|
/**
|
|
13
14
|
* Per-language scope provider that owns the full scope chain in ONE
|
|
@@ -358,12 +359,13 @@ export class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
|
358
359
|
* Convert a protocol-layer {@link ReferenceContext} into a Langium
|
|
359
360
|
* {@link ReferenceInfo} the rest of the scope/linking machinery accepts.
|
|
360
361
|
*
|
|
361
|
-
* Walks `syntheticPath` by FABRICATING a
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* the
|
|
362
|
+
* Walks `syntheticPath` by FABRICATING a stub per step, so a scope can be
|
|
363
|
+
* queried for an element that does not exist yet — which is what synthetic
|
|
364
|
+
* paths are for. A stub carries the grammar's declared defaults and nothing
|
|
365
|
+
* else, so its containment lists are present but EMPTY: a caller that needs
|
|
366
|
+
* to read a populated collection off the leaf wants
|
|
367
|
+
* {@link resolveReferenceSource} instead, which walks the same path into the
|
|
368
|
+
* real tree.
|
|
367
369
|
*
|
|
368
370
|
* Throws if the context references an unresolvable source; callers
|
|
369
371
|
* that prefer a soft failure should catch and fall back to
|
|
@@ -375,16 +377,15 @@ export class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
|
375
377
|
throw new Error('Invalid reference source');
|
|
376
378
|
}
|
|
377
379
|
for (const step of ctx.syntheticPath ?? []) {
|
|
378
|
-
container = {
|
|
380
|
+
container = buildAstNode(this.services.shared.AstReflection, step.type, {
|
|
379
381
|
$container: container,
|
|
380
382
|
$containerProperty: step.containerProperty,
|
|
381
383
|
// Part of Langium's own container contract, so a stub that omits it
|
|
382
384
|
// is an under-specified node: anything reading position off the
|
|
383
385
|
// chain (a key provider, an adopter scope extension) sees
|
|
384
386
|
// `undefined` where the caller named a slot.
|
|
385
|
-
$containerIndex: step.index
|
|
386
|
-
|
|
387
|
-
};
|
|
387
|
+
$containerIndex: step.index
|
|
388
|
+
});
|
|
388
389
|
}
|
|
389
390
|
return {
|
|
390
391
|
reference: { $refText: '', ref: undefined },
|
|
@@ -491,12 +492,15 @@ export class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
|
491
492
|
* `createEmptyDocument`. Overriding is still open to a consumer whose
|
|
492
493
|
* "container" is an inner element rather than the parse root, or one that
|
|
493
494
|
* deliberately declines to answer for an absent document.
|
|
495
|
+
*
|
|
496
|
+
* The stub carries the grammar's declared defaults, so an extension reading a
|
|
497
|
+
* containment list off it sees an empty array rather than `undefined`.
|
|
494
498
|
*/
|
|
495
499
|
resolveSyntheticSource(source) {
|
|
496
500
|
const uri = UriUtils.toUri(source.uri);
|
|
497
501
|
const document = this.langiumDocuments.getDocument(uri) ??
|
|
498
502
|
this.langiumDocuments.createEmptyDocument(uri, this.services.LanguageMetaData.languageId);
|
|
499
|
-
return
|
|
503
|
+
return buildAstNode(this.services.shared.AstReflection, source.type, { $container: document.parseResult.value });
|
|
500
504
|
}
|
|
501
505
|
/**
|
|
502
506
|
* Resolve the semantic root node of the document at `uri`. Default: looks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-scope-provider.js","sourceRoot":"","sources":["../../../src/langium/scope/hydranium-scope-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAMJ,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIJ,QAAQ,EACR,oBAAoB,EACpB,QAAQ,EAIR,WAAW,EAEX,QAAQ,EACR,cAAc,EACd,MAAM,EACR,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"hydranium-scope-provider.js","sourceRoot":"","sources":["../../../src/langium/scope/hydranium-scope-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAMJ,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIJ,QAAQ,EACR,oBAAoB,EACpB,QAAQ,EAIR,WAAW,EAEX,QAAQ,EACR,cAAc,E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AC,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;IACpH,CAAC;IAED;;;;;OAKG;IACO,kBAAkB,CAAC,GAAQ;QAClC,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC;IACpE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACO,oBAAoB,CAAC,KAAa,EAAE,KAAc;QACzD,OAAO,SAAS,CAAC;IACpB,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,WAA+B;QACrC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,MAAM,GAAG,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC;IAClG,CAAC;CACH"}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import type { Clock, Logger, Project, Tracer } from '@hydranium/protocol';
|
|
10
10
|
import type { LangiumSharedCoreServices } from '@hydranium/langium';
|
|
11
|
+
import type { ServerLocale } from '../locale/server-locale.js';
|
|
12
|
+
import type { ServerMessageRenderer } from '../messages/renderer.js';
|
|
11
13
|
import type { SelfSaveRegistry } from '../documents/self-save-registry.js';
|
|
12
14
|
import type { WritableFileSystemProvider } from '../documents/ast-document-manager.js';
|
|
13
15
|
import type { HydraniumDocumentRegistry } from './workspace/langium-documents.js';
|
|
@@ -26,8 +28,9 @@ import type { AdditionalDocumentContribution } from './workspace/additional-docu
|
|
|
26
28
|
* framework additions that other framework services consume: the dedicated
|
|
27
29
|
* {@link Clock}, {@link Logger} and {@link Tracer} top-level slots (injectable
|
|
28
30
|
* time source, emission-only logger, and the measure-and-emit tracer composed
|
|
29
|
-
* from the other two), the {@link AdditionalDocumentContribution} group,
|
|
30
|
-
* {@link
|
|
31
|
+
* from the other two), the {@link AdditionalDocumentContribution} group, the
|
|
32
|
+
* {@link ServerMessageRenderer} and the {@link ServerLocale} it renders in,
|
|
33
|
+
* an {@link ExtendedServiceRegistry}, and on `workspace` a writable file-system
|
|
31
34
|
* provider plus {@link HydraniumWorkspaceManager}, {@link ProjectManager},
|
|
32
35
|
* {@link SelfSaveRegistry}, {@link BuildPipelineIntegration},
|
|
33
36
|
* {@link BuildPhasePassService}, {@link CstResidencyService} and
|
|
@@ -56,6 +59,14 @@ export interface ServerSharedServicesMinimal<TProject extends Project = Project>
|
|
|
56
59
|
* adopters deep-merge contributions that seed built-in / stdlib documents.
|
|
57
60
|
*/
|
|
58
61
|
additionalDocuments: Record<string, AdditionalDocumentContribution>;
|
|
62
|
+
/**
|
|
63
|
+
* Renders each user-facing message once, before the server sends it. On the
|
|
64
|
+
* shared tier with no workspace dependency, because all three heads'
|
|
65
|
+
* messages pass through it.
|
|
66
|
+
*/
|
|
67
|
+
MessageRenderer: ServerMessageRenderer;
|
|
68
|
+
/** The locale an init handed the server, for whoever renders in it. */
|
|
69
|
+
ServerLocale: ServerLocale;
|
|
59
70
|
/**
|
|
60
71
|
* Narrows Langium's base `ServiceRegistry` slot to the framework impl the
|
|
61
72
|
* framework always binds, so the abstaining lookups — `getServicesFor`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-services.d.ts","sourceRoot":"","sources":["../../src/langium/shared-services.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO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EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,2BAA2B,KAAK,OAAO,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAEvI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-services.js","sourceRoot":"","sources":["../../src/langium/shared-services.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"shared-services.js","sourceRoot":"","sources":["../../src/langium/shared-services.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAgGlF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,mBAAmB,CAAU,MAA0D;IACpG,OAAO,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,QAAuC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { type LogThreshold, type MaybeObservableValue, ObservableValue, type Tracer } from '@hydranium/protocol';
|
|
10
|
-
import { type AstNode, type AstNodeLocator, DefaultDocumentValidator, type DiagnosticInfo, type LangiumDocument, type LangiumCoreServices, type ValidateSingleNodeOptions, type ValidationOptions, type ValidationSeverity } from '@hydranium/langium';
|
|
10
|
+
import { type AstNode, type AstNodeLocator, type AstReflection, DefaultDocumentValidator, type DiagnosticInfo, type LangiumDocument, type LangiumCoreServices, type ValidateSingleNodeOptions, type ValidationOptions, type ValidationSeverity } from '@hydranium/langium';
|
|
11
11
|
import type { CancellationToken } from 'vscode-languageserver-protocol';
|
|
12
12
|
import type { Diagnostic } from 'vscode-languageserver-types';
|
|
13
13
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
@@ -33,6 +33,22 @@ export interface TransferLspDiagnostic extends Diagnostic {
|
|
|
33
33
|
element?: string;
|
|
34
34
|
property?: string;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* A reference resolved to nothing.
|
|
38
|
+
*
|
|
39
|
+
* **The English is byte-identical to Langium's `DefaultLinker.createLinkingError`
|
|
40
|
+
* sentence, and must stay so.** The identity is attached to a diagnostic Langium
|
|
41
|
+
* already worded, so a divergence here would silently change the text every
|
|
42
|
+
* adopter without a catalogue sees. {@link HydraniumDocumentValidator.processLinkingErrors}
|
|
43
|
+
* attaches it only when the two match exactly, which is also what keeps an
|
|
44
|
+
* adopter's own reworded linking error from being mislabelled as this one.
|
|
45
|
+
*
|
|
46
|
+
* It exists because this is the most-seen validation error in any language built
|
|
47
|
+
* on the framework, and Langium puts its own code in `data.code` rather than on
|
|
48
|
+
* `Diagnostic.code` — so without a framework identity every adopter wanting to
|
|
49
|
+
* render it has to special-case Langium's shape.
|
|
50
|
+
*/
|
|
51
|
+
export declare const UNRESOLVED_REFERENCE: import("@hydranium/protocol").MessageDefinition<"Could not resolve reference to {referenceType} named '{refText}'.">;
|
|
36
52
|
export interface DocumentValidatorOptions extends LogNameOptions {
|
|
37
53
|
/**
|
|
38
54
|
* Level at which the `validateDocument` timing line is emitted, or `'off'`
|
|
@@ -78,6 +94,7 @@ export interface DocumentValidatorOptions extends LogNameOptions {
|
|
|
78
94
|
export declare class HydraniumDocumentValidator extends DefaultDocumentValidator {
|
|
79
95
|
protected readonly tracer: Tracer;
|
|
80
96
|
protected readonly astNodeLocator: AstNodeLocator;
|
|
97
|
+
protected readonly reflection: AstReflection;
|
|
81
98
|
protected readonly logLevel: ObservableValue<LogThreshold>;
|
|
82
99
|
protected readonly logAfterMs: ObservableValue<number>;
|
|
83
100
|
protected readonly validateVirtualDocuments: ObservableValue<boolean>;
|
|
@@ -102,6 +119,54 @@ export declare class HydraniumDocumentValidator extends DefaultDocumentValidator
|
|
|
102
119
|
* `super.shouldSkipValidation(node) || ...`.
|
|
103
120
|
*/
|
|
104
121
|
protected shouldSkipValidation(node: AstNode): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Langium's linking-error pass, plus the framework identity on each
|
|
124
|
+
* diagnostic it produced.
|
|
125
|
+
*
|
|
126
|
+
* Langium puts its own `linking-error` marker in `data.code` and leaves
|
|
127
|
+
* `Diagnostic.code` unset, so nothing identifies the message on a surface
|
|
128
|
+
* that drops `data` — which is every editor surface. This adds the framework
|
|
129
|
+
* identity to both `code` and `data.hydranium` while LEAVING `data.code` in
|
|
130
|
+
* place: `stopAfterLinkingErrors` and Langium's code-action dispatch both
|
|
131
|
+
* read it.
|
|
132
|
+
*
|
|
133
|
+
* **The identity is attached only when the message is the one
|
|
134
|
+
* {@link UNRESOLVED_REFERENCE} renders.** Two other sentences reach this
|
|
135
|
+
* list: the linker's exception form, raised when resolution itself throws,
|
|
136
|
+
* and whatever an adopter overriding `createLinkingError` chose. Labelling
|
|
137
|
+
* either would make a catalogue render the wrong sentence — and for the
|
|
138
|
+
* exception form it would discard the underlying cause. Comparing against
|
|
139
|
+
* the locally rendered English is what discriminates; there is no structural
|
|
140
|
+
* field that does.
|
|
141
|
+
*/
|
|
142
|
+
protected processLinkingErrors(document: LangiumDocument, diagnostics: Diagnostic[], options: ValidationOptions): void;
|
|
143
|
+
/**
|
|
144
|
+
* Add the {@link UNRESOLVED_REFERENCE} identity to one linking diagnostic,
|
|
145
|
+
* or return it untouched when its message is not the sentence that identity
|
|
146
|
+
* renders.
|
|
147
|
+
*
|
|
148
|
+
* `refText` comes from the `data` Langium populated; `referenceType` is not
|
|
149
|
+
* in it, so it is recovered the same way `createLinkingError` produced it —
|
|
150
|
+
* through the reflection, from the container type and property.
|
|
151
|
+
*/
|
|
152
|
+
protected identifyLinkingError(diagnostic: Diagnostic): Diagnostic;
|
|
153
|
+
/**
|
|
154
|
+
* The declared target type of the reference this diagnostic came from, or
|
|
155
|
+
* `undefined` when the reflection cannot name one.
|
|
156
|
+
*
|
|
157
|
+
* **The lookup can throw, and that is the reason this is a method rather
|
|
158
|
+
* than an inline call.** `AbstractAstReflection.getReferenceType` raises on
|
|
159
|
+
* an unknown container `$type` and on a property that is not a reference —
|
|
160
|
+
* and the linking error whose type it cannot name is the one most likely to
|
|
161
|
+
* reach here, because `DefaultLinker` catches its OWN failed lookup and
|
|
162
|
+
* turns it into the exception-form message. Rethrowing would take
|
|
163
|
+
* `validateDocument` with it, since Langium wraps `processLinkingErrors` in
|
|
164
|
+
* no try: a diagnostic Langium degraded gracefully would become a failed
|
|
165
|
+
* build. Declining is also the right answer on the merits — a reference
|
|
166
|
+
* whose type cannot be named is not the message
|
|
167
|
+
* {@link UNRESOLVED_REFERENCE} claims.
|
|
168
|
+
*/
|
|
169
|
+
protected referenceTypeOf(containerType: string, property: string, refText: string): string | undefined;
|
|
105
170
|
protected toDiagnostic<N extends AstNode>(severity: ValidationSeverity, message: string, info: DiagnosticInfo<N, string>): TransferLspDiagnostic;
|
|
106
171
|
/**
|
|
107
172
|
* Construct the `element` path for a diagnostic. Falls back through:
|
|
@@ -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,E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AE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,EAAE,OAAO,GAAE,wBAA6B;IAWzG,gBAAgB,CACtB,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,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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,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,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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