@hydranium/core 1.0.0-next.76 → 1.0.0-next.79

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
- import { defineMessage, describeError, messageData, ObservableValue, TransferDiagnostic } from '@hydranium/protocol';
9
+ import { defineMessage, describeError, interpolate, messageData, ObservableValue, TransferDiagnostic } from '@hydranium/protocol';
10
10
  import { DefaultDocumentValidator, DocumentValidator } from '@hydranium/langium';
11
11
  // A VALUE import, for `Diagnostic.getMessageString`: `message` is
12
12
  // `string | MarkupContent` in LSP 3.17+, so upstream's own reader is what
@@ -55,7 +55,90 @@ export const UNRESOLVED_REFERENCE = defineMessage('hydranium/core/unresolved-ref
55
55
  * means: chevrotain reports how many characters the lexer discarded to recover,
56
56
  * which for a single stray character is one and for a run of them is the run.
57
57
  */
58
- export const LEXING_ERROR = defineMessage('hydranium/core/lexing-error', 'unexpected character: ->{character}<- at offset: {offset}, skipped {skipped} characters.');
58
+ export const UNEXPECTED_CHARACTER = defineMessage('hydranium/core/unexpected-character', 'unexpected character: ->{character}<- at offset: {offset}, skipped {skipped} characters.');
59
+ /**
60
+ * A token the grammar does not admit at this position.
61
+ *
62
+ * **The English is byte-identical to Langium's
63
+ * `LangiumParserErrorMessageProvider.buildMismatchTokenMessage`, and must stay
64
+ * so**, on the same rule as {@link UNRESOLVED_REFERENCE}.
65
+ *
66
+ * `expected` is a token type name, which is grammar vocabulary rather than
67
+ * translatable text — only the frame around it is. Promoting it into the code
68
+ * instead would make the catalogue as large as the grammar.
69
+ */
70
+ export const UNEXPECTED_TOKEN = defineMessage('hydranium/core/unexpected-token', "Expecting token of type '{expected}' but found `{found}`.");
71
+ /**
72
+ * Input left over once the entry rule had matched.
73
+ *
74
+ * **The English is byte-identical to Langium's
75
+ * `LangiumParserErrorMessageProvider.buildNotAllInputParsedMessage`, and must
76
+ * stay so.**
77
+ */
78
+ export const TRAILING_INPUT = defineMessage('hydranium/core/trailing-input', 'Expecting end of file but found `{found}`.');
79
+ /**
80
+ * A mode-popping token reached with nothing on the lexer's mode stack.
81
+ *
82
+ * **The English is byte-identical to CHEVROTAIN's
83
+ * `defaultLexerErrorProvider.buildUnableToPopLexerModeMessage`, and must stay
84
+ * so**, the closing clause running on without punctuation exactly as upstream
85
+ * writes it.
86
+ *
87
+ * Reachable only from a multi-mode lexer, which a grammar opts into through a
88
+ * custom token builder.
89
+ */
90
+ export const UNPOPPABLE_LEXER_MODE = defineMessage('hydranium/core/unpoppable-lexer-mode', 'Unable to pop Lexer Mode after encountering Token ->{image}<- The Mode Stack is empty');
91
+ /**
92
+ * A dedent that lines up with no enclosing indentation level.
93
+ *
94
+ * **The English is byte-identical to LANGIUM's `IndentationAwareTokenBuilder`,
95
+ * and must stay so** — the one lexing sentence Langium words itself rather than
96
+ * relaying from chevrotain, which is why it renders through no
97
+ * `ILexerErrorMessageProvider` and an adopter cannot reach it by replacing one.
98
+ *
99
+ * `stack` is the indentation stack as the template literal upstream stringifies
100
+ * it, comma-joined: structure would have to survive {@link MessageParams}, which
101
+ * holds scalars, and a translation has nothing to say about the numbers anyway.
102
+ */
103
+ export const INVALID_DEDENT = defineMessage('hydranium/core/invalid-dedent', 'Invalid dedent level {level} at offset: {offset}. Current indentation stack: {stack}');
104
+ /**
105
+ * A position where none of a rule's alternatives can start.
106
+ *
107
+ * **The English is byte-identical to CHEVROTAIN's
108
+ * `defaultParserErrorProvider.buildNoViableAltMessage`, and must stay so** —
109
+ * one layer further out than {@link UNEXPECTED_TOKEN}, because Langium overrides
110
+ * only two of the four parser sentences and passes this one straight through.
111
+ *
112
+ * `sequences` is the token-sequence list chevrotain generated, carried whole
113
+ * rather than as structure: {@link MessageParams} holds scalars, and the list is
114
+ * token names in any case, so only the frame around it is translatable.
115
+ */
116
+ export const NO_VIABLE_ALTERNATIVE = defineMessage('hydranium/core/no-viable-alternative', "Expecting: one of these possible Token sequences:\n{sequences}\nbut found: '{found}'");
117
+ /**
118
+ * A repetition that had to match at least once and matched nothing.
119
+ *
120
+ * **The English is byte-identical to CHEVROTAIN's
121
+ * `defaultParserErrorProvider.buildEarlyExitMessage`, and must stay so**,
122
+ * including the doubled colon after `sequences::`, which is upstream's and not a
123
+ * typo to repair here — a divergence would silently stop the identity attaching.
124
+ *
125
+ * Named for the empty repetition rather than for chevrotain's `EarlyExit`, which
126
+ * describes its own control flow rather than the reader's problem.
127
+ */
128
+ export const MISSING_ITERATION = defineMessage('hydranium/core/missing-iteration', "Expecting: expecting at least one iteration which starts with one of these possible Token sequences::\n <{sequences}>\nbut found: '{found}'");
129
+ /**
130
+ * The two sentences whose only free parameter is a generated list, in the order
131
+ * {@link HydraniumDocumentValidator.identifyParsingError} tries them. Order is
132
+ * free: their frames share a prefix but diverge before the list begins, so at
133
+ * most one can match.
134
+ */
135
+ const SEQUENCE_LISTING_MESSAGES = [NO_VIABLE_ALTERNATIVE, MISSING_ITERATION];
136
+ /**
137
+ * Splits a template into alternating frame and placeholder NAME, for
138
+ * {@link HydraniumDocumentValidator.sliceFramed}. The capturing group is what
139
+ * keeps the names in the result rather than discarding them.
140
+ */
141
+ const PLACEHOLDER_CAPTURE = /\{([^}]+)\}/;
59
142
  /**
60
143
  * Langium's own `data.code` values for a diagnostic that came out of the lexer.
61
144
  *
@@ -85,6 +168,12 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
85
168
  tracer;
86
169
  astNodeLocator;
87
170
  reflection;
171
+ lexer;
172
+ /**
173
+ * {@link tokenTypeNames}' answer. Nothing invalidates it: the vocabulary
174
+ * comes from the grammar, which is fixed once the DI tree is composed.
175
+ */
176
+ expectedNames;
88
177
  logLevel;
89
178
  logAfterMs;
90
179
  validateVirtualDocuments;
@@ -94,6 +183,7 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
94
183
  this.tracer = services.shared.Tracer.for(options.logName ?? 'DocumentValidator').trace('instantiated');
95
184
  this.astNodeLocator = services.workspace.AstNodeLocator;
96
185
  this.reflection = services.shared.AstReflection;
186
+ this.lexer = services.parser.Lexer;
97
187
  this.logLevel = ObservableValue.from(options.logLevel ?? 'debug');
98
188
  this.logAfterMs = ObservableValue.from(options.logAfterMs ?? 20);
99
189
  this.validateVirtualDocuments = ObservableValue.from(options.validateVirtualDocuments ?? false);
@@ -120,18 +210,22 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
120
210
  });
121
211
  }
122
212
  /**
123
- * Langium's validation pass, plus the framework identity on the lexing
124
- * diagnostics it produced.
213
+ * Langium's validation pass, plus the framework identity on the lexing and
214
+ * parsing diagnostics it produced.
125
215
  *
126
- * **Here rather than in an override of `processLexingErrors`, and the reason
127
- * is that the seam cannot see what the identity needs.** Langium hands that
128
- * method a `ParseResult`, which carries the AST and the error lists but not
129
- * the source text — and the offending CHARACTER is the parameter a
130
- * translation exists to interpolate. The document does carry it, and this is
131
- * the innermost point that still holds one. Reconstructing the character by
132
- * matching it out of the finished sentence was the alternative, and it
133
- * inverts the direction the rest of this file works in: every other identity
134
- * here is derived from structured fields and CHECKED against the prose.
216
+ * **Here rather than in an override of `processLexingErrors` /
217
+ * `processParsingErrors`, and the reason is that neither seam can see what
218
+ * the identity needs.** Langium hands them a `ParseResult`, which carries the
219
+ * AST and the error lists but not the source text — and the offending
220
+ * CHARACTER, or the offending TOKEN, is the parameter a translation exists to
221
+ * interpolate. The document does carry it, and this is the innermost point
222
+ * that still holds one.
223
+ *
224
+ * Correlating the finished diagnostics back to the `ParseResult`'s error
225
+ * lists positionally is the alternative, and it is unsound for the parsing
226
+ * half: `processParsingErrors` DROPS an error whose token offsets are `NaN`
227
+ * and whose exception carries no `previousToken`, so the two lists differ in
228
+ * length exactly when recovery has been at work.
135
229
  *
136
230
  * Inside the timing span rather than around it, so the line accounts for the
137
231
  * whole pass.
@@ -141,14 +235,18 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
141
235
  // Mapped in place over the array Langium built, rather than filtered and
142
236
  // re-concatenated: the publish order is the diagnostic order and a
143
237
  // reordering would move a squiggle's entry in the problems list.
238
+ // Each pass guards on its own `data.code`, so at most one can claim a
239
+ // given diagnostic and the order between them carries no meaning.
144
240
  for (let index = 0; index < diagnostics.length; index++) {
145
241
  diagnostics[index] = this.identifyLexingError(document, diagnostics[index]);
242
+ diagnostics[index] = this.identifyParsingError(document, diagnostics[index]);
146
243
  }
147
244
  return diagnostics;
148
245
  }
149
246
  /**
150
- * Add the {@link LEXING_ERROR} identity to one diagnostic, or return it
151
- * untouched when it is not the sentence that identity renders.
247
+ * Add whichever lexing identity renders `diagnostic`'s sentence, or return it
248
+ * untouched when none of them does — a custom lexer's own report, which
249
+ * Langium admits through `lexerReport`, being the case that reaches the end.
152
250
  *
153
251
  * The parameters come from the diagnostic's own RANGE, not from
154
252
  * `parseResult.lexerErrors`. Both hold the same numbers, and the range is the
@@ -168,19 +266,157 @@ export class HydraniumDocumentValidator extends DefaultDocumentValidator {
168
266
  return diagnostic;
169
267
  }
170
268
  const text = document.textDocument;
269
+ const message = Diagnostic.getMessageString(diagnostic);
171
270
  const offset = text.offsetAt(diagnostic.range.start);
172
- const params = {
271
+ const stray = {
173
272
  character: text.getText().charAt(offset),
174
273
  offset,
175
274
  skipped: text.offsetAt(diagnostic.range.end) - offset
176
275
  };
177
- if (Diagnostic.getMessageString(diagnostic) !== LEXING_ERROR.format(params)) {
276
+ if (message === UNEXPECTED_CHARACTER.format(stray)) {
277
+ return this.identified(diagnostic, UNEXPECTED_CHARACTER, stray);
278
+ }
279
+ // The mode-pop error's range spans the offending token exactly, upstream
280
+ // reporting its `startOffset` with the image's own length.
281
+ const image = text.getText(diagnostic.range);
282
+ if (message === UNPOPPABLE_LEXER_MODE.format({ image })) {
283
+ return this.identified(diagnostic, UNPOPPABLE_LEXER_MODE, { image });
284
+ }
285
+ // `level` and `stack` are lexer state that reaches no field here, so they
286
+ // are sliced; `offset` is given, which is what anchors the slice.
287
+ const dedent = this.sliceFramed(message, INVALID_DEDENT, { offset });
288
+ return dedent === undefined ? diagnostic : this.identified(diagnostic, INVALID_DEDENT, dedent);
289
+ }
290
+ /**
291
+ * Add whichever parser identity renders `diagnostic`'s sentence, or return it
292
+ * untouched when none of them does — an adopter that replaced the parser
293
+ * error-message provider being the case that reaches the last branch.
294
+ *
295
+ * `found` comes from the diagnostic's own RANGE, for the same reason
296
+ * {@link identifyLexingError} reads its parameters there. A token whose
297
+ * offsets chevrotain could not report collapses to a zero-width range, which
298
+ * yields the empty string the sentence already renders for it.
299
+ *
300
+ * **`expected` is recovered by SEARCHING the vocabulary, because nothing
301
+ * carries it.** Chevrotain hands the expected token type to the message
302
+ * provider and keeps it on neither the exception nor the diagnostic, so the
303
+ * only structured source left is the grammar's own vocabulary: every token
304
+ * type is offered to the same `format` the identity renders with, and the one
305
+ * that reproduces the message supplies the parameter. Matching it out of the
306
+ * prose instead would derive a parameter from a sentence that a Langium
307
+ * reword can change without warning. Two distinct names cannot render one
308
+ * sentence, so the match is unique where it exists.
309
+ */
310
+ identifyParsingError(document, diagnostic) {
311
+ const data = diagnostic.data;
312
+ if (data?.code !== DocumentValidator.ParsingError) {
178
313
  return diagnostic;
179
314
  }
180
- // Merged OVER Langium's data, so `data.code` survives for the readers that
181
- // switch on it — `stopAfterLexingErrors` is one, and the GLSP head's
182
- // read-only decision is another.
183
- return { ...diagnostic, code: LEXING_ERROR.code, data: { ...data, ...messageData(LEXING_ERROR, params) } };
315
+ const message = Diagnostic.getMessageString(diagnostic);
316
+ const found = document.textDocument.getText(diagnostic.range);
317
+ if (message === TRAILING_INPUT.format({ found })) {
318
+ return this.identified(diagnostic, TRAILING_INPUT, { found });
319
+ }
320
+ const expected = this.tokenTypeNames().find(name => UNEXPECTED_TOKEN.format({ expected: name, found }) === message);
321
+ if (expected !== undefined) {
322
+ return this.identified(diagnostic, UNEXPECTED_TOKEN, { expected, found });
323
+ }
324
+ for (const definition of SEQUENCE_LISTING_MESSAGES) {
325
+ const params = this.sliceFramed(message, definition, { found });
326
+ if (params !== undefined) {
327
+ return this.identified(diagnostic, definition, params);
328
+ }
329
+ }
330
+ return diagnostic;
331
+ }
332
+ /** `diagnostic` carrying `definition`'s identity, over whatever `data` it already had. */
333
+ identified(diagnostic, definition, ...params) {
334
+ // Merged OVER the existing data, so Langium's `code` survives for the
335
+ // readers that switch on it — `stopAfterParsingErrors` is one, and the
336
+ // GLSP head's read-only decision is another.
337
+ const data = diagnostic.data;
338
+ return { ...diagnostic, code: definition.code, data: { ...data, ...messageData(definition, ...params) } };
339
+ }
340
+ /**
341
+ * `definition`'s parameters as they appear in `message`, taking the ones in
342
+ * `known` as given, or `undefined` when `message` is not that sentence.
343
+ *
344
+ * **The only parameters in this file taken OUT of the prose rather than
345
+ * derived and checked against it, and the bound on that is what `known`
346
+ * is for.** A generated token-sequence list, a lexer's indentation stack: for
347
+ * these there is no finite candidate set to offer to `format` the way a token
348
+ * type name can be, and no structured field carries them. What keeps the read
349
+ * honest is that everything else in the sentence is either a fixed literal or
350
+ * a parameter the caller derived independently, so the frame either matches
351
+ * exactly or the sentence is declined.
352
+ *
353
+ * **The trailing format-and-compare is load-bearing once more than one
354
+ * parameter is unknown.** Each is captured up to the NEXT fixed separator, so
355
+ * a separator that also occurs inside a value would cut early — re-rendering
356
+ * catches that, where for a single unknown between two affixes it could not
357
+ * fail. Two adjacent placeholders are declined outright: nothing marks the
358
+ * boundary, so no capture is recoverable.
359
+ *
360
+ * The frame is split off the declaration's own `text`, so it cannot drift
361
+ * from the sentence `format` renders.
362
+ */
363
+ sliceFramed(message, definition, known) {
364
+ // `split` with a capturing group interleaves literals and placeholder
365
+ // names, so even indices are frame and odd ones are parameters.
366
+ const parts = definition.text.split(PLACEHOLDER_CAPTURE);
367
+ const params = { ...known };
368
+ let cursor = 0;
369
+ for (let index = 0; index < parts.length; index += 2) {
370
+ const literal = parts[index];
371
+ if (!message.startsWith(literal, cursor)) {
372
+ return undefined;
373
+ }
374
+ cursor += literal.length;
375
+ const name = parts[index + 1];
376
+ if (name === undefined) {
377
+ break;
378
+ }
379
+ const given = params[name];
380
+ if (given !== undefined) {
381
+ const rendered = String(given);
382
+ if (!message.startsWith(rendered, cursor)) {
383
+ return undefined;
384
+ }
385
+ cursor += rendered.length;
386
+ continue;
387
+ }
388
+ const separator = parts[index + 2];
389
+ const trailing = parts[index + 3] === undefined;
390
+ if (separator === '' && !trailing) {
391
+ return undefined;
392
+ }
393
+ const at = trailing && separator === '' ? message.length : message.indexOf(separator, cursor);
394
+ if (at < cursor) {
395
+ return undefined;
396
+ }
397
+ params[name] = message.slice(cursor, at);
398
+ cursor = at;
399
+ }
400
+ if (cursor !== message.length || interpolate(definition.text, params) !== message) {
401
+ return undefined;
402
+ }
403
+ // Narrowing only: every placeholder the template names was either given or
404
+ // captured above, which is precisely what `ParamsOf` requires.
405
+ return params;
406
+ }
407
+ /**
408
+ * Every token type name the grammar declares, as
409
+ * {@link identifyParsingError} candidates.
410
+ *
411
+ * Read off the lexer, whose `definition` the `Lexer` INTERFACE declares —
412
+ * the parser holds the same vocabulary only behind Langium's default class,
413
+ * where an adopter's replacement need not keep it. A token type the parser
414
+ * expects but the lexer does not declare yields no match, which declines the
415
+ * identity rather than attaching a wrong one.
416
+ */
417
+ tokenTypeNames() {
418
+ this.expectedNames ??= Object.keys(this.lexer.definition);
419
+ return this.expectedNames;
184
420
  }
185
421
  /**
186
422
  * Skip validation for a node **and its children** when
@@ -1 +1 @@
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,EAExB,iBAAiB,EAMnB,MAAM,oBAAoB,CAAC;AAE5B,kEAAkE;AAClE,0EAA0E;AAC1E,yDAAyD;AACz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,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"}
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,WAAW,EAKX,eAAe,EAEf,kBAAkB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIJ,wBAAwB,EAExB,iBAAiB,EAOnB,MAAM,oBAAoB,CAAC;AAE5B,kEAAkE;AAClE,0EAA0E;AAC1E,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,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;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC9C,qCAAqC,EACrC,0FAA0F,CAC5F,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC1C,iCAAiC,EACjC,2DAA2D,CAC7D,CAA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,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"}
@@ -19,7 +19,7 @@ export * from './carriers.js';
19
19
  export * from './renderer.js';
20
20
  export { MODEL_UPDATE_EDIT } from '../langium/model-service/model-service.js';
21
21
  export { SEPARATOR_IN_NAME } from '../langium/naming/name-separator-validation.js';
22
- export { LEXING_ERROR, UNRESOLVED_REFERENCE } from '../langium/validation/document-validator.js';
22
+ export { INVALID_DEDENT, UNEXPECTED_CHARACTER, MISSING_ITERATION, NO_VIABLE_ALTERNATIVE, TRAILING_INPUT, UNEXPECTED_TOKEN, UNPOPPABLE_LEXER_MODE, UNRESOLVED_REFERENCE } from '../langium/validation/document-validator.js';
23
23
  export { NO_LOADABLE_CONTENT } from '../langium/workspace/langium-documents.js';
24
24
  export { NO_SUCH_FILE, NO_SUCH_PATH } from '../langium/workspace/in-memory-file-system-provider.js';
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EACJ,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACtB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC"}
@@ -19,7 +19,7 @@ export * from './carriers.js';
19
19
  export * from './renderer.js';
20
20
  export { MODEL_UPDATE_EDIT } from '../langium/model-service/model-service.js';
21
21
  export { SEPARATOR_IN_NAME } from '../langium/naming/name-separator-validation.js';
22
- export { LEXING_ERROR, UNRESOLVED_REFERENCE } from '../langium/validation/document-validator.js';
22
+ export { INVALID_DEDENT, UNEXPECTED_CHARACTER, MISSING_ITERATION, NO_VIABLE_ALTERNATIVE, TRAILING_INPUT, UNEXPECTED_TOKEN, UNPOPPABLE_LEXER_MODE, UNRESOLVED_REFERENCE } from '../langium/validation/document-validator.js';
23
23
  export { NO_LOADABLE_CONTENT } from '../langium/workspace/langium-documents.js';
24
24
  export { NO_SUCH_FILE, NO_SUCH_PATH } from '../langium/workspace/in-memory-file-system-provider.js';
25
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;GAQG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EACJ,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACtB,MAAM,6CAA6C,CAAC;AACrD,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.76",
3
+ "version": "1.0.0-next.79",
4
4
  "description": "Foundational runtime of the hydranium framework: AST coordination layer (services, integrity, AST extension, serialization, multi-client documents) plus the LSP textual head at the /lsp subpath. Consumed by protocol-head packages (@hydranium/data-server, @hydranium/glsp-server).",
5
5
  "keywords": [
6
6
  "hydranium",
@@ -104,8 +104,8 @@
104
104
  "diff": "^5.2.0"
105
105
  },
106
106
  "devDependencies": {
107
- "@hydranium/langium": "1.0.0-next.76",
108
- "@hydranium/protocol": "1.0.0-next.76",
107
+ "@hydranium/langium": "1.0.0-next.79",
108
+ "@hydranium/protocol": "1.0.0-next.79",
109
109
  "@playwright/test": "^1.40.0",
110
110
  "@types/diff": "^5.2.0",
111
111
  "rimraf": "^5.0.0",
@@ -117,8 +117,8 @@
117
117
  "vscode-languageserver-types": "^3.17.5"
118
118
  },
119
119
  "peerDependencies": {
120
- "@hydranium/langium": "1.0.0-next.76",
121
- "@hydranium/protocol": "1.0.0-next.76",
120
+ "@hydranium/langium": "1.0.0-next.79",
121
+ "@hydranium/protocol": "1.0.0-next.79",
122
122
  "@playwright/test": "^1.40.0",
123
123
  "vscode-jsonrpc": "9.0.1",
124
124
  "vscode-languageserver": "~10.0.1",
@@ -29,11 +29,13 @@ import { type TransferLspDiagnostic } from '../validation/document-validator.js'
29
29
  * including AST-extension-derived computed scalars and synthetic child
30
30
  * mirrors. This is the wire shape clients consume, and the default.
31
31
  * - `'grammar'` — only the grammar-declared properties, per
32
- * `AstReflection.getTypeMetaData($type).properties`. Excludes every
33
- * computed / synthetic property by construction (no naming convention,
34
- * no registration). Yields the authored state a serializer round-trips —
35
- * a diffable, acyclic baseline for field-level recording / forward-write
36
- * reconcile.
32
+ * `AstReflection.getTypeMetaData($type).properties`, each carrying the
33
+ * node's own authored value. Excludes every computed / synthetic property
34
+ * by construction (no naming convention, no registration) and bypasses the
35
+ * `resolvePropertyValue` substitution hook, so neither a computed KEY nor a
36
+ * computed VALUE can reach this shape. Yields the authored state a
37
+ * serializer round-trips — a diffable, acyclic baseline for field-level
38
+ * recording / forward-write reconcile.
37
39
  */
38
40
  export type TransferMode = 'full' | 'grammar';
39
41
 
@@ -144,7 +146,8 @@ export interface TransferEncoder<TDiagnostic extends TransferDiagnostic = Transf
144
146
  * - {@link propertyKeys} — which property names the walk visits.
145
147
  * - {@link shouldEmitProperty} — per-key filter on top of the default
146
148
  * `$`-internals strip.
147
- * - {@link resolvePropertyValue} — value substitution per property.
149
+ * - {@link resolvePropertyValue} — value substitution per property, `'full'`
150
+ * mode only (see there for why `'grammar'` bypasses it).
148
151
  * - {@link finalizeTransferNode} — post-decoration per encoded node.
149
152
  * - {@link toTransferValue} — recursion seam per property value. Override
150
153
  * to special-case reference encoding or to drop specific value shapes.
@@ -258,7 +261,14 @@ export class DefaultTransferEncoder<
258
261
  if (!this.shouldEmitProperty(ast, key, context)) {
259
262
  continue;
260
263
  }
261
- const value = this.resolvePropertyValue(ast, key, context);
264
+ // `'grammar'` reads the authored value straight off the node rather than
265
+ // through `resolvePropertyValue`. The mode promises a shape the serializer
266
+ // round-trips, and a value-substitution hook cannot honour that: what it
267
+ // returns is by construction not what the document declared. Scoping the
268
+ // hook to `'full'` is what makes that guarantee structural instead of a
269
+ // rule every override has to remember.
270
+ const value =
271
+ context.mode === 'grammar' ? (ast as unknown as Record<string, unknown>)[key] : this.resolvePropertyValue(ast, key, context);
262
272
  // `'grammar'` lists every declared property, including those absent on
263
273
  // this node; skip the absent ones. (`'full'` enumerates only own
264
274
  // properties, so absent properties never surface there.) Part of the
@@ -299,8 +309,17 @@ export class DefaultTransferEncoder<
299
309
  }
300
310
 
301
311
  /**
302
- * Which value the walk emits under `key`. Default: the node's own value.
303
- * Override to substitute a derived value under a grammar property name.
312
+ * Which value the walk emits under `key`, in `'full'` mode ONLY. Default:
313
+ * the node's own value.
314
+ *
315
+ * Override to substitute a derived value under a grammar property name — an
316
+ * inheritance-resolved field, a preference-dependent label. `'grammar'`
317
+ * bypasses this hook and reads the node directly: that mode's contract is
318
+ * the authored state a serializer round-trips, and a substituted value is by
319
+ * construction not the one the document declared. An override that applied
320
+ * in both modes would leave the grammar shape carrying derived values under
321
+ * declared property names — diffable and acyclic still, but no longer
322
+ * authored, which is the property every consumer of that mode relies on.
304
323
  */
305
324
  protected resolvePropertyValue(ast: AstNode, key: string, _context: EncodeContext): unknown {
306
325
  return (ast as unknown as Record<string, unknown>)[key];