@hydranium/core 1.0.0-next.28 → 1.0.0-next.30
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/scope/hydranium-scope-provider.d.ts +22 -7
- package/lib/langium/scope/hydranium-scope-provider.d.ts.map +1 -1
- package/lib/langium/scope/hydranium-scope-provider.js +22 -9
- package/lib/langium/scope/hydranium-scope-provider.js.map +1 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts +25 -0
- package/lib/langium/workspace/hydranium-langium-document-factory.d.ts.map +1 -1
- package/lib/langium/workspace/hydranium-langium-document-factory.js +25 -0
- package/lib/langium/workspace/hydranium-langium-document-factory.js.map +1 -1
- package/lib/langium/workspace/langium-documents.d.ts +30 -4
- package/lib/langium/workspace/langium-documents.d.ts.map +1 -1
- package/lib/langium/workspace/langium-documents.js +31 -3
- package/lib/langium/workspace/langium-documents.js.map +1 -1
- package/lib/testing/playwright/server-log-capture.d.ts +14 -4
- package/lib/testing/playwright/server-log-capture.d.ts.map +1 -1
- package/lib/testing/playwright/server-log-capture.js +21 -4
- package/lib/testing/playwright/server-log-capture.js.map +1 -1
- package/lib/testing/playwright/server-log-rename-reporter.d.ts.map +1 -1
- package/lib/testing/playwright/server-log-rename-reporter.js +10 -1
- package/lib/testing/playwright/server-log-rename-reporter.js.map +1 -1
- package/package.json +5 -5
- package/src/langium/scope/hydranium-scope-provider.ts +25 -11
- package/src/langium/workspace/hydranium-langium-document-factory.ts +34 -0
- package/src/langium/workspace/langium-documents.ts +44 -4
- package/src/testing/playwright/server-log-capture.ts +24 -5
- package/src/testing/playwright/server-log-rename-reporter.ts +12 -1
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { type Tracer, type ReferenceContext, type ReferenceRequest, type ReferenceSource, type SyntheticSource } from '@hydranium/protocol';
|
|
10
|
-
import { type AstNode, type AstNodeDescription, type AstNodeLocator, DefaultScopeProvider, type
|
|
10
|
+
import { type AstNode, type AstNodeDescription, type AstNodeLocator, DefaultScopeProvider, type ReferenceInfo, type Scope, type ScopeOptions, type URI, WorkspaceCache } from '@hydranium/langium';
|
|
11
11
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
12
12
|
import { type HydraniumLanguageServices } from '../language-module.js';
|
|
13
13
|
import { type NameProvider } from '../naming/name-provider.js';
|
|
14
|
+
import { type HydraniumDocumentRegistry } from '../workspace/langium-documents.js';
|
|
14
15
|
import { type ScopeExtensionService } from './scope-extension-service.js';
|
|
15
16
|
/**
|
|
16
17
|
* Construction-time options for {@link HydraniumScopeProvider}. Extends
|
|
@@ -113,7 +114,7 @@ export interface ScopeContext {
|
|
|
113
114
|
*/
|
|
114
115
|
export declare class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
115
116
|
protected readonly services: HydraniumLanguageServices;
|
|
116
|
-
protected readonly langiumDocuments:
|
|
117
|
+
protected readonly langiumDocuments: HydraniumDocumentRegistry;
|
|
117
118
|
protected readonly astNodeLocator: AstNodeLocator;
|
|
118
119
|
protected readonly scopeExtensionService: ScopeExtensionService;
|
|
119
120
|
protected readonly options: HydraniumScopeProviderOptions;
|
|
@@ -352,11 +353,25 @@ export declare class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
|
352
353
|
/** Walk `syntheticPath` from the resolved anchor into real children. */
|
|
353
354
|
protected resolveContextLeaf(ctx: ReferenceContext): AstNode | undefined;
|
|
354
355
|
/**
|
|
355
|
-
* Build a transient AST-node stub for a {@link SyntheticSource} request
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
356
|
+
* Build a transient AST-node stub for a {@link SyntheticSource} request: a
|
|
357
|
+
* node of the requested type, contained by the document at `source.uri`.
|
|
358
|
+
*
|
|
359
|
+
* **The container is materialised when no document is loaded there**, which
|
|
360
|
+
* is the case the source type exists for — a `SyntheticSource` names a node
|
|
361
|
+
* that does not exist yet, and the create-element flow asks at the FOLDER
|
|
362
|
+
* the file is about to be written into. Abstaining there would answer an
|
|
363
|
+
* empty candidate list, which a client cannot tell from "nothing matches".
|
|
364
|
+
*
|
|
365
|
+
* The stand-in parses under THIS provider's grammar, because a folder URI
|
|
366
|
+
* carries no extension for the routing ladder to end on and this provider is
|
|
367
|
+
* bound per grammar. Reaching for `createEmptyDocument(uri)` without the id
|
|
368
|
+
* instead fails inside the parse, on an empty extension rather than on the
|
|
369
|
+
* URI.
|
|
370
|
+
*
|
|
371
|
+
* The materialised document is unregistered and transient; see
|
|
372
|
+
* `createEmptyDocument`. Overriding is still open to a consumer whose
|
|
373
|
+
* "container" is an inner element rather than the parse root, or one that
|
|
374
|
+
* deliberately declines to answer for an absent document.
|
|
360
375
|
*/
|
|
361
376
|
protected resolveSyntheticSource(source: SyntheticSource): AstNode | undefined;
|
|
362
377
|
/**
|
|
@@ -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,
|
|
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,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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;;;;;;;;;;;;;;;;;;;;OAoBG;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"}
|
|
@@ -472,17 +472,30 @@ export class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
|
472
472
|
return node ?? undefined;
|
|
473
473
|
}
|
|
474
474
|
/**
|
|
475
|
-
* Build a transient AST-node stub for a {@link SyntheticSource} request
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
*
|
|
475
|
+
* Build a transient AST-node stub for a {@link SyntheticSource} request: a
|
|
476
|
+
* node of the requested type, contained by the document at `source.uri`.
|
|
477
|
+
*
|
|
478
|
+
* **The container is materialised when no document is loaded there**, which
|
|
479
|
+
* is the case the source type exists for — a `SyntheticSource` names a node
|
|
480
|
+
* that does not exist yet, and the create-element flow asks at the FOLDER
|
|
481
|
+
* the file is about to be written into. Abstaining there would answer an
|
|
482
|
+
* empty candidate list, which a client cannot tell from "nothing matches".
|
|
483
|
+
*
|
|
484
|
+
* The stand-in parses under THIS provider's grammar, because a folder URI
|
|
485
|
+
* carries no extension for the routing ladder to end on and this provider is
|
|
486
|
+
* bound per grammar. Reaching for `createEmptyDocument(uri)` without the id
|
|
487
|
+
* instead fails inside the parse, on an empty extension rather than on the
|
|
488
|
+
* URI.
|
|
489
|
+
*
|
|
490
|
+
* The materialised document is unregistered and transient; see
|
|
491
|
+
* `createEmptyDocument`. Overriding is still open to a consumer whose
|
|
492
|
+
* "container" is an inner element rather than the parse root, or one that
|
|
493
|
+
* deliberately declines to answer for an absent document.
|
|
480
494
|
*/
|
|
481
495
|
resolveSyntheticSource(source) {
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
496
|
+
const uri = UriUtils.toUri(source.uri);
|
|
497
|
+
const document = this.langiumDocuments.getDocument(uri) ??
|
|
498
|
+
this.langiumDocuments.createEmptyDocument(uri, this.services.LanguageMetaData.languageId);
|
|
486
499
|
return { $type: source.type, $container: document.parseResult.value };
|
|
487
500
|
}
|
|
488
501
|
/**
|
|
@@ -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,
|
|
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;AAM5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CA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E,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"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { type AstNode, DefaultLangiumDocumentFactory, type LangiumDocument, type URI } from '@hydranium/langium';
|
|
10
|
+
import { type ExtendedServiceRegistry } from '../service-registry.js';
|
|
10
11
|
/**
|
|
11
12
|
* Framework `LangiumDocumentFactory` that fills in the one thing Langium
|
|
12
13
|
* leaves empty for a code-built document: its text.
|
|
@@ -34,6 +35,30 @@ import { type AstNode, DefaultLangiumDocumentFactory, type LangiumDocument, type
|
|
|
34
35
|
* node identity is preserved.
|
|
35
36
|
*/
|
|
36
37
|
export declare class HydraniumLangiumDocumentFactory extends DefaultLangiumDocumentFactory {
|
|
38
|
+
/**
|
|
39
|
+
* Narrows the inherited Langium `ServiceRegistry` field to the framework's
|
|
40
|
+
* {@link ExtendedServiceRegistry}, so the by-id lookup below needs no
|
|
41
|
+
* per-callsite cast. The framework's shared module binds that class.
|
|
42
|
+
*/
|
|
43
|
+
protected readonly serviceRegistry: ExtendedServiceRegistry;
|
|
44
|
+
/**
|
|
45
|
+
* Parse `text` for `uri` under the grammar `languageId` names, instead of
|
|
46
|
+
* the one `uri` routes to.
|
|
47
|
+
*
|
|
48
|
+
* For a URI that routes to no grammar at all: a directory, or any other URI
|
|
49
|
+
* that names no file and so carries no extension. Langium's ladder ends at
|
|
50
|
+
* the extension, so it reports `no services for the extension ''` from
|
|
51
|
+
* inside the parse — naming neither the URI nor the caller that could have
|
|
52
|
+
* said which grammar it meant.
|
|
53
|
+
*
|
|
54
|
+
* The caller supplies the language because nothing else can. A URI with no
|
|
55
|
+
* extension carries no routing signal, and choosing on its behalf would be a
|
|
56
|
+
* guess the moment a second grammar is registered — which is why this takes
|
|
57
|
+
* the id rather than falling back to a sole registered language.
|
|
58
|
+
*
|
|
59
|
+
* @throws when `languageId` names no registered grammar.
|
|
60
|
+
*/
|
|
61
|
+
fromStringInLanguage<T extends AstNode = AstNode>(text: string, uri: URI, languageId: string): LangiumDocument<T>;
|
|
37
62
|
fromModel<T extends AstNode = AstNode>(model: T, uri: URI): LangiumDocument<T>;
|
|
38
63
|
/**
|
|
39
64
|
* Serialize `model` via the per-language serializer, or `undefined` if none
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-langium-document-factory.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-langium-document-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,OAAO,EAEZ,6BAA6B,EAC7B,KAAK,eAAe,EAEpB,KAAK,GAAG,EACV,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"hydranium-langium-document-factory.d.ts","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-langium-document-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,OAAO,EAEZ,6BAA6B,EAC7B,KAAK,eAAe,EAEpB,KAAK,GAAG,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAQtE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,+BAAgC,SAAQ,6BAA6B;IAC/E;;;;OAIG;IACH,mBAA2B,eAAe,EAAE,uBAAuB,CAAC;IAEpE;;;;;;;;;;;;;;;;OAgBG;IACH,oBAAoB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC;IASxG,SAAS,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC;IAYvF;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS;CASxE"}
|
|
@@ -34,6 +34,31 @@ import { AstUtils, DefaultLangiumDocumentFactory } from '@hydranium/langium';
|
|
|
34
34
|
* node identity is preserved.
|
|
35
35
|
*/
|
|
36
36
|
export class HydraniumLangiumDocumentFactory extends DefaultLangiumDocumentFactory {
|
|
37
|
+
/**
|
|
38
|
+
* Parse `text` for `uri` under the grammar `languageId` names, instead of
|
|
39
|
+
* the one `uri` routes to.
|
|
40
|
+
*
|
|
41
|
+
* For a URI that routes to no grammar at all: a directory, or any other URI
|
|
42
|
+
* that names no file and so carries no extension. Langium's ladder ends at
|
|
43
|
+
* the extension, so it reports `no services for the extension ''` from
|
|
44
|
+
* inside the parse — naming neither the URI nor the caller that could have
|
|
45
|
+
* said which grammar it meant.
|
|
46
|
+
*
|
|
47
|
+
* The caller supplies the language because nothing else can. A URI with no
|
|
48
|
+
* extension carries no routing signal, and choosing on its behalf would be a
|
|
49
|
+
* guess the moment a second grammar is registered — which is why this takes
|
|
50
|
+
* the id rather than falling back to a sole registered language.
|
|
51
|
+
*
|
|
52
|
+
* @throws when `languageId` names no registered grammar.
|
|
53
|
+
*/
|
|
54
|
+
fromStringInLanguage(text, uri, languageId) {
|
|
55
|
+
const services = this.serviceRegistry.getServicesById(languageId);
|
|
56
|
+
if (!services) {
|
|
57
|
+
throw new Error(`No grammar is registered for the language id '${languageId}' (parsing ${uri.toString()}).`);
|
|
58
|
+
}
|
|
59
|
+
const parseResult = services.parser.LangiumParser.parse(text);
|
|
60
|
+
return this.createLangiumDocument(parseResult, uri, undefined, text);
|
|
61
|
+
}
|
|
37
62
|
fromModel(model, uri) {
|
|
38
63
|
// Make the code-built AST as structurally complete as a parsed one — the
|
|
39
64
|
// parser links containers, `fromModel` does not. In place (identity kept).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-langium-document-factory.js","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-langium-document-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAEJ,QAAQ,EACR,6BAA6B,EAI/B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"hydranium-langium-document-factory.js","sourceRoot":"","sources":["../../../src/langium/workspace/hydranium-langium-document-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAEJ,QAAQ,EACR,6BAA6B,EAI/B,MAAM,oBAAoB,CAAC;AAS5B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,+BAAgC,SAAQ,6BAA6B;IAQ/E;;;;;;;;;;;;;;;;OAgBG;IACH,oBAAoB,CAA8B,IAAY,EAAE,GAAQ,EAAE,UAAkB;QACzF,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAClE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,iDAAiD,UAAU,cAAc,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAChH,CAAC;QACD,MAAM,WAAW,GAAmB,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAI,IAAI,CAAC,CAAC;QACjF,OAAO,IAAI,CAAC,qBAAqB,CAAI,WAAW,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IAEQ,SAAS,CAA8B,KAAQ,EAAE,GAAQ;QAC/D,yEAAyE;QACzE,2EAA2E;QAC3E,QAAQ,CAAC,sBAAsB,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC7C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,WAAW,GAAmB,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC,qBAAqB,CAAI,WAAW,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IAED;;;;OAIG;IACO,cAAc,CAAC,KAAc,EAAE,GAAQ;QAC9C,IAAI,CAAC;YACF,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,CAAmB,CAAC;YACzE,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YACxE,OAAO,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;QAClE,CAAC;QAAC,MAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACpB,CAAC;IACJ,CAAC;CACH"}
|
|
@@ -9,6 +9,7 @@
|
|
|
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
|
+
import { type HydraniumLangiumDocumentFactory } from './hydranium-langium-document-factory.js';
|
|
12
13
|
/**
|
|
13
14
|
* The document a caller asked to load is not there.
|
|
14
15
|
*
|
|
@@ -18,6 +19,15 @@ import { type DocumentUriPolicy } from './document-uri-policy.js';
|
|
|
18
19
|
* provider instead, so the same condition has one declaration per host.
|
|
19
20
|
*/
|
|
20
21
|
export declare const NO_LOADABLE_CONTENT: import("@hydranium/protocol").MessageDefinition<"No loadable content for {uri}">;
|
|
22
|
+
/**
|
|
23
|
+
* A stand-in was asked for at a URI that routes to no grammar, and no language
|
|
24
|
+
* id was given to route it instead.
|
|
25
|
+
*
|
|
26
|
+
* User-facing, and raised BEFORE the parse: left to Langium's ladder the same
|
|
27
|
+
* condition surfaces as `no services for the extension ''`, which names neither
|
|
28
|
+
* the URI nor the argument that would have answered.
|
|
29
|
+
*/
|
|
30
|
+
export declare const NO_LANGUAGE_FOR_STAND_IN: import("@hydranium/protocol").MessageDefinition<"No grammar routes {uri}; pass a languageId to say which one the stand-in should parse with">;
|
|
21
31
|
/**
|
|
22
32
|
* The registry surface the framework adds on top of Langium's
|
|
23
33
|
* {@link LangiumDocuments}. Declared separately from the implementing class so
|
|
@@ -26,7 +36,7 @@ export declare const NO_LOADABLE_CONTENT: import("@hydranium/protocol").MessageD
|
|
|
26
36
|
* depend on itself.
|
|
27
37
|
*/
|
|
28
38
|
export interface HydraniumDocumentRegistry extends LangiumDocuments {
|
|
29
|
-
createEmptyDocument(uri: URI): LangiumDocument<AstNode>;
|
|
39
|
+
createEmptyDocument(uri: URI, languageId?: string): LangiumDocument<AstNode>;
|
|
30
40
|
}
|
|
31
41
|
/**
|
|
32
42
|
* Default `LangiumDocuments` for `@hydranium/core` consumers, extending
|
|
@@ -53,11 +63,18 @@ export declare class HydraniumLangiumDocuments extends DefaultLangiumDocuments i
|
|
|
53
63
|
protected readonly services: ServerSharedServicesMinimal;
|
|
54
64
|
/** Document-identity seam, shared with the text store, event filters, and builder. */
|
|
55
65
|
protected readonly uriPolicy: DocumentUriPolicy;
|
|
66
|
+
/**
|
|
67
|
+
* Narrows the inherited Langium factory field to the framework's, so the
|
|
68
|
+
* language-explicit `fromStringInLanguage` below needs no cast. The
|
|
69
|
+
* framework's shared module binds that class.
|
|
70
|
+
*/
|
|
71
|
+
protected readonly langiumDocumentFactory: HydraniumLangiumDocumentFactory;
|
|
56
72
|
constructor(services: ServerSharedServicesMinimal);
|
|
57
73
|
/**
|
|
58
74
|
* Build a transient document for `uri` by parsing empty text with the
|
|
59
|
-
* grammar `
|
|
60
|
-
* every containment
|
|
75
|
+
* grammar `languageId` names, or the one `uri` routes to when it is
|
|
76
|
+
* omitted, so the root is that language's entry type with every containment
|
|
77
|
+
* list initialised.
|
|
61
78
|
*
|
|
62
79
|
* For callers that need a document at a URI with no content on disk — the
|
|
63
80
|
* scope provider querying before a file exists is the case it was added for.
|
|
@@ -66,6 +83,15 @@ export declare class HydraniumLangiumDocuments extends DefaultLangiumDocuments i
|
|
|
66
83
|
* that silently is not the file, whereas calling this is a caller saying it
|
|
67
84
|
* wants a stand-in.
|
|
68
85
|
*
|
|
86
|
+
* **Pass `languageId` whenever the URI names no file.** The create-element
|
|
87
|
+
* flow this exists for asks at the DIRECTORY a file is about to be written
|
|
88
|
+
* into, and a directory URI has no extension for the routing ladder to end
|
|
89
|
+
* on — so omitting the id there fails inside the parse, on an empty
|
|
90
|
+
* extension rather than on the URI. A caller in that position always knows
|
|
91
|
+
* its language: {@link HydraniumScopeProvider} is bound per grammar, and a
|
|
92
|
+
* request that names no document at all still carries the AST type
|
|
93
|
+
* `ExtendedServiceRegistry.soleServicesByType` routes on.
|
|
94
|
+
*
|
|
69
95
|
* The result is not registered, so nothing downstream can see it, and
|
|
70
96
|
* `LangiumDocumentFactory.update` would read from disk. It is a probe, not a
|
|
71
97
|
* document under construction; content that must survive belongs in a
|
|
@@ -77,7 +103,7 @@ export declare class HydraniumLangiumDocuments extends DefaultLangiumDocuments i
|
|
|
77
103
|
* and it is kept: `AstReflection.isComplete` is `false` for such a root
|
|
78
104
|
* however it is built, so the error states the same thing.
|
|
79
105
|
*/
|
|
80
|
-
createEmptyDocument(uri: URI): LangiumDocument<AstNode>;
|
|
106
|
+
createEmptyDocument(uri: URI, languageId?: string): LangiumDocument<AstNode>;
|
|
81
107
|
getOrCreateDocument(uri: URI): Promise<LangiumDocument<AstNode>>;
|
|
82
108
|
}
|
|
83
109
|
//# sourceMappingURL=langium-documents.d.ts.map
|
|
@@ -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;AAElI,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,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;AAClE,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAE/F;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,kFAAuF,CAAC;AAExH;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,+IAGpC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IAChE,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;CAC/E;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,yBAA0B,SAAQ,uBAAwB,YAAW,yBAAyB;uBAWhE,QAAQ,EAAE,2BAA2B;IAV7E,sFAAsF;IACtF,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAEhD;;;;OAIG;IACH,mBAA2B,sBAAsB,EAAE,+BAA+B,CAAC;gBAE3C,QAAQ,EAAE,2BAA2B;IAK7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC;IAe7D,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;CAgCjF"}
|
|
@@ -17,6 +17,15 @@ import { defineMessage } from '@hydranium/protocol';
|
|
|
17
17
|
* provider instead, so the same condition has one declaration per host.
|
|
18
18
|
*/
|
|
19
19
|
export const NO_LOADABLE_CONTENT = defineMessage('hydranium/core/no-loadable-content', 'No loadable content for {uri}');
|
|
20
|
+
/**
|
|
21
|
+
* A stand-in was asked for at a URI that routes to no grammar, and no language
|
|
22
|
+
* id was given to route it instead.
|
|
23
|
+
*
|
|
24
|
+
* User-facing, and raised BEFORE the parse: left to Langium's ladder the same
|
|
25
|
+
* condition surfaces as `no services for the extension ''`, which names neither
|
|
26
|
+
* the URI nor the argument that would have answered.
|
|
27
|
+
*/
|
|
28
|
+
export const NO_LANGUAGE_FOR_STAND_IN = defineMessage('hydranium/core/no-language-for-stand-in', 'No grammar routes {uri}; pass a languageId to say which one the stand-in should parse with');
|
|
20
29
|
/**
|
|
21
30
|
* Default `LangiumDocuments` for `@hydranium/core` consumers, extending
|
|
22
31
|
* Langium's {@link DefaultLangiumDocuments} with:
|
|
@@ -49,8 +58,9 @@ export class HydraniumLangiumDocuments extends DefaultLangiumDocuments {
|
|
|
49
58
|
}
|
|
50
59
|
/**
|
|
51
60
|
* Build a transient document for `uri` by parsing empty text with the
|
|
52
|
-
* grammar `
|
|
53
|
-
* every containment
|
|
61
|
+
* grammar `languageId` names, or the one `uri` routes to when it is
|
|
62
|
+
* omitted, so the root is that language's entry type with every containment
|
|
63
|
+
* list initialised.
|
|
54
64
|
*
|
|
55
65
|
* For callers that need a document at a URI with no content on disk — the
|
|
56
66
|
* scope provider querying before a file exists is the case it was added for.
|
|
@@ -59,6 +69,15 @@ export class HydraniumLangiumDocuments extends DefaultLangiumDocuments {
|
|
|
59
69
|
* that silently is not the file, whereas calling this is a caller saying it
|
|
60
70
|
* wants a stand-in.
|
|
61
71
|
*
|
|
72
|
+
* **Pass `languageId` whenever the URI names no file.** The create-element
|
|
73
|
+
* flow this exists for asks at the DIRECTORY a file is about to be written
|
|
74
|
+
* into, and a directory URI has no extension for the routing ladder to end
|
|
75
|
+
* on — so omitting the id there fails inside the parse, on an empty
|
|
76
|
+
* extension rather than on the URI. A caller in that position always knows
|
|
77
|
+
* its language: {@link HydraniumScopeProvider} is bound per grammar, and a
|
|
78
|
+
* request that names no document at all still carries the AST type
|
|
79
|
+
* `ExtendedServiceRegistry.soleServicesByType` routes on.
|
|
80
|
+
*
|
|
62
81
|
* The result is not registered, so nothing downstream can see it, and
|
|
63
82
|
* `LangiumDocumentFactory.update` would read from disk. It is a probe, not a
|
|
64
83
|
* document under construction; content that must survive belongs in a
|
|
@@ -70,7 +89,16 @@ export class HydraniumLangiumDocuments extends DefaultLangiumDocuments {
|
|
|
70
89
|
* and it is kept: `AstReflection.isComplete` is `false` for such a root
|
|
71
90
|
* however it is built, so the error states the same thing.
|
|
72
91
|
*/
|
|
73
|
-
createEmptyDocument(uri) {
|
|
92
|
+
createEmptyDocument(uri, languageId) {
|
|
93
|
+
if (languageId !== undefined) {
|
|
94
|
+
return this.langiumDocumentFactory.fromStringInLanguage('', uri, languageId);
|
|
95
|
+
}
|
|
96
|
+
if (!this.services.ServiceRegistry.getServicesFor(uri)) {
|
|
97
|
+
// Reported here rather than left to the parse, which ends on the empty
|
|
98
|
+
// extension and so names neither the URI nor the id that would have
|
|
99
|
+
// answered.
|
|
100
|
+
throw new Error(NO_LANGUAGE_FOR_STAND_IN.format({ uri: uri.toString() }));
|
|
101
|
+
}
|
|
74
102
|
// The two-argument overload is synchronous; passing a cancellation token
|
|
75
103
|
// selects the promise-returning one, which this contract cannot await.
|
|
76
104
|
return this.langiumDocumentFactory.fromString('', uri);
|
|
@@ -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;AAClI,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,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;AAKpD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,oCAAoC,EAAE,+BAA+B,CAAC,CAAC;AAExH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAa,CAClD,yCAAyC,EACzC,4FAA4F,CAC9F,CAAC;AAaF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAW3B;IAVxC,sFAAsF;IACnE,SAAS,CAAoB;IAShD,YAAwC,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Q,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"}
|
|
@@ -110,11 +110,21 @@ export declare function serverLogSpecName(file: string): string;
|
|
|
110
110
|
* Rename each `<token>.log` (backend) and `<token>.browser.log` (forwarded
|
|
111
111
|
* browser console) to the spec name recorded in its `<token>.spec` sidecar
|
|
112
112
|
* (written by {@link markServerLog}), then delete the sidecar. Colliding names —
|
|
113
|
-
* a spec that opened more than one workspace — get a `-2`, `-3`, … suffix.
|
|
114
|
-
*
|
|
115
|
-
*
|
|
113
|
+
* a spec that opened more than one workspace — get a `-2`, `-3`, … suffix. Run
|
|
114
|
+
* once, after all server processes have exited (e.g. a reporter's `onEnd`).
|
|
115
|
+
* Best-effort.
|
|
116
|
+
*
|
|
117
|
+
* Returns the workspace tokens left UNATTRIBUTED — a log the capture wrote that
|
|
118
|
+
* no test claimed, because that spec never reached
|
|
119
|
+
* {@link markServerLog} (no `serverLog` fixture, no `beforeEach` call).
|
|
120
|
+
*
|
|
121
|
+
* **Returned rather than ignored, because the unattributed state is the
|
|
122
|
+
* misleading one.** Such a log still exists, still has content, and is named by
|
|
123
|
+
* an opaque token with no test boundaries in it — so a capture run that covered
|
|
124
|
+
* nothing looks exactly like one that covered everything, and the logs are
|
|
125
|
+
* there to be read. A caller that can warn should warn.
|
|
116
126
|
*/
|
|
117
|
-
export declare function renameServerLogs(dir: string):
|
|
127
|
+
export declare function renameServerLogs(dir: string): string[];
|
|
118
128
|
/**
|
|
119
129
|
* Resolve the per-workspace server-log file the {@link captureServerLog} tee
|
|
120
130
|
* writes for `workspacePath` — the `<token>.log` under the capture dir — or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-log-capture.d.ts","sourceRoot":"","sources":["../../../src/testing/playwright/server-log-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAQlF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AACrE;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,gCAAgC,CAAC;AAC3E;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,iCAAiC,CAAC;AAE7E,+GAA+G;AAC/G,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAyB,CAAC;AAElF,4DAA4D;AAC5D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAqB/D,MAAM,WAAW,uBAAuB;IACrC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qEAAqE;AACrE,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC;AAE9E,MAAM,WAAW,sBAAsB;IACpC,sFAAsF;IACtF,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,iHAAiH;IACjH,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CACpC;AAED,MAAM,WAAW,8BAA8B;IAC5C,mFAAmF;IACnF,GAAG,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,sBAAsB,CAY9F;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,oGAAoG;IACpG,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzF;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED
|
|
1
|
+
{"version":3,"file":"server-log-capture.d.ts","sourceRoot":"","sources":["../../../src/testing/playwright/server-log-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAQlF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AACrE;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,gCAAgC,CAAC;AAC3E;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,iCAAiC,CAAC;AAE7E,+GAA+G;AAC/G,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAyB,CAAC;AAElF,4DAA4D;AAC5D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAqB/D,MAAM,WAAW,uBAAuB;IACrC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,CAAC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,9 +102,19 @@ export function serverLogSpecName(file) {
|
|
|
102
102
|
* Rename each `<token>.log` (backend) and `<token>.browser.log` (forwarded
|
|
103
103
|
* browser console) to the spec name recorded in its `<token>.spec` sidecar
|
|
104
104
|
* (written by {@link markServerLog}), then delete the sidecar. Colliding names —
|
|
105
|
-
* a spec that opened more than one workspace — get a `-2`, `-3`, … suffix.
|
|
106
|
-
*
|
|
107
|
-
*
|
|
105
|
+
* a spec that opened more than one workspace — get a `-2`, `-3`, … suffix. Run
|
|
106
|
+
* once, after all server processes have exited (e.g. a reporter's `onEnd`).
|
|
107
|
+
* Best-effort.
|
|
108
|
+
*
|
|
109
|
+
* Returns the workspace tokens left UNATTRIBUTED — a log the capture wrote that
|
|
110
|
+
* no test claimed, because that spec never reached
|
|
111
|
+
* {@link markServerLog} (no `serverLog` fixture, no `beforeEach` call).
|
|
112
|
+
*
|
|
113
|
+
* **Returned rather than ignored, because the unattributed state is the
|
|
114
|
+
* misleading one.** Such a log still exists, still has content, and is named by
|
|
115
|
+
* an opaque token with no test boundaries in it — so a capture run that covered
|
|
116
|
+
* nothing looks exactly like one that covered everything, and the logs are
|
|
117
|
+
* there to be read. A caller that can warn should warn.
|
|
108
118
|
*/
|
|
109
119
|
export function renameServerLogs(dir) {
|
|
110
120
|
let entries;
|
|
@@ -112,7 +122,9 @@ export function renameServerLogs(dir) {
|
|
|
112
122
|
entries = readdirSync(dir);
|
|
113
123
|
}
|
|
114
124
|
catch {
|
|
115
|
-
|
|
125
|
+
// An unreadable capture dir has nothing to report — including nothing
|
|
126
|
+
// unattributed, since no log was observed at all.
|
|
127
|
+
return [];
|
|
116
128
|
}
|
|
117
129
|
// Per suffix (`.log`, `.browser.log`) a `taken` set guards collisions, so the
|
|
118
130
|
// backend and browser logs for one spec share the same friendly base name.
|
|
@@ -134,6 +146,9 @@ export function renameServerLogs(dir) {
|
|
|
134
146
|
// ignore
|
|
135
147
|
}
|
|
136
148
|
};
|
|
149
|
+
// Every token the capture produced a backend log for, so the ones no sidecar
|
|
150
|
+
// claims can be reported rather than silently left behind.
|
|
151
|
+
const unattributed = new Set(entries.filter(entry => entry.endsWith('.log') && !entry.endsWith('.browser.log')).map(entry => entry.slice(0, -'.log'.length)));
|
|
137
152
|
for (const entry of entries) {
|
|
138
153
|
if (!entry.endsWith('.spec')) {
|
|
139
154
|
continue;
|
|
@@ -156,9 +171,11 @@ export function renameServerLogs(dir) {
|
|
|
156
171
|
if (!name) {
|
|
157
172
|
continue;
|
|
158
173
|
}
|
|
174
|
+
unattributed.delete(token);
|
|
159
175
|
rename(token, name, '.log');
|
|
160
176
|
rename(token, name, '.browser.log');
|
|
161
177
|
}
|
|
178
|
+
return [...unattributed];
|
|
162
179
|
}
|
|
163
180
|
/**
|
|
164
181
|
* Resolve the per-workspace server-log file the {@link captureServerLog} tee
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-log-capture.js","sourceRoot":"","sources":["../../../src/testing/playwright/server-log-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AACrE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,6BAA6B,CAAC;AAC3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,8BAA8B,CAAC;AAE7E,+GAA+G;AAC/G,MAAM,CAAC,MAAM,0B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AY,EAAE,CAAC;QACjB,OAAO;IACV,CAAC;IACD,8EAA8E;IAC9E,wEAAwE;IACxE,MAAM,WAAW,GAAqC;QACnD,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE;QAClC,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,uBAAuB,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE;KAC3G,CAAC;IACF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,SAAS;QACZ,CAAC;QACD,IAAI,CAAC;YACF,MAAM,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAC;QAChG,CAAC;QAAC,MAAM,CAAC;YACN,yCAAyC;QAC5C,CAAC;IACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-log-rename-reporter.d.ts","sourceRoot":"","sources":["../../../src/testing/playwright/server-log-rename-reporter.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAoB,KAAK,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAEhG;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAuB;IACzC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,8BAA8B;IAInD,KAAK,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"server-log-rename-reporter.d.ts","sourceRoot":"","sources":["../../../src/testing/playwright/server-log-rename-reporter.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAoB,KAAK,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAEhG;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAuB;IACzC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,8BAA8B;IAInD,KAAK,IAAI,IAAI;CAcf"}
|
|
@@ -20,7 +20,16 @@ export default class ServerLogRenameReporter {
|
|
|
20
20
|
this.dir = options.dir;
|
|
21
21
|
}
|
|
22
22
|
onEnd() {
|
|
23
|
-
renameServerLogs(this.dir);
|
|
23
|
+
const unattributed = renameServerLogs(this.dir);
|
|
24
|
+
if (unattributed.length > 0) {
|
|
25
|
+
// Loud, because the alternative is a capture run that reads as
|
|
26
|
+
// complete: these logs exist and have content, but are named by an
|
|
27
|
+
// opaque workspace token and carry no test boundaries, so nothing
|
|
28
|
+
// about them says which spec they belong to.
|
|
29
|
+
console.warn(`[server-log] ${unattributed.length} captured log(s) belong to no test: ${unattributed.join(', ')}.\n` +
|
|
30
|
+
'[server-log] Those specs never marked a boundary — apply the `serverLog` fixture, ' +
|
|
31
|
+
'or call `markServerLog`/`attachServerLog` from the suite, or their logs cannot be read per test.');
|
|
32
|
+
}
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
35
|
//# sourceMappingURL=server-log-rename-reporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-log-rename-reporter.js","sourceRoot":"","sources":["../../../src/testing/playwright/server-log-rename-reporter.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,gBAAgB,EAAuC,MAAM,yBAAyB,CAAC;AAEhG;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAuB;IACtB,GAAG,CAAS;IAE/B,YAAY,OAAuC;QAChD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAC1B,CAAC;IAED,KAAK;QACF,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"server-log-rename-reporter.js","sourceRoot":"","sources":["../../../src/testing/playwright/server-log-rename-reporter.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,gBAAgB,EAAuC,MAAM,yBAAyB,CAAC;AAEhG;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAuB;IACtB,GAAG,CAAS;IAE/B,YAAY,OAAuC;QAChD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAC1B,CAAC;IAED,KAAK;QACF,MAAM,YAAY,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,+DAA+D;YAC/D,mEAAmE;YACnE,kEAAkE;YAClE,6CAA6C;YAC7C,OAAO,CAAC,IAAI,CACT,gBAAgB,YAAY,CAAC,MAAM,uCAAuC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;gBACnG,oFAAoF;gBACpF,kGAAkG,CACvG,CAAC;QACL,CAAC;IACJ,CAAC;CACH"}
|
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.30",
|
|
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.
|
|
108
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
107
|
+
"@hydranium/langium": "1.0.0-next.30",
|
|
108
|
+
"@hydranium/protocol": "1.0.0-next.30",
|
|
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.
|
|
121
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
120
|
+
"@hydranium/langium": "1.0.0-next.30",
|
|
121
|
+
"@hydranium/protocol": "1.0.0-next.30",
|
|
122
122
|
"@playwright/test": "^1.40.0",
|
|
123
123
|
"vscode-jsonrpc": "9.0.1",
|
|
124
124
|
"vscode-languageserver": "~10.0.1",
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
type AstNodeLocator,
|
|
25
25
|
AstUtils,
|
|
26
26
|
DefaultScopeProvider,
|
|
27
|
-
type LangiumDocuments,
|
|
28
27
|
MapScope,
|
|
29
28
|
type ReferenceInfo,
|
|
30
29
|
type Scope,
|
|
@@ -38,6 +37,7 @@ import {
|
|
|
38
37
|
import { type LogNameOptions } from '../diagnostics/logger.js';
|
|
39
38
|
import { type HydraniumLanguageServices } from '../language-module.js';
|
|
40
39
|
import { type NameProvider } from '../naming/name-provider.js';
|
|
40
|
+
import { type HydraniumDocumentRegistry } from '../workspace/langium-documents.js';
|
|
41
41
|
import { type ScopeExtensionService } from './scope-extension-service.js';
|
|
42
42
|
import { isTieredDescription } from './scoped-ast-node-description.js';
|
|
43
43
|
|
|
@@ -143,7 +143,7 @@ export interface ScopeContext {
|
|
|
143
143
|
* `reference-candidate-provider.ts` module.
|
|
144
144
|
*/
|
|
145
145
|
export class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
146
|
-
protected readonly langiumDocuments:
|
|
146
|
+
protected readonly langiumDocuments: HydraniumDocumentRegistry;
|
|
147
147
|
protected readonly astNodeLocator: AstNodeLocator;
|
|
148
148
|
protected readonly scopeExtensionService: ScopeExtensionService;
|
|
149
149
|
protected readonly options: HydraniumScopeProviderOptions;
|
|
@@ -586,17 +586,31 @@ export class HydraniumScopeProvider extends DefaultScopeProvider {
|
|
|
586
586
|
}
|
|
587
587
|
|
|
588
588
|
/**
|
|
589
|
-
* Build a transient AST-node stub for a {@link SyntheticSource} request
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
593
|
-
*
|
|
589
|
+
* Build a transient AST-node stub for a {@link SyntheticSource} request: a
|
|
590
|
+
* node of the requested type, contained by the document at `source.uri`.
|
|
591
|
+
*
|
|
592
|
+
* **The container is materialised when no document is loaded there**, which
|
|
593
|
+
* is the case the source type exists for — a `SyntheticSource` names a node
|
|
594
|
+
* that does not exist yet, and the create-element flow asks at the FOLDER
|
|
595
|
+
* the file is about to be written into. Abstaining there would answer an
|
|
596
|
+
* empty candidate list, which a client cannot tell from "nothing matches".
|
|
597
|
+
*
|
|
598
|
+
* The stand-in parses under THIS provider's grammar, because a folder URI
|
|
599
|
+
* carries no extension for the routing ladder to end on and this provider is
|
|
600
|
+
* bound per grammar. Reaching for `createEmptyDocument(uri)` without the id
|
|
601
|
+
* instead fails inside the parse, on an empty extension rather than on the
|
|
602
|
+
* URI.
|
|
603
|
+
*
|
|
604
|
+
* The materialised document is unregistered and transient; see
|
|
605
|
+
* `createEmptyDocument`. Overriding is still open to a consumer whose
|
|
606
|
+
* "container" is an inner element rather than the parse root, or one that
|
|
607
|
+
* deliberately declines to answer for an absent document.
|
|
594
608
|
*/
|
|
595
609
|
protected resolveSyntheticSource(source: SyntheticSource): AstNode | undefined {
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
610
|
+
const uri = UriUtils.toUri(source.uri);
|
|
611
|
+
const document =
|
|
612
|
+
this.langiumDocuments.getDocument(uri) ??
|
|
613
|
+
this.langiumDocuments.createEmptyDocument(uri, this.services.LanguageMetaData.languageId);
|
|
600
614
|
return { $type: source.type, $container: document.parseResult.value };
|
|
601
615
|
}
|
|
602
616
|
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
type ParseResult,
|
|
16
16
|
type URI
|
|
17
17
|
} from '@hydranium/langium';
|
|
18
|
+
import { type ExtendedServiceRegistry } from '../service-registry.js';
|
|
18
19
|
import { type Serializer } from '../serialization/serializer.js';
|
|
19
20
|
|
|
20
21
|
/** Structural view of the per-language serializer slot on the resolved services. */
|
|
@@ -49,6 +50,39 @@ interface WithSerializer {
|
|
|
49
50
|
* node identity is preserved.
|
|
50
51
|
*/
|
|
51
52
|
export class HydraniumLangiumDocumentFactory extends DefaultLangiumDocumentFactory {
|
|
53
|
+
/**
|
|
54
|
+
* Narrows the inherited Langium `ServiceRegistry` field to the framework's
|
|
55
|
+
* {@link ExtendedServiceRegistry}, so the by-id lookup below needs no
|
|
56
|
+
* per-callsite cast. The framework's shared module binds that class.
|
|
57
|
+
*/
|
|
58
|
+
declare protected readonly serviceRegistry: ExtendedServiceRegistry;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Parse `text` for `uri` under the grammar `languageId` names, instead of
|
|
62
|
+
* the one `uri` routes to.
|
|
63
|
+
*
|
|
64
|
+
* For a URI that routes to no grammar at all: a directory, or any other URI
|
|
65
|
+
* that names no file and so carries no extension. Langium's ladder ends at
|
|
66
|
+
* the extension, so it reports `no services for the extension ''` from
|
|
67
|
+
* inside the parse — naming neither the URI nor the caller that could have
|
|
68
|
+
* said which grammar it meant.
|
|
69
|
+
*
|
|
70
|
+
* The caller supplies the language because nothing else can. A URI with no
|
|
71
|
+
* extension carries no routing signal, and choosing on its behalf would be a
|
|
72
|
+
* guess the moment a second grammar is registered — which is why this takes
|
|
73
|
+
* the id rather than falling back to a sole registered language.
|
|
74
|
+
*
|
|
75
|
+
* @throws when `languageId` names no registered grammar.
|
|
76
|
+
*/
|
|
77
|
+
fromStringInLanguage<T extends AstNode = AstNode>(text: string, uri: URI, languageId: string): LangiumDocument<T> {
|
|
78
|
+
const services = this.serviceRegistry.getServicesById(languageId);
|
|
79
|
+
if (!services) {
|
|
80
|
+
throw new Error(`No grammar is registered for the language id '${languageId}' (parsing ${uri.toString()}).`);
|
|
81
|
+
}
|
|
82
|
+
const parseResult: ParseResult<T> = services.parser.LangiumParser.parse<T>(text);
|
|
83
|
+
return this.createLangiumDocument<T>(parseResult, uri, undefined, text);
|
|
84
|
+
}
|
|
85
|
+
|
|
52
86
|
override fromModel<T extends AstNode = AstNode>(model: T, uri: URI): LangiumDocument<T> {
|
|
53
87
|
// Make the code-built AST as structurally complete as a parsed one — the
|
|
54
88
|
// parser links containers, `fromModel` does not. In place (identity kept).
|
|
@@ -11,6 +11,7 @@ import { type AstNode, DefaultLangiumDocuments, type LangiumDocument, type Langi
|
|
|
11
11
|
import { defineMessage } from '@hydranium/protocol';
|
|
12
12
|
import { type ServerSharedServicesMinimal } from '../shared-services.js';
|
|
13
13
|
import { type DocumentUriPolicy } from './document-uri-policy.js';
|
|
14
|
+
import { type HydraniumLangiumDocumentFactory } from './hydranium-langium-document-factory.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* The document a caller asked to load is not there.
|
|
@@ -22,6 +23,19 @@ import { type DocumentUriPolicy } from './document-uri-policy.js';
|
|
|
22
23
|
*/
|
|
23
24
|
export const NO_LOADABLE_CONTENT = defineMessage('hydranium/core/no-loadable-content', 'No loadable content for {uri}');
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* A stand-in was asked for at a URI that routes to no grammar, and no language
|
|
28
|
+
* id was given to route it instead.
|
|
29
|
+
*
|
|
30
|
+
* User-facing, and raised BEFORE the parse: left to Langium's ladder the same
|
|
31
|
+
* condition surfaces as `no services for the extension ''`, which names neither
|
|
32
|
+
* the URI nor the argument that would have answered.
|
|
33
|
+
*/
|
|
34
|
+
export const NO_LANGUAGE_FOR_STAND_IN = defineMessage(
|
|
35
|
+
'hydranium/core/no-language-for-stand-in',
|
|
36
|
+
'No grammar routes {uri}; pass a languageId to say which one the stand-in should parse with'
|
|
37
|
+
);
|
|
38
|
+
|
|
25
39
|
/**
|
|
26
40
|
* The registry surface the framework adds on top of Langium's
|
|
27
41
|
* {@link LangiumDocuments}. Declared separately from the implementing class so
|
|
@@ -30,7 +44,7 @@ export const NO_LOADABLE_CONTENT = defineMessage('hydranium/core/no-loadable-con
|
|
|
30
44
|
* depend on itself.
|
|
31
45
|
*/
|
|
32
46
|
export interface HydraniumDocumentRegistry extends LangiumDocuments {
|
|
33
|
-
createEmptyDocument(uri: URI): LangiumDocument<AstNode>;
|
|
47
|
+
createEmptyDocument(uri: URI, languageId?: string): LangiumDocument<AstNode>;
|
|
34
48
|
}
|
|
35
49
|
|
|
36
50
|
/**
|
|
@@ -58,6 +72,13 @@ export class HydraniumLangiumDocuments extends DefaultLangiumDocuments implement
|
|
|
58
72
|
/** Document-identity seam, shared with the text store, event filters, and builder. */
|
|
59
73
|
protected readonly uriPolicy: DocumentUriPolicy;
|
|
60
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Narrows the inherited Langium factory field to the framework's, so the
|
|
77
|
+
* language-explicit `fromStringInLanguage` below needs no cast. The
|
|
78
|
+
* framework's shared module binds that class.
|
|
79
|
+
*/
|
|
80
|
+
declare protected readonly langiumDocumentFactory: HydraniumLangiumDocumentFactory;
|
|
81
|
+
|
|
61
82
|
constructor(protected override readonly services: ServerSharedServicesMinimal) {
|
|
62
83
|
super(services);
|
|
63
84
|
this.uriPolicy = services.workspace.DocumentUriPolicy;
|
|
@@ -65,8 +86,9 @@ export class HydraniumLangiumDocuments extends DefaultLangiumDocuments implement
|
|
|
65
86
|
|
|
66
87
|
/**
|
|
67
88
|
* Build a transient document for `uri` by parsing empty text with the
|
|
68
|
-
* grammar `
|
|
69
|
-
* every containment
|
|
89
|
+
* grammar `languageId` names, or the one `uri` routes to when it is
|
|
90
|
+
* omitted, so the root is that language's entry type with every containment
|
|
91
|
+
* list initialised.
|
|
70
92
|
*
|
|
71
93
|
* For callers that need a document at a URI with no content on disk — the
|
|
72
94
|
* scope provider querying before a file exists is the case it was added for.
|
|
@@ -75,6 +97,15 @@ export class HydraniumLangiumDocuments extends DefaultLangiumDocuments implement
|
|
|
75
97
|
* that silently is not the file, whereas calling this is a caller saying it
|
|
76
98
|
* wants a stand-in.
|
|
77
99
|
*
|
|
100
|
+
* **Pass `languageId` whenever the URI names no file.** The create-element
|
|
101
|
+
* flow this exists for asks at the DIRECTORY a file is about to be written
|
|
102
|
+
* into, and a directory URI has no extension for the routing ladder to end
|
|
103
|
+
* on — so omitting the id there fails inside the parse, on an empty
|
|
104
|
+
* extension rather than on the URI. A caller in that position always knows
|
|
105
|
+
* its language: {@link HydraniumScopeProvider} is bound per grammar, and a
|
|
106
|
+
* request that names no document at all still carries the AST type
|
|
107
|
+
* `ExtendedServiceRegistry.soleServicesByType` routes on.
|
|
108
|
+
*
|
|
78
109
|
* The result is not registered, so nothing downstream can see it, and
|
|
79
110
|
* `LangiumDocumentFactory.update` would read from disk. It is a probe, not a
|
|
80
111
|
* document under construction; content that must survive belongs in a
|
|
@@ -86,7 +117,16 @@ export class HydraniumLangiumDocuments extends DefaultLangiumDocuments implement
|
|
|
86
117
|
* and it is kept: `AstReflection.isComplete` is `false` for such a root
|
|
87
118
|
* however it is built, so the error states the same thing.
|
|
88
119
|
*/
|
|
89
|
-
createEmptyDocument(uri: URI): LangiumDocument<AstNode> {
|
|
120
|
+
createEmptyDocument(uri: URI, languageId?: string): LangiumDocument<AstNode> {
|
|
121
|
+
if (languageId !== undefined) {
|
|
122
|
+
return this.langiumDocumentFactory.fromStringInLanguage('', uri, languageId);
|
|
123
|
+
}
|
|
124
|
+
if (!this.services.ServiceRegistry.getServicesFor(uri)) {
|
|
125
|
+
// Reported here rather than left to the parse, which ends on the empty
|
|
126
|
+
// extension and so names neither the URI nor the id that would have
|
|
127
|
+
// answered.
|
|
128
|
+
throw new Error(NO_LANGUAGE_FOR_STAND_IN.format({ uri: uri.toString() }));
|
|
129
|
+
}
|
|
90
130
|
// The two-argument overload is synchronous; passing a cancellation token
|
|
91
131
|
// selects the promise-returning one, which this contract cannot await.
|
|
92
132
|
return this.langiumDocumentFactory.fromString('', uri);
|
|
@@ -160,16 +160,28 @@ export function serverLogSpecName(file: string): string {
|
|
|
160
160
|
* Rename each `<token>.log` (backend) and `<token>.browser.log` (forwarded
|
|
161
161
|
* browser console) to the spec name recorded in its `<token>.spec` sidecar
|
|
162
162
|
* (written by {@link markServerLog}), then delete the sidecar. Colliding names —
|
|
163
|
-
* a spec that opened more than one workspace — get a `-2`, `-3`, … suffix.
|
|
164
|
-
*
|
|
165
|
-
*
|
|
163
|
+
* a spec that opened more than one workspace — get a `-2`, `-3`, … suffix. Run
|
|
164
|
+
* once, after all server processes have exited (e.g. a reporter's `onEnd`).
|
|
165
|
+
* Best-effort.
|
|
166
|
+
*
|
|
167
|
+
* Returns the workspace tokens left UNATTRIBUTED — a log the capture wrote that
|
|
168
|
+
* no test claimed, because that spec never reached
|
|
169
|
+
* {@link markServerLog} (no `serverLog` fixture, no `beforeEach` call).
|
|
170
|
+
*
|
|
171
|
+
* **Returned rather than ignored, because the unattributed state is the
|
|
172
|
+
* misleading one.** Such a log still exists, still has content, and is named by
|
|
173
|
+
* an opaque token with no test boundaries in it — so a capture run that covered
|
|
174
|
+
* nothing looks exactly like one that covered everything, and the logs are
|
|
175
|
+
* there to be read. A caller that can warn should warn.
|
|
166
176
|
*/
|
|
167
|
-
export function renameServerLogs(dir: string):
|
|
177
|
+
export function renameServerLogs(dir: string): string[] {
|
|
168
178
|
let entries: string[];
|
|
169
179
|
try {
|
|
170
180
|
entries = readdirSync(dir);
|
|
171
181
|
} catch {
|
|
172
|
-
|
|
182
|
+
// An unreadable capture dir has nothing to report — including nothing
|
|
183
|
+
// unattributed, since no log was observed at all.
|
|
184
|
+
return [];
|
|
173
185
|
}
|
|
174
186
|
// Per suffix (`.log`, `.browser.log`) a `taken` set guards collisions, so the
|
|
175
187
|
// backend and browser logs for one spec share the same friendly base name.
|
|
@@ -190,6 +202,11 @@ export function renameServerLogs(dir: string): void {
|
|
|
190
202
|
// ignore
|
|
191
203
|
}
|
|
192
204
|
};
|
|
205
|
+
// Every token the capture produced a backend log for, so the ones no sidecar
|
|
206
|
+
// claims can be reported rather than silently left behind.
|
|
207
|
+
const unattributed = new Set(
|
|
208
|
+
entries.filter(entry => entry.endsWith('.log') && !entry.endsWith('.browser.log')).map(entry => entry.slice(0, -'.log'.length))
|
|
209
|
+
);
|
|
193
210
|
for (const entry of entries) {
|
|
194
211
|
if (!entry.endsWith('.spec')) {
|
|
195
212
|
continue;
|
|
@@ -210,9 +227,11 @@ export function renameServerLogs(dir: string): void {
|
|
|
210
227
|
if (!name) {
|
|
211
228
|
continue;
|
|
212
229
|
}
|
|
230
|
+
unattributed.delete(token);
|
|
213
231
|
rename(token, name, '.log');
|
|
214
232
|
rename(token, name, '.browser.log');
|
|
215
233
|
}
|
|
234
|
+
return [...unattributed];
|
|
216
235
|
}
|
|
217
236
|
|
|
218
237
|
/**
|
|
@@ -24,6 +24,17 @@ export default class ServerLogRenameReporter {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
onEnd(): void {
|
|
27
|
-
renameServerLogs(this.dir);
|
|
27
|
+
const unattributed = renameServerLogs(this.dir);
|
|
28
|
+
if (unattributed.length > 0) {
|
|
29
|
+
// Loud, because the alternative is a capture run that reads as
|
|
30
|
+
// complete: these logs exist and have content, but are named by an
|
|
31
|
+
// opaque workspace token and carry no test boundaries, so nothing
|
|
32
|
+
// about them says which spec they belong to.
|
|
33
|
+
console.warn(
|
|
34
|
+
`[server-log] ${unattributed.length} captured log(s) belong to no test: ${unattributed.join(', ')}.\n` +
|
|
35
|
+
'[server-log] Those specs never marked a boundary — apply the `serverLog` fixture, ' +
|
|
36
|
+
'or call `markServerLog`/`attachServerLog` from the suite, or their logs cannot be read per test.'
|
|
37
|
+
);
|
|
38
|
+
}
|
|
28
39
|
}
|
|
29
40
|
}
|