@hydranium/core 1.0.0-next.25 → 1.0.0-next.27
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/langium/naming/name-separator-validation.d.ts +1 -0
- package/lib/langium/naming/name-separator-validation.d.ts.map +1 -1
- package/lib/langium/naming/name-separator-validation.js +8 -1
- package/lib/langium/naming/name-separator-validation.js.map +1 -1
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts +8 -0
- package/lib/langium/workspace/in-memory-file-system-provider.d.ts.map +1 -1
- package/lib/langium/workspace/in-memory-file-system-provider.js +11 -2
- package/lib/langium/workspace/in-memory-file-system-provider.js.map +1 -1
- package/lib/langium/workspace/langium-documents.d.ts +9 -0
- package/lib/langium/workspace/langium-documents.d.ts.map +1 -1
- package/lib/langium/workspace/langium-documents.js +11 -1
- package/lib/langium/workspace/langium-documents.js.map +1 -1
- package/lib/messages/carriers.d.ts +46 -0
- package/lib/messages/carriers.d.ts.map +1 -0
- package/lib/messages/carriers.js +51 -0
- package/lib/messages/carriers.js.map +1 -0
- package/lib/messages/index.d.ts +22 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +22 -0
- package/lib/messages/index.js.map +1 -0
- package/package.json +13 -5
- package/src/langium/naming/name-separator-validation.ts +12 -5
- package/src/langium/workspace/in-memory-file-system-provider.ts +13 -3
- package/src/langium/workspace/langium-documents.ts +12 -1
- package/src/messages/carriers.ts +68 -0
- package/src/messages/index.ts +24 -0
|
@@ -7,6 +7,7 @@
|
|
|
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.">;
|
|
10
11
|
import { type ServerLanguageServices } from '../language-module.js';
|
|
11
12
|
import { type ValidationCheckContribution, type ValidationCheckRegistry } from '../validation/validation-contribution.js';
|
|
12
13
|
import type { NameProvider } from './name-provider.js';
|
|
@@ -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;AAIlG,eAAO,MAAM,iBAAiB,sMAG7B,CAAC;AACF,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;;;;;;;;;;;;;;;;;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"}
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
import { defineMessage } from '@hydranium/protocol';
|
|
10
|
+
import { acceptMessage } from '../../messages/carriers.js';
|
|
11
|
+
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.");
|
|
9
12
|
/**
|
|
10
13
|
* Per-node validation check: flag name-bearing AST nodes whose name
|
|
11
14
|
* value contains the configured name separator. Such values produce
|
|
@@ -32,7 +35,11 @@ export function nameSeparatorCheck(nameProvider) {
|
|
|
32
35
|
}
|
|
33
36
|
const separator = nameProvider.nameSeparator;
|
|
34
37
|
if (ownName.includes(separator)) {
|
|
35
|
-
|
|
38
|
+
// `{ node }` rather than `{ node, property: 'name' }`: moving the
|
|
39
|
+
// squiggle onto the name property is a behaviour change to the one
|
|
40
|
+
// diagnostic every adopter receives by default, so it is decided on its
|
|
41
|
+
// own merits rather than carried in by a mechanical migration.
|
|
42
|
+
acceptMessage(accept, 'error', SEPARATOR_IN_NAME, { node }, { name: ownName, separator });
|
|
36
43
|
}
|
|
37
44
|
};
|
|
38
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name-separator-validation.js","sourceRoot":"","sources":["../../../src/langium/naming/name-separator-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
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;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC3C,kCAAkC,EAClC,mJAAmJ,CACrJ,CAAC;AAKF;;;;;;;;;;;;;;;;;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"}
|
|
@@ -11,6 +11,14 @@ import { type Tracer } from '@hydranium/protocol';
|
|
|
11
11
|
import { type WritableFileSystemProvider } from '../../documents/ast-document-manager.js';
|
|
12
12
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
13
13
|
import { type ServerSharedServicesMinimal } from '../shared-services.js';
|
|
14
|
+
/**
|
|
15
|
+
* The browser host's spelling of "the document is not there". Its Node
|
|
16
|
+
* counterpart is `NO_LOADABLE_CONTENT`: this provider has no `realpath`, so the
|
|
17
|
+
* URI policy cannot answer the existence question ahead of the read and the miss
|
|
18
|
+
* surfaces here instead.
|
|
19
|
+
*/
|
|
20
|
+
export declare const NO_SUCH_FILE: import("@hydranium/protocol").MessageDefinition<"No such file: {uri}">;
|
|
21
|
+
export declare const NO_SUCH_PATH: import("@hydranium/protocol").MessageDefinition<"No such file or directory: {uri}">;
|
|
14
22
|
/**
|
|
15
23
|
* File content keyed by path, for seeding an {@link InMemoryFileSystemProvider}.
|
|
16
24
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-file-system-provider.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/in-memory-file-system-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,cAAc,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"in-memory-file-system-provider.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/in-memory-file-system-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,cAAc,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAuB,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAG9F;;;;;GAKG;AACH,eAAO,MAAM,YAAY,wEAAsE,CAAC;AAEhG,eAAO,MAAM,YAAY,qFAAmF,CAAC;AAE7G;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9D,qFAAqF;AACrF,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC9D,wEAAwE;IACxE,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;;OAGG;IACH,OAAO,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,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM;IAI5C,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAS9C;AAYD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG;IAC1E,kBAAkB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,0BAA0B,CAAC;CACxE,CAIA"}
|
|
@@ -7,8 +7,17 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { URI } from '@hydranium/langium';
|
|
10
|
+
import { defineMessage } from '@hydranium/protocol';
|
|
10
11
|
import { serverSharedFactory } from '../shared-services.js';
|
|
11
12
|
import { serveVirtualDocument } from './virtual-document.js';
|
|
13
|
+
/**
|
|
14
|
+
* The browser host's spelling of "the document is not there". Its Node
|
|
15
|
+
* counterpart is `NO_LOADABLE_CONTENT`: this provider has no `realpath`, so the
|
|
16
|
+
* URI policy cannot answer the existence question ahead of the read and the miss
|
|
17
|
+
* surfaces here instead.
|
|
18
|
+
*/
|
|
19
|
+
export const NO_SUCH_FILE = defineMessage('hydranium/core/no-such-file', 'No such file: {uri}');
|
|
20
|
+
export const NO_SUCH_PATH = defineMessage('hydranium/core/no-such-path', 'No such file or directory: {uri}');
|
|
12
21
|
/**
|
|
13
22
|
* A writable filesystem held in a `Map`, for a host with no disk — a browser
|
|
14
23
|
* worker, or a test that needs the workspace walk to find real content.
|
|
@@ -94,7 +103,7 @@ export class InMemoryFileSystemProvider {
|
|
|
94
103
|
}
|
|
95
104
|
const content = this.files.get(normalize(uri));
|
|
96
105
|
if (content === undefined) {
|
|
97
|
-
throw new Error(
|
|
106
|
+
throw new Error(NO_SUCH_FILE.format({ uri: uri.toString() }));
|
|
98
107
|
}
|
|
99
108
|
return content;
|
|
100
109
|
}
|
|
@@ -115,7 +124,7 @@ export class InMemoryFileSystemProvider {
|
|
|
115
124
|
if (this.hasChildren(path)) {
|
|
116
125
|
return { isFile: false, isDirectory: true, uri };
|
|
117
126
|
}
|
|
118
|
-
throw new Error(
|
|
127
|
+
throw new Error(NO_SUCH_PATH.format({ uri: uri.toString() }));
|
|
119
128
|
}
|
|
120
129
|
exists(uri) {
|
|
121
130
|
return Promise.resolve(this.existsSync(uri));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-file-system-provider.js","sourceRoot":"","sources":["../../../src/langium/workspace/in-memory-file-system-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAuB,GAAG,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"in-memory-file-system-provider.js","sourceRoot":"","sources":["../../../src/langium/workspace/in-memory-file-system-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAuB,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAe,MAAM,qBAAqB,CAAC;AAGjE,OAAO,EAAE,mBAAmB,EAAoC,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC,6BAA6B,EAAE,qBAAqB,CAAC,CAAC;AAEhG,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC,6BAA6B,EAAE,kCAAkC,CAAC,CAAC;AAuB7G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,OAAO,0BAA0B;IAKd;IAJH,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAClC,MAAM,CAAS;IAElC,YACsB,QAAqC,EACxD,UAAqC,EAAE;QADpB,aAAQ,GAAR,QAAQ,CAA6B;QAGxD,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,C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|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
import { type AstNode, DefaultLangiumDocuments, type LangiumDocument, type LangiumDocuments, type URI } from '@hydranium/langium';
|
|
10
10
|
import { type ServerSharedServicesMinimal } from '../shared-services.js';
|
|
11
11
|
import { type DocumentUriPolicy } from './document-uri-policy.js';
|
|
12
|
+
/**
|
|
13
|
+
* The document a caller asked to load is not there.
|
|
14
|
+
*
|
|
15
|
+
* User-facing, and the Node host's spelling of it: `loadUri` returns `undefined`
|
|
16
|
+
* exactly when the URI policy's `realpath` reports the path absent. A host whose
|
|
17
|
+
* provider has no `realpath` never reaches this — the miss surfaces from the
|
|
18
|
+
* provider instead, so the same condition has one declaration per host.
|
|
19
|
+
*/
|
|
20
|
+
export declare const NO_LOADABLE_CONTENT: import("@hydranium/protocol").MessageDefinition<"No loadable content for {uri}">;
|
|
12
21
|
/**
|
|
13
22
|
* The registry surface the framework adds on top of Langium's
|
|
14
23
|
* {@link LangiumDocuments}. Declared separately from the implementing class so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langium-documents.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/langium-documents.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,OAAO,EAAE,uBAAuB,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"langium-documents.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/langium-documents.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,OAAO,EAAE,uBAAuB,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAElI,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,kFAAuF,CAAC;AAExH;;;;;;GAMG;AACH,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IAChE,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,yBAA0B,SAAQ,uBAAwB,YAAW,yBAAyB;uBAIhE,QAAQ,EAAE,2BAA2B;IAH7E,sFAAsF;IACtF,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;gBAER,QAAQ,EAAE,2BAA2B;IAK7E;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,CAAC,OAAO,CAAC;IAMxC,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;CAgCjF"}
|
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { DefaultLangiumDocuments } from '@hydranium/langium';
|
|
10
|
+
import { defineMessage } from '@hydranium/protocol';
|
|
11
|
+
/**
|
|
12
|
+
* The document a caller asked to load is not there.
|
|
13
|
+
*
|
|
14
|
+
* User-facing, and the Node host's spelling of it: `loadUri` returns `undefined`
|
|
15
|
+
* exactly when the URI policy's `realpath` reports the path absent. A host whose
|
|
16
|
+
* provider has no `realpath` never reaches this — the miss surfaces from the
|
|
17
|
+
* provider instead, so the same condition has one declaration per host.
|
|
18
|
+
*/
|
|
19
|
+
export const NO_LOADABLE_CONTENT = defineMessage('hydranium/core/no-loadable-content', 'No loadable content for {uri}');
|
|
10
20
|
/**
|
|
11
21
|
* Default `LangiumDocuments` for `@hydranium/core` consumers, extending
|
|
12
22
|
* Langium's {@link DefaultLangiumDocuments} with:
|
|
@@ -96,7 +106,7 @@ export class HydraniumLangiumDocuments extends DefaultLangiumDocuments {
|
|
|
96
106
|
}
|
|
97
107
|
// The seam reports no loadable content, so there is nothing to read and
|
|
98
108
|
// no error from a read to carry.
|
|
99
|
-
throw new Error(
|
|
109
|
+
throw new Error(NO_LOADABLE_CONTENT.format({ uri: uri.toString() }));
|
|
100
110
|
}
|
|
101
111
|
}
|
|
102
112
|
//# sourceMappingURL=langium-documents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langium-documents.js","sourceRoot":"","sources":["../../../src/langium/workspace/langium-documents.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAgB,uBAAuB,EAAyD,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"langium-documents.js","sourceRoot":"","sources":["../../../src/langium/workspace/langium-documents.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAgB,uBAAuB,EAAyD,MAAM,oBAAoB,CAAC;AAClI,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,oCAAoC,EAAE,+BAA+B,CAAC,CAAC;AAaxH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAI3B;IAHxC,sFAAsF;IACnE,SAAS,CAAoB;IAEhD,YAAwC,QAAqC;QAC1E,KAAK,CAAC,QAAQ,CAAC,CAAC;QADqB,aAAQ,GAAR,QAAQ,CAA6B;QAE1E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,iBAAiB,CAAC;IACzD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,mBAAmB,CAAC,GAAQ;QACzB,yEAAyE;QACzE,uEAAuE;QACvE,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;IAEQ,KAAK,CAAC,mBAAmB,CAAC,GAAQ;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,QAAQ,EAAE,CAAC;YACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,QAAQ,EAAE,CAAC;gBACZ,iEAAiE;gBACjE,kEAAkE;gBAClE,sEAAsE;gBACtE,kEAAkE;gBAClE,uDAAuD;gBACvD,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAChE,OAAO,QAAQ,CAAC;YACnB,CAAC;YACD,IAAI,CAAC;gBACF,4DAA4D;gBAC5D,OAAO,MAAM,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YACpD,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACvB,oEAAoE;gBACpE,6DAA6D;gBAC7D,oEAAoE;gBACpE,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;gBAC7C,IAAI,SAAS,EAAE,CAAC;oBACb,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;oBACjE,OAAO,SAAS,CAAC;gBACpB,CAAC;gBACD,MAAM,KAAK,CAAC;YACf,CAAC;QACJ,CAAC;QACD,wEAAwE;QACxE,iCAAiC;QACjC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;CACH"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 MessageDefinition, type ParamsArg, type ResolvedMessage } from '@hydranium/protocol';
|
|
10
|
+
import type { AstNode, DiagnosticData, DiagnosticInfo, Properties, ValidationAcceptor } from '@hydranium/langium';
|
|
11
|
+
import type { Diagnostic } from 'vscode-languageserver-protocol';
|
|
12
|
+
/**
|
|
13
|
+
* Raise a validation diagnostic from a declaration, so the call site never
|
|
14
|
+
* restates the code or the sentence.
|
|
15
|
+
*
|
|
16
|
+
* `code` is omitted from `info` because this owns it — the framework claims LSP
|
|
17
|
+
* `Diagnostic.code` for framework codes, which collides with no adopter today
|
|
18
|
+
* and is a stated rule rather than an accident. `data` is deliberately NOT
|
|
19
|
+
* omitted: Langium owns `data.code` for code-action dispatch, so a caller has to
|
|
20
|
+
* be able to request a quick fix. The identity is merged OVER whatever they
|
|
21
|
+
* pass, which makes the two conventions co-exist rather than compete.
|
|
22
|
+
*
|
|
23
|
+
* The identity lands in both `code` and `data.hydranium` on purpose. `code` is
|
|
24
|
+
* what survives to the editor surface; Theia's converter drops `data` before the
|
|
25
|
+
* squiggle, so a parameterised diagnostic falls back to the server's English
|
|
26
|
+
* there while any adopter-owned surface can still render the parameterised form
|
|
27
|
+
* from the marker store.
|
|
28
|
+
*
|
|
29
|
+
* `DiagnosticInfo` must be Langium's own type: a `Parameters<ValidationAcceptor>[2]`
|
|
30
|
+
* shortcut compiles but loses the `property?: Properties<N>` relation. The `data`
|
|
31
|
+
* re-type has to be an intersection rather than an `Omit` alone, because Langium
|
|
32
|
+
* declares `data?: unknown` and an `unknown` cannot be spread.
|
|
33
|
+
*/
|
|
34
|
+
export declare function acceptMessage<S extends string, N extends AstNode, P extends Properties<N> = Properties<N>>(accept: ValidationAcceptor, severity: 'error' | 'warning' | 'info' | 'hint', message: MessageDefinition<S>, info: Omit<DiagnosticInfo<N, P>, 'code' | 'data'> & {
|
|
35
|
+
data?: Partial<DiagnosticData>;
|
|
36
|
+
}, ...params: ParamsArg<S>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Recover the identity from a published diagnostic, for a surface that renders
|
|
39
|
+
* diagnostics itself.
|
|
40
|
+
*
|
|
41
|
+
* The `MarkupContent` narrowing is not padding: `Diagnostic.message` is
|
|
42
|
+
* `string | MarkupContent` in LSP 3.17+ and this does not compile without it.
|
|
43
|
+
* Only the string form is a resolved English sentence.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolvedFromDiagnostic(diagnostic: Diagnostic): ResolvedMessage | undefined;
|
|
46
|
+
//# sourceMappingURL=carriers.d.ts.map
|
|
@@ -0,0 +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,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;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;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,eAAe,GAAG,SAAS,CAM1F"}
|
|
@@ -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
|
+
import { hasMessageIdentity, messageData } from '@hydranium/protocol';
|
|
10
|
+
/**
|
|
11
|
+
* Raise a validation diagnostic from a declaration, so the call site never
|
|
12
|
+
* restates the code or the sentence.
|
|
13
|
+
*
|
|
14
|
+
* `code` is omitted from `info` because this owns it — the framework claims LSP
|
|
15
|
+
* `Diagnostic.code` for framework codes, which collides with no adopter today
|
|
16
|
+
* and is a stated rule rather than an accident. `data` is deliberately NOT
|
|
17
|
+
* omitted: Langium owns `data.code` for code-action dispatch, so a caller has to
|
|
18
|
+
* be able to request a quick fix. The identity is merged OVER whatever they
|
|
19
|
+
* pass, which makes the two conventions co-exist rather than compete.
|
|
20
|
+
*
|
|
21
|
+
* The identity lands in both `code` and `data.hydranium` on purpose. `code` is
|
|
22
|
+
* what survives to the editor surface; Theia's converter drops `data` before the
|
|
23
|
+
* squiggle, so a parameterised diagnostic falls back to the server's English
|
|
24
|
+
* there while any adopter-owned surface can still render the parameterised form
|
|
25
|
+
* from the marker store.
|
|
26
|
+
*
|
|
27
|
+
* `DiagnosticInfo` must be Langium's own type: a `Parameters<ValidationAcceptor>[2]`
|
|
28
|
+
* shortcut compiles but loses the `property?: Properties<N>` relation. The `data`
|
|
29
|
+
* re-type has to be an intersection rather than an `Omit` alone, because Langium
|
|
30
|
+
* declares `data?: unknown` and an `unknown` cannot be spread.
|
|
31
|
+
*/
|
|
32
|
+
export function acceptMessage(accept, severity, message, info, ...params) {
|
|
33
|
+
const data = { ...info.data, ...messageData(message, ...params) };
|
|
34
|
+
accept(severity, message.format(...params), { ...info, code: message.code, data });
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Recover the identity from a published diagnostic, for a surface that renders
|
|
38
|
+
* diagnostics itself.
|
|
39
|
+
*
|
|
40
|
+
* The `MarkupContent` narrowing is not padding: `Diagnostic.message` is
|
|
41
|
+
* `string | MarkupContent` in LSP 3.17+ and this does not compile without it.
|
|
42
|
+
* Only the string form is a resolved English sentence.
|
|
43
|
+
*/
|
|
44
|
+
export function resolvedFromDiagnostic(diagnostic) {
|
|
45
|
+
if (!hasMessageIdentity(diagnostic.data)) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const text = typeof diagnostic.message === 'string' ? diagnostic.message : diagnostic.message.value;
|
|
49
|
+
return { ...diagnostic.data.hydranium, text };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=carriers.js.map
|
|
@@ -0,0 +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;AAI7B;;;;;;;;;;;;;;;;;;;;;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;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAsB;IAC1D,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACpB,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,UAAU,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC;IACpG,OAAO,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
* Every user-facing message `@hydranium/core` raises, plus the carrier helpers
|
|
11
|
+
* that attach an identity to one.
|
|
12
|
+
*
|
|
13
|
+
* Declarations stay beside their call sites and are re-exported here, so this is
|
|
14
|
+
* enumeration rather than centralization: a code's package segment has to name
|
|
15
|
+
* the package that raises it. The English is a fallback, not a contract; the
|
|
16
|
+
* code is the contract, and renaming one is a breaking change.
|
|
17
|
+
*/
|
|
18
|
+
export * from './carriers.js';
|
|
19
|
+
export { SEPARATOR_IN_NAME } from '../langium/naming/name-separator-validation.js';
|
|
20
|
+
export { NO_LOADABLE_CONTENT } from '../langium/workspace/langium-documents.js';
|
|
21
|
+
export { NO_SUCH_FILE, NO_SUCH_PATH } from '../langium/workspace/in-memory-file-system-provider.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
* Every user-facing message `@hydranium/core` raises, plus the carrier helpers
|
|
11
|
+
* that attach an identity to one.
|
|
12
|
+
*
|
|
13
|
+
* Declarations stay beside their call sites and are re-exported here, so this is
|
|
14
|
+
* enumeration rather than centralization: a code's package segment has to name
|
|
15
|
+
* the package that raises it. The English is a fallback, not a contract; the
|
|
16
|
+
* code is the contract, and renaming one is a breaking change.
|
|
17
|
+
*/
|
|
18
|
+
export * from './carriers.js';
|
|
19
|
+
export { SEPARATOR_IN_NAME } from '../langium/naming/name-separator-validation.js';
|
|
20
|
+
export { NO_LOADABLE_CONTENT } from '../langium/workspace/langium-documents.js';
|
|
21
|
+
export { NO_SUCH_FILE, NO_SUCH_PATH } from '../langium/workspace/in-memory-file-system-provider.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/core",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.27",
|
|
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",
|
|
@@ -72,6 +72,14 @@
|
|
|
72
72
|
"./lib/testing/playwright": {
|
|
73
73
|
"types": "./lib/testing/playwright/index.d.ts",
|
|
74
74
|
"default": "./lib/testing/playwright/index.js"
|
|
75
|
+
},
|
|
76
|
+
"./messages": {
|
|
77
|
+
"types": "./lib/messages/index.d.ts",
|
|
78
|
+
"default": "./lib/messages/index.js"
|
|
79
|
+
},
|
|
80
|
+
"./lib/messages": {
|
|
81
|
+
"types": "./lib/messages/index.d.ts",
|
|
82
|
+
"default": "./lib/messages/index.js"
|
|
75
83
|
}
|
|
76
84
|
},
|
|
77
85
|
"main": "lib/index.js",
|
|
@@ -96,8 +104,8 @@
|
|
|
96
104
|
"diff": "^5.2.0"
|
|
97
105
|
},
|
|
98
106
|
"devDependencies": {
|
|
99
|
-
"@hydranium/langium": "1.0.0-next.
|
|
100
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
107
|
+
"@hydranium/langium": "1.0.0-next.27",
|
|
108
|
+
"@hydranium/protocol": "1.0.0-next.27",
|
|
101
109
|
"@playwright/test": "^1.40.0",
|
|
102
110
|
"@types/diff": "^5.2.0",
|
|
103
111
|
"rimraf": "^5.0.0",
|
|
@@ -109,8 +117,8 @@
|
|
|
109
117
|
"vscode-languageserver-types": "^3.17.5"
|
|
110
118
|
},
|
|
111
119
|
"peerDependencies": {
|
|
112
|
-
"@hydranium/langium": "1.0.0-next.
|
|
113
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
120
|
+
"@hydranium/langium": "1.0.0-next.27",
|
|
121
|
+
"@hydranium/protocol": "1.0.0-next.27",
|
|
114
122
|
"@playwright/test": "^1.40.0",
|
|
115
123
|
"vscode-jsonrpc": "9.0.1",
|
|
116
124
|
"vscode-languageserver": "~10.0.1",
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
10
|
import { type AstNode, type ValidationAcceptor, type ValidationChecks } from '@hydranium/langium';
|
|
11
|
+
import { defineMessage } from '@hydranium/protocol';
|
|
12
|
+
import { acceptMessage } from '../../messages/carriers.js';
|
|
13
|
+
|
|
14
|
+
export const SEPARATOR_IN_NAME = defineMessage(
|
|
15
|
+
'hydranium/core/separator-in-name',
|
|
16
|
+
"Name '{name}' contains the configured name separator '{separator}', which is reserved for qualified-name composition — use a different character."
|
|
17
|
+
);
|
|
11
18
|
import { type ServerLanguageServices } from '../language-module.js';
|
|
12
19
|
import { type ValidationCheckContribution, type ValidationCheckRegistry } from '../validation/validation-contribution.js';
|
|
13
20
|
import type { NameProvider } from './name-provider.js';
|
|
@@ -38,11 +45,11 @@ export function nameSeparatorCheck(nameProvider: NameProvider): (node: AstNode,
|
|
|
38
45
|
}
|
|
39
46
|
const separator = nameProvider.nameSeparator;
|
|
40
47
|
if (ownName.includes(separator)) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
);
|
|
48
|
+
// `{ node }` rather than `{ node, property: 'name' }`: moving the
|
|
49
|
+
// squiggle onto the name property is a behaviour change to the one
|
|
50
|
+
// diagnostic every adopter receives by default, so it is decided on its
|
|
51
|
+
// own merits rather than carried in by a mechanical migration.
|
|
52
|
+
acceptMessage(accept, 'error', SEPARATOR_IN_NAME, { node }, { name: ownName, separator });
|
|
46
53
|
}
|
|
47
54
|
};
|
|
48
55
|
}
|
|
@@ -8,12 +8,22 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
10
|
import { type FileSystemNode, URI } from '@hydranium/langium';
|
|
11
|
-
import { type Tracer } from '@hydranium/protocol';
|
|
11
|
+
import { defineMessage, type Tracer } from '@hydranium/protocol';
|
|
12
12
|
import { type WritableFileSystemProvider } from '../../documents/ast-document-manager.js';
|
|
13
13
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
14
14
|
import { serverSharedFactory, type ServerSharedServicesMinimal } from '../shared-services.js';
|
|
15
15
|
import { serveVirtualDocument } from './virtual-document.js';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* The browser host's spelling of "the document is not there". Its Node
|
|
19
|
+
* counterpart is `NO_LOADABLE_CONTENT`: this provider has no `realpath`, so the
|
|
20
|
+
* URI policy cannot answer the existence question ahead of the read and the miss
|
|
21
|
+
* surfaces here instead.
|
|
22
|
+
*/
|
|
23
|
+
export const NO_SUCH_FILE = defineMessage('hydranium/core/no-such-file', 'No such file: {uri}');
|
|
24
|
+
|
|
25
|
+
export const NO_SUCH_PATH = defineMessage('hydranium/core/no-such-path', 'No such file or directory: {uri}');
|
|
26
|
+
|
|
17
27
|
/**
|
|
18
28
|
* File content keyed by path, for seeding an {@link InMemoryFileSystemProvider}.
|
|
19
29
|
*
|
|
@@ -127,7 +137,7 @@ export class InMemoryFileSystemProvider implements WritableFileSystemProvider {
|
|
|
127
137
|
}
|
|
128
138
|
const content = this.files.get(normalize(uri));
|
|
129
139
|
if (content === undefined) {
|
|
130
|
-
throw new Error(
|
|
140
|
+
throw new Error(NO_SUCH_FILE.format({ uri: uri.toString() }));
|
|
131
141
|
}
|
|
132
142
|
return content;
|
|
133
143
|
}
|
|
@@ -152,7 +162,7 @@ export class InMemoryFileSystemProvider implements WritableFileSystemProvider {
|
|
|
152
162
|
if (this.hasChildren(path)) {
|
|
153
163
|
return { isFile: false, isDirectory: true, uri };
|
|
154
164
|
}
|
|
155
|
-
throw new Error(
|
|
165
|
+
throw new Error(NO_SUCH_PATH.format({ uri: uri.toString() }));
|
|
156
166
|
}
|
|
157
167
|
|
|
158
168
|
exists(uri: URI): Promise<boolean> {
|
|
@@ -8,9 +8,20 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
|
|
10
10
|
import { type AstNode, DefaultLangiumDocuments, type LangiumDocument, type LangiumDocuments, type URI } from '@hydranium/langium';
|
|
11
|
+
import { defineMessage } from '@hydranium/protocol';
|
|
11
12
|
import { type ServerSharedServicesMinimal } from '../shared-services.js';
|
|
12
13
|
import { type DocumentUriPolicy } from './document-uri-policy.js';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* The document a caller asked to load is not there.
|
|
17
|
+
*
|
|
18
|
+
* User-facing, and the Node host's spelling of it: `loadUri` returns `undefined`
|
|
19
|
+
* exactly when the URI policy's `realpath` reports the path absent. A host whose
|
|
20
|
+
* provider has no `realpath` never reaches this — the miss surfaces from the
|
|
21
|
+
* provider instead, so the same condition has one declaration per host.
|
|
22
|
+
*/
|
|
23
|
+
export const NO_LOADABLE_CONTENT = defineMessage('hydranium/core/no-loadable-content', 'No loadable content for {uri}');
|
|
24
|
+
|
|
14
25
|
/**
|
|
15
26
|
* The registry surface the framework adds on top of Langium's
|
|
16
27
|
* {@link LangiumDocuments}. Declared separately from the implementing class so
|
|
@@ -111,6 +122,6 @@ export class HydraniumLangiumDocuments extends DefaultLangiumDocuments implement
|
|
|
111
122
|
}
|
|
112
123
|
// The seam reports no loadable content, so there is nothing to read and
|
|
113
124
|
// no error from a read to carry.
|
|
114
|
-
throw new Error(
|
|
125
|
+
throw new Error(NO_LOADABLE_CONTENT.format({ uri: uri.toString() }));
|
|
115
126
|
}
|
|
116
127
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 {
|
|
11
|
+
hasMessageIdentity,
|
|
12
|
+
messageData,
|
|
13
|
+
type HydraniumMessageData,
|
|
14
|
+
type MessageDefinition,
|
|
15
|
+
type ParamsArg,
|
|
16
|
+
type ResolvedMessage
|
|
17
|
+
} from '@hydranium/protocol';
|
|
18
|
+
import type { AstNode, DiagnosticData, DiagnosticInfo, Properties, ValidationAcceptor } from '@hydranium/langium';
|
|
19
|
+
import type { Diagnostic } from 'vscode-languageserver-protocol';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Raise a validation diagnostic from a declaration, so the call site never
|
|
23
|
+
* restates the code or the sentence.
|
|
24
|
+
*
|
|
25
|
+
* `code` is omitted from `info` because this owns it — the framework claims LSP
|
|
26
|
+
* `Diagnostic.code` for framework codes, which collides with no adopter today
|
|
27
|
+
* and is a stated rule rather than an accident. `data` is deliberately NOT
|
|
28
|
+
* omitted: Langium owns `data.code` for code-action dispatch, so a caller has to
|
|
29
|
+
* be able to request a quick fix. The identity is merged OVER whatever they
|
|
30
|
+
* pass, which makes the two conventions co-exist rather than compete.
|
|
31
|
+
*
|
|
32
|
+
* The identity lands in both `code` and `data.hydranium` on purpose. `code` is
|
|
33
|
+
* what survives to the editor surface; Theia's converter drops `data` before the
|
|
34
|
+
* squiggle, so a parameterised diagnostic falls back to the server's English
|
|
35
|
+
* there while any adopter-owned surface can still render the parameterised form
|
|
36
|
+
* from the marker store.
|
|
37
|
+
*
|
|
38
|
+
* `DiagnosticInfo` must be Langium's own type: a `Parameters<ValidationAcceptor>[2]`
|
|
39
|
+
* shortcut compiles but loses the `property?: Properties<N>` relation. The `data`
|
|
40
|
+
* re-type has to be an intersection rather than an `Omit` alone, because Langium
|
|
41
|
+
* declares `data?: unknown` and an `unknown` cannot be spread.
|
|
42
|
+
*/
|
|
43
|
+
export function acceptMessage<S extends string, N extends AstNode, P extends Properties<N> = Properties<N>>(
|
|
44
|
+
accept: ValidationAcceptor,
|
|
45
|
+
severity: 'error' | 'warning' | 'info' | 'hint',
|
|
46
|
+
message: MessageDefinition<S>,
|
|
47
|
+
info: Omit<DiagnosticInfo<N, P>, 'code' | 'data'> & { data?: Partial<DiagnosticData> },
|
|
48
|
+
...params: ParamsArg<S>
|
|
49
|
+
): void {
|
|
50
|
+
const data: HydraniumMessageData & Partial<DiagnosticData> = { ...info.data, ...messageData(message, ...params) };
|
|
51
|
+
accept(severity, message.format(...params), { ...info, code: message.code, data });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Recover the identity from a published diagnostic, for a surface that renders
|
|
56
|
+
* diagnostics itself.
|
|
57
|
+
*
|
|
58
|
+
* The `MarkupContent` narrowing is not padding: `Diagnostic.message` is
|
|
59
|
+
* `string | MarkupContent` in LSP 3.17+ and this does not compile without it.
|
|
60
|
+
* Only the string form is a resolved English sentence.
|
|
61
|
+
*/
|
|
62
|
+
export function resolvedFromDiagnostic(diagnostic: Diagnostic): ResolvedMessage | undefined {
|
|
63
|
+
if (!hasMessageIdentity(diagnostic.data)) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const text = typeof diagnostic.message === 'string' ? diagnostic.message : diagnostic.message.value;
|
|
67
|
+
return { ...diagnostic.data.hydranium, text };
|
|
68
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
* Every user-facing message `@hydranium/core` raises, plus the carrier helpers
|
|
12
|
+
* that attach an identity to one.
|
|
13
|
+
*
|
|
14
|
+
* Declarations stay beside their call sites and are re-exported here, so this is
|
|
15
|
+
* enumeration rather than centralization: a code's package segment has to name
|
|
16
|
+
* the package that raises it. The English is a fallback, not a contract; the
|
|
17
|
+
* code is the contract, and renaming one is a breaking change.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export * from './carriers.js';
|
|
21
|
+
|
|
22
|
+
export { SEPARATOR_IN_NAME } from '../langium/naming/name-separator-validation.js';
|
|
23
|
+
export { NO_LOADABLE_CONTENT } from '../langium/workspace/langium-documents.js';
|
|
24
|
+
export { NO_SUCH_FILE, NO_SUCH_PATH } from '../langium/workspace/in-memory-file-system-provider.js';
|