@telorun/ide-support 0.111.0 → 0.113.0

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.
@@ -21,6 +21,10 @@ export interface CelCompletionTarget {
21
21
  * functions, since a receiver-style call is rare next to a field access and
22
22
  * mixing them buries the fields. A root position offers the scope's names
23
23
  * first, then the global functions the environment declares.
24
+ *
25
+ * In an accessor field's value only a plain chain rooted at one of the field's
26
+ * bindings is accepted, so only those bindings and their members are offered:
27
+ * no function, no kernel global, no module call.
24
28
  */
25
29
  export declare function celCompletions(text: string, segment: CelSegment, offset: number, concretePath: string, target: CelCompletionTarget, query: CelScopeQuery | undefined): CompletionResult[];
26
30
  //# sourceMappingURL=cel-completions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cel-completions.d.ts","sourceRoot":"","sources":["../../src/completions/cel-completions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAgB,MAAM,aAAa,CAAC;AAKlE,kDAAkD;AAClD,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAqBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,aAAa,GAAG,SAAS,GAC/B,gBAAgB,EAAE,CAmEpB"}
1
+ {"version":3,"file":"cel-completions.d.ts","sourceRoot":"","sources":["../../src/completions/cel-completions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAgB,MAAM,aAAa,CAAC;AAKlE,kDAAkD;AAClD,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAqBD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,aAAa,GAAG,SAAS,GAC/B,gBAAgB,EAAE,CA+EpB"}
@@ -26,6 +26,10 @@ function toResult(symbol, replaceRange) {
26
26
  * functions, since a receiver-style call is rare next to a field access and
27
27
  * mixing them buries the fields. A root position offers the scope's names
28
28
  * first, then the global functions the environment declares.
29
+ *
30
+ * In an accessor field's value only a plain chain rooted at one of the field's
31
+ * bindings is accepted, so only those bindings and their members are offered:
32
+ * no function, no kernel global, no module call.
29
33
  */
30
34
  export function celCompletions(text, segment, offset, concretePath, target, query) {
31
35
  if (!query)
@@ -36,6 +40,17 @@ export function celCompletions(text, segment, offset, concretePath, target, quer
36
40
  const scope = query.scopeAt(resource, concretePath);
37
41
  const chain = celCursorChain(text, segment, offset);
38
42
  const prefix = chain?.prefix ?? [];
43
+ const bindings = scope.accessorBindings;
44
+ if (bindings) {
45
+ if (!chain?.member) {
46
+ return celRootSymbols(scope)
47
+ .filter((symbol) => bindings.includes(symbol.name))
48
+ .map((symbol) => toResult(symbol));
49
+ }
50
+ return bindings.includes(prefix[0])
51
+ ? celMemberSymbols(scope, prefix).map((symbol) => toResult(symbol))
52
+ : [];
53
+ }
39
54
  if (chain?.member) {
40
55
  // `<Module>.` offers the functions that module makes callable here — its own
41
56
  // through `Self` or its name, an import's exported ones through the alias.
@@ -35,5 +35,5 @@ function tagsAt(site, registry) {
35
35
  return [REF_TAG];
36
36
  }
37
37
  const field = fieldSchemaAt(schema, site.yamlPath, site.isItem, schemaFrom);
38
- return offeredValueTags(field, registry.celEvalModeAt(kind, site.concretePath));
38
+ return offeredValueTags(field, registry.celEvalModeAt(kind, site.concretePath), registry.accessorFieldAt(kind, site.concretePath));
39
39
  }
@@ -1,3 +1,4 @@
1
+ import { type CelEvalMode } from "@telorun/analyzer";
1
2
  /**
2
3
  * A YAML tag an author may write on a value, and what it means to write one.
3
4
  *
@@ -51,6 +52,11 @@ export declare function valueTag(id: string): ValueTag | undefined;
51
52
  * `prop` undefined is a field with no declared schema, which constrains
52
53
  * nothing. `evalMode` undefined means no rule decides whether the field is
53
54
  * evaluated, so the second question is not asked.
55
+ *
56
+ * An ACCESSOR field is neither: its value is named for the resource's consumer
57
+ * and never evaluated, so what may be written there is the accessor reader's to
58
+ * say — one `!cel` chain as the field's whole value, and no tag at all beneath
59
+ * it. `accessorField` says which of the two the position is.
54
60
  */
55
- export declare function offeredValueTags(prop: Record<string, unknown> | undefined, evalMode: "compile" | "runtime" | null | undefined): ValueTag[];
61
+ export declare function offeredValueTags(prop: Record<string, unknown> | undefined, evalMode: CelEvalMode | null | undefined, accessorField?: boolean): ValueTag[];
56
62
  //# sourceMappingURL=offered-value-tags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"offered-value-tags.d.ts","sourceRoot":"","sources":["../../src/value-tags/offered-value-tags.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,QAAQ;IACvB,0DAA0D;IAC1D,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb;;;;yCAIqC;IACrC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;yEACqE;IACrE,KAAK,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACtC;AA4CD;+CAC+C;AAC/C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAGzD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACzC,QAAQ,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,GACjD,QAAQ,EAAE,CAWZ"}
1
+ {"version":3,"file":"offered-value-tags.d.ts","sourceRoot":"","sources":["../../src/value-tags/offered-value-tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGnG;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,QAAQ;IACvB,0DAA0D;IAC1D,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb;;;;yCAIqC;IACrC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;yEACqE;IACrE,KAAK,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACtC;AA4CD;+CAC+C;AAC/C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAGzD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACzC,QAAQ,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACxC,aAAa,UAAQ,GACpB,QAAQ,EAAE,CAcZ"}
@@ -1,4 +1,4 @@
1
- import { checkSchemaCompatibility } from "@telorun/analyzer";
1
+ import { accessorTagEngines, checkSchemaCompatibility } from "@telorun/analyzer";
2
2
  import { builtinEngines, producedTypeOf } from "@telorun/templating";
3
3
  /**
4
4
  * The tags an author may write, by engine name.
@@ -67,8 +67,16 @@ export function valueTag(id) {
67
67
  * `prop` undefined is a field with no declared schema, which constrains
68
68
  * nothing. `evalMode` undefined means no rule decides whether the field is
69
69
  * evaluated, so the second question is not asked.
70
+ *
71
+ * An ACCESSOR field is neither: its value is named for the resource's consumer
72
+ * and never evaluated, so what may be written there is the accessor reader's to
73
+ * say — one `!cel` chain as the field's whole value, and no tag at all beneath
74
+ * it. `accessorField` says which of the two the position is.
70
75
  */
71
- export function offeredValueTags(prop, evalMode) {
76
+ export function offeredValueTags(prop, evalMode, accessorField = false) {
77
+ if (evalMode === "accessor") {
78
+ return accessorTagEngines(accessorField).flatMap((id) => valueTag(id) ?? []);
79
+ }
72
80
  const out = [];
73
81
  for (const engine of builtinEngines) {
74
82
  const tag = valueTag(engine.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/ide-support",
3
- "version": "0.111.0",
3
+ "version": "0.113.0",
4
4
  "description": "Editor-host-agnostic IDE support (completions, diagnostic normalization) for Telo manifests.",
5
5
  "keywords": [
6
6
  "telo",
@@ -37,16 +37,16 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "yaml": "^2.8.3",
40
- "@telorun/analyzer": "0.111.0",
41
- "@telorun/cel": "0.111.0",
42
- "@telorun/templating": "0.111.0"
40
+ "@telorun/cel": "0.113.0",
41
+ "@telorun/templating": "0.113.0",
42
+ "@telorun/analyzer": "0.113.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^20.0.0",
46
46
  "typescript": "^5.0.0",
47
47
  "vitest": "^2.1.8",
48
48
  "@telorun/glob": "0.3.1",
49
- "@telorun/sdk": "0.111.0"
49
+ "@telorun/sdk": "0.113.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@telorun/sdk": "*"
@@ -45,6 +45,10 @@ function toResult(symbol: CelSymbol, replaceRange?: ReplaceRange): CompletionRes
45
45
  * functions, since a receiver-style call is rare next to a field access and
46
46
  * mixing them buries the fields. A root position offers the scope's names
47
47
  * first, then the global functions the environment declares.
48
+ *
49
+ * In an accessor field's value only a plain chain rooted at one of the field's
50
+ * bindings is accepted, so only those bindings and their members are offered:
51
+ * no function, no kernel global, no module call.
48
52
  */
49
53
  export function celCompletions(
50
54
  text: string,
@@ -62,6 +66,18 @@ export function celCompletions(
62
66
  const chain = celCursorChain(text, segment, offset);
63
67
  const prefix = chain?.prefix ?? [];
64
68
 
69
+ const bindings = scope.accessorBindings;
70
+ if (bindings) {
71
+ if (!chain?.member) {
72
+ return celRootSymbols(scope)
73
+ .filter((symbol) => bindings.includes(symbol.name))
74
+ .map((symbol) => toResult(symbol));
75
+ }
76
+ return bindings.includes(prefix[0]!)
77
+ ? celMemberSymbols(scope, prefix).map((symbol) => toResult(symbol))
78
+ : [];
79
+ }
80
+
65
81
  if (chain?.member) {
66
82
  // `<Module>.` offers the functions that module makes callable here — its own
67
83
  // through `Self` or its name, an import's exported ones through the alias.
@@ -51,5 +51,9 @@ function tagsAt(site: ValueTagSite, registry: AnalysisRegistry | undefined): Val
51
51
  return [REF_TAG];
52
52
  }
53
53
  const field = fieldSchemaAt(schema as Record<string, any>, site.yamlPath, site.isItem, schemaFrom);
54
- return offeredValueTags(field, registry.celEvalModeAt(kind, site.concretePath));
54
+ return offeredValueTags(
55
+ field,
56
+ registry.celEvalModeAt(kind, site.concretePath),
57
+ registry.accessorFieldAt(kind, site.concretePath),
58
+ );
55
59
  }
@@ -1,4 +1,4 @@
1
- import { checkSchemaCompatibility } from "@telorun/analyzer";
1
+ import { accessorTagEngines, checkSchemaCompatibility, type CelEvalMode } from "@telorun/analyzer";
2
2
  import { builtinEngines, producedTypeOf } from "@telorun/templating";
3
3
 
4
4
  /**
@@ -101,11 +101,20 @@ export function valueTag(id: string): ValueTag | undefined {
101
101
  * `prop` undefined is a field with no declared schema, which constrains
102
102
  * nothing. `evalMode` undefined means no rule decides whether the field is
103
103
  * evaluated, so the second question is not asked.
104
+ *
105
+ * An ACCESSOR field is neither: its value is named for the resource's consumer
106
+ * and never evaluated, so what may be written there is the accessor reader's to
107
+ * say — one `!cel` chain as the field's whole value, and no tag at all beneath
108
+ * it. `accessorField` says which of the two the position is.
104
109
  */
105
110
  export function offeredValueTags(
106
111
  prop: Record<string, unknown> | undefined,
107
- evalMode: "compile" | "runtime" | null | undefined,
112
+ evalMode: CelEvalMode | null | undefined,
113
+ accessorField = false,
108
114
  ): ValueTag[] {
115
+ if (evalMode === "accessor") {
116
+ return accessorTagEngines(accessorField).flatMap((id) => valueTag(id) ?? []);
117
+ }
109
118
  const out: ValueTag[] = [];
110
119
  for (const engine of builtinEngines) {
111
120
  const tag = valueTag(engine.name);