@beehexa/hexasync-template-index 2608.15.1 → 2608.20.18
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/package.json +4 -4
- package/dist/checkpoints.d.ts +0 -47
- package/dist/checkpoints.d.ts.map +0 -1
- package/dist/checkpoints.js +0 -59
- package/dist/checkpoints.js.map +0 -1
- package/dist/cursorContext.d.ts +0 -204
- package/dist/cursorContext.d.ts.map +0 -1
- package/dist/cursorContext.js +0 -479
- package/dist/cursorContext.js.map +0 -1
- package/dist/detectors.d.ts +0 -103
- package/dist/detectors.d.ts.map +0 -1
- package/dist/detectors.js +0 -104
- package/dist/detectors.js.map +0 -1
- package/dist/discovery.d.ts +0 -249
- package/dist/discovery.d.ts.map +0 -1
- package/dist/discovery.js +0 -455
- package/dist/discovery.js.map +0 -1
- package/dist/effectiveGraph.d.ts +0 -240
- package/dist/effectiveGraph.d.ts.map +0 -1
- package/dist/effectiveGraph.js +0 -523
- package/dist/effectiveGraph.js.map +0 -1
- package/dist/failures.d.ts +0 -50
- package/dist/failures.d.ts.map +0 -1
- package/dist/failures.js +0 -125
- package/dist/failures.js.map +0 -1
- package/dist/graph.d.ts +0 -47
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js +0 -230
- package/dist/graph.js.map +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -38
- package/dist/index.js.map +0 -1
- package/dist/queries.d.ts +0 -102
- package/dist/queries.d.ts.map +0 -1
- package/dist/queries.js +0 -469
- package/dist/queries.js.map +0 -1
- package/dist/ranges.d.ts +0 -71
- package/dist/ranges.d.ts.map +0 -1
- package/dist/ranges.js +0 -322
- package/dist/ranges.js.map +0 -1
- package/dist/resolveField.d.ts +0 -125
- package/dist/resolveField.d.ts.map +0 -1
- package/dist/resolveField.js +0 -234
- package/dist/resolveField.js.map +0 -1
- package/dist/tier1Service.d.ts +0 -96
- package/dist/tier1Service.d.ts.map +0 -1
- package/dist/tier1Service.js +0 -194
- package/dist/tier1Service.js.map +0 -1
- package/dist/tier2Service.d.ts +0 -195
- package/dist/tier2Service.d.ts.map +0 -1
- package/dist/tier2Service.js +0 -642
- package/dist/tier2Service.js.map +0 -1
- package/dist/yamlScalar.d.ts +0 -17
- package/dist/yamlScalar.d.ts.map +0 -1
- package/dist/yamlScalar.js +0 -101
- package/dist/yamlScalar.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beehexa/hexasync-template-index",
|
|
3
|
-
"version": "2608.
|
|
3
|
+
"version": "2608.20.18",
|
|
4
4
|
"description": "The semantic index over composed projects.",
|
|
5
5
|
"license": "SEE LICENSE IN ../../LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"build": "tsc -p tsconfig.build.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@beehexa/hexasync-template-compose": "2608.
|
|
24
|
-
"@beehexa/hexasync-template-model": "2608.
|
|
25
|
-
"@beehexa/hexasync-template-ports": "2608.
|
|
23
|
+
"@beehexa/hexasync-template-compose": "2608.20.18",
|
|
24
|
+
"@beehexa/hexasync-template-model": "2608.20.18",
|
|
25
|
+
"@beehexa/hexasync-template-ports": "2608.20.18",
|
|
26
26
|
"yaml": "^2.8.0"
|
|
27
27
|
},
|
|
28
28
|
"hexasync": {
|
package/dist/checkpoints.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which worklist positions are worth retaining as prefix checkpoints (Story 3.5).
|
|
3
|
-
*
|
|
4
|
-
* Merge is a strictly later-wins fold, so a change at position *k* forces everything from *k*
|
|
5
|
-
* onward to be re-merged and nothing before it. A checkpoint at *k-1* therefore turns the whole
|
|
6
|
-
* re-merge into "replay the suffix" — and the closer the nearest checkpoint sits to *k*, the less
|
|
7
|
-
* of the prefix has to be replayed on top of it.
|
|
8
|
-
*
|
|
9
|
-
* The AC's literal reading — a checkpoint at every position — is not affordable. A checkpoint is
|
|
10
|
-
* a deep copy of the merged document, measured at ~9 ms and roughly a megabyte on the corpus
|
|
11
|
-
* median; one per position would add ~870 ms to a 570 ms build and hold ~100 MB per project. So
|
|
12
|
-
* positions are chosen, and the choice is the interesting part:
|
|
13
|
-
*
|
|
14
|
-
* - **The generation boundary is always kept.** Ancestor files merge first and gen-0 files last,
|
|
15
|
-
* so the state just before the first gen-0 file is the base every edit to the developer's OWN
|
|
16
|
-
* files starts from. On a real inheriting project (189 files, 4 of them gen-0) that single
|
|
17
|
-
* checkpoint takes the common edit from 189 files to 3.
|
|
18
|
-
* - **The rest are spaced evenly.** A project with no ancestors — which most of the corpus is —
|
|
19
|
-
* has its whole worklist at generation 0, so the edit can land anywhere and there is no
|
|
20
|
-
* boundary to exploit. Even spacing bounds the extra prefix replayed to one stride.
|
|
21
|
-
*
|
|
22
|
-
* An edit near the FRONT of a large standalone project still costs close to a full recompose.
|
|
23
|
-
* That is inherent to later-wins merge, not to this policy: everything after the change genuinely
|
|
24
|
-
* has to be re-merged.
|
|
25
|
-
*/
|
|
26
|
-
import type { WorklistItem } from '@beehexa/hexasync-template-compose';
|
|
27
|
-
/** How many checkpoints a project retains by default. */
|
|
28
|
-
export declare const DEFAULT_MAX_CHECKPOINTS = 8;
|
|
29
|
-
/**
|
|
30
|
-
* The last index merged before generation 0 begins, or -1 when the project has no ancestors.
|
|
31
|
-
*
|
|
32
|
-
* Read off the worklist rather than assumed: the composer orders by generation descending, and
|
|
33
|
-
* this is the only place that ordering is depended on, so it is depended on out loud.
|
|
34
|
-
*/
|
|
35
|
-
export declare function generationBoundary(worklist: readonly WorklistItem[]): number;
|
|
36
|
-
/**
|
|
37
|
-
* Positions to checkpoint, ascending.
|
|
38
|
-
*
|
|
39
|
-
* The final position is never included: a checkpoint there would be the finished document, which
|
|
40
|
-
* is already the graph.
|
|
41
|
-
*/
|
|
42
|
-
export declare function checkpointPositions(worklist: readonly WorklistItem[], max?: number): number[];
|
|
43
|
-
/** The retained checkpoint at or before `index`, or undefined when none covers it. */
|
|
44
|
-
export declare function nearestCheckpoint<T extends {
|
|
45
|
-
index: number;
|
|
46
|
-
}>(checkpoints: readonly T[], index: number): T | undefined;
|
|
47
|
-
//# sourceMappingURL=checkpoints.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoints.d.ts","sourceRoot":"","sources":["../src/checkpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,yDAAyD;AACzD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,GAAG,GAAE,MAAgC,GACpC,MAAM,EAAE,CAwBV;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAC3D,WAAW,EAAE,SAAS,CAAC,EAAE,EACzB,KAAK,EAAE,MAAM,GACZ,CAAC,GAAG,SAAS,CAOf"}
|
package/dist/checkpoints.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/** How many checkpoints a project retains by default. */
|
|
2
|
-
export const DEFAULT_MAX_CHECKPOINTS = 8;
|
|
3
|
-
/**
|
|
4
|
-
* The last index merged before generation 0 begins, or -1 when the project has no ancestors.
|
|
5
|
-
*
|
|
6
|
-
* Read off the worklist rather than assumed: the composer orders by generation descending, and
|
|
7
|
-
* this is the only place that ordering is depended on, so it is depended on out loud.
|
|
8
|
-
*/
|
|
9
|
-
export function generationBoundary(worklist) {
|
|
10
|
-
for (let i = 0; i < worklist.length; i++) {
|
|
11
|
-
if ((worklist[i].generation ?? 0) === 0)
|
|
12
|
-
return i - 1;
|
|
13
|
-
}
|
|
14
|
-
return worklist.length - 1; // every file is an ancestor's — no gen-0 region at all
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Positions to checkpoint, ascending.
|
|
18
|
-
*
|
|
19
|
-
* The final position is never included: a checkpoint there would be the finished document, which
|
|
20
|
-
* is already the graph.
|
|
21
|
-
*/
|
|
22
|
-
export function checkpointPositions(worklist, max = DEFAULT_MAX_CHECKPOINTS) {
|
|
23
|
-
const n = worklist.length;
|
|
24
|
-
if (n < 2 || max < 1)
|
|
25
|
-
return [];
|
|
26
|
-
const positions = new Set();
|
|
27
|
-
const boundary = generationBoundary(worklist);
|
|
28
|
-
if (boundary >= 0 && boundary < n - 1)
|
|
29
|
-
positions.add(boundary);
|
|
30
|
-
const budget = Math.max(0, max - positions.size);
|
|
31
|
-
if (budget > 0) {
|
|
32
|
-
const stride = Math.max(1, Math.ceil(n / (budget + 1)));
|
|
33
|
-
for (let i = stride - 1; i < n - 1; i += stride)
|
|
34
|
-
positions.add(i);
|
|
35
|
-
}
|
|
36
|
-
const ordered = [...positions].sort((a, b) => a - b);
|
|
37
|
-
// Over budget after merging the boundary in: drop the EARLIEST spaced positions. An edit near
|
|
38
|
-
// the end is both the common case and the one a nearby checkpoint helps most, and the boundary
|
|
39
|
-
// is kept regardless because it is the one position chosen for a reason rather than by spacing.
|
|
40
|
-
while (ordered.length > max) {
|
|
41
|
-
const victim = ordered.findIndex((p) => p !== boundary);
|
|
42
|
-
if (victim === -1)
|
|
43
|
-
break;
|
|
44
|
-
ordered.splice(victim, 1);
|
|
45
|
-
}
|
|
46
|
-
return ordered;
|
|
47
|
-
}
|
|
48
|
-
/** The retained checkpoint at or before `index`, or undefined when none covers it. */
|
|
49
|
-
export function nearestCheckpoint(checkpoints, index) {
|
|
50
|
-
let found;
|
|
51
|
-
for (const cp of checkpoints) {
|
|
52
|
-
if (cp.index <= index)
|
|
53
|
-
found = cp;
|
|
54
|
-
else
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
return found;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=checkpoints.js.map
|
package/dist/checkpoints.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoints.js","sourceRoot":"","sources":["../src/checkpoints.ts"],"names":[],"mappings":"AA2BA,yDAAyD;AACzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAiC;IAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,uDAAuD;AACrF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAiC,EACjC,MAAc,uBAAuB;IAErC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC1B,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAEhC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,QAAQ,IAAI,CAAC,IAAI,QAAQ,GAAG,CAAC,GAAG,CAAC;QAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE/D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG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
|
2
|
-
* What the cursor is pointing at, semantically (Story 3.7, FR-48 and FR-49).
|
|
3
|
-
*
|
|
4
|
-
* Every context-aware feature in later phases — completion, hover, definition, code actions —
|
|
5
|
-
* needs the same answer, and the answer has to be about MEANING rather than about the property's
|
|
6
|
-
* name. `displayType` under a step and `displayType` under an option input are the same eleven
|
|
7
|
-
* characters and two unrelated things; a feature keyed to the name gets one of them wrong.
|
|
8
|
-
*
|
|
9
|
-
* Two rules shape everything here:
|
|
10
|
-
*
|
|
11
|
-
* - **It reads, and only reads.** Resolution runs on cursor movement, so it takes an existing
|
|
12
|
-
* snapshot and never composes. A function that could trigger a build would make moving the
|
|
13
|
-
* caret the most expensive thing in the editor (NFR-8's anti-pattern, stated as code).
|
|
14
|
-
* - **The measured registry decides, plus the document.** Reference kinds come from
|
|
15
|
-
* `references.ts`, which knows the fixed targets, the two properties whose target is chosen by
|
|
16
|
-
* a SIBLING (`entityId` follows `entityType`, `targetId` follows `targetType`), the value shapes
|
|
17
|
-
* that make a value a reference at all, and the one collection whose KEY is a reference.
|
|
18
|
-
*
|
|
19
|
-
* **A schema lookup used to sit here and has been removed (2026-08-02).** `x-hexasync-reference`,
|
|
20
|
-
* `x-hexasync-step-type` and `x-hexasync-expressions` were authored into the asset bundle and then
|
|
21
|
-
* deleted, because a per-node annotation cannot express a sibling-discriminated reference or a
|
|
22
|
-
* value-shape-dependent one, and the per-definition problem it was designed for does not occur
|
|
23
|
-
* among reference properties. The `displayType` collision in the paragraph above is real, but it is
|
|
24
|
-
* a description-and-completion concern that VS Code resolves natively from the schema — not a
|
|
25
|
-
* reference concern. Retired Story 3.9; reasoning in `NOTES-epic-3.md` §5a.
|
|
26
|
-
*/
|
|
27
|
-
import { parseDocument } from 'yaml';
|
|
28
|
-
import { type TemplateOccurrence } from '@beehexa/hexasync-template-model';
|
|
29
|
-
import type { EffectiveComponent, EffectiveGraph } from './effectiveGraph.js';
|
|
30
|
-
/** A path through a YAML document: map keys and sequence indices, outermost first. */
|
|
31
|
-
export type YamlPath = readonly (string | number)[];
|
|
32
|
-
/** What the cursor sits on within the document. */
|
|
33
|
-
export type NodeKind = 'key' | 'value' | 'sequence-item' | 'empty';
|
|
34
|
-
/** A reference the cursor is sitting on. */
|
|
35
|
-
/** A position that takes a reference, independent of what is written there. */
|
|
36
|
-
export interface ReferenceSlot {
|
|
37
|
-
/** The property carrying it, as the registry names it. */
|
|
38
|
-
readonly property: string;
|
|
39
|
-
/** The collection a value here would point into. */
|
|
40
|
-
readonly targetCollection?: string;
|
|
41
|
-
}
|
|
42
|
-
export interface CursorReference {
|
|
43
|
-
/** The property carrying it — `taskId`, `connectorId`, … */
|
|
44
|
-
readonly property: string;
|
|
45
|
-
/** The id it names, in token form. */
|
|
46
|
-
readonly targetId: string;
|
|
47
|
-
/** The collection it points into, when known. */
|
|
48
|
-
readonly targetCollection?: string;
|
|
49
|
-
/** The component it names, when the graph holds one. */
|
|
50
|
-
readonly target?: EffectiveComponent;
|
|
51
|
-
/** False when it names nothing — the case a Phase 2 diagnostic reports. */
|
|
52
|
-
readonly resolves: boolean;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* What KIND of file the cursor is in, as the composer distinguishes them.
|
|
56
|
-
*
|
|
57
|
-
* Three, because three is what actually behaves differently: `main.yaml` is the merge BASE and
|
|
58
|
-
* declares the externals, `variables.yaml` feeds the substitution pool and nothing else, and a
|
|
59
|
-
* partial contributes components. `applyChanges` already routes edits by exactly this distinction —
|
|
60
|
-
* a `main.yaml` or `variables.yaml` change forces a rebuild because a prefix checkpoint cannot
|
|
61
|
-
* represent it — so the categories are the runtime's, not invented for the editor.
|
|
62
|
-
*/
|
|
63
|
-
export type CursorFileType = 'project-main' | 'variables' | 'partial';
|
|
64
|
-
export interface CursorContext {
|
|
65
|
-
readonly kind: 'context';
|
|
66
|
-
/** The file the cursor is in. */
|
|
67
|
-
readonly file: string;
|
|
68
|
-
/** Which of the three kinds of file it is (FR-48's "file type"). */
|
|
69
|
-
readonly fileType: CursorFileType;
|
|
70
|
-
/** The project it belongs to. */
|
|
71
|
-
readonly projectId: string;
|
|
72
|
-
/** Whether this file is one of the project's OWN or one it inherits. */
|
|
73
|
-
readonly generation: number;
|
|
74
|
-
/** The collection the enclosing component belongs to — `objects`, `pullers`, … */
|
|
75
|
-
readonly componentCollection?: string;
|
|
76
|
-
/** The enclosing component's id, when the cursor is inside one. */
|
|
77
|
-
readonly componentId?: string;
|
|
78
|
-
/** The enclosing component as the project effectively has it. */
|
|
79
|
-
readonly component?: EffectiveComponent;
|
|
80
|
-
readonly yamlPath: YamlPath;
|
|
81
|
-
readonly nodeKind: NodeKind;
|
|
82
|
-
/** The step variant the cursor sits under, when it is inside a step. */
|
|
83
|
-
readonly parentStepType?: string;
|
|
84
|
-
/** The value at the cursor, unresolved and in token form. */
|
|
85
|
-
readonly value?: unknown;
|
|
86
|
-
/** The exact text the cursor is inside, when it is inside a scalar. */
|
|
87
|
-
readonly selection?: string;
|
|
88
|
-
readonly reference?: CursorReference;
|
|
89
|
-
/**
|
|
90
|
-
* The kind of reference that BELONGS at the cursor, whether or not a value is there yet.
|
|
91
|
-
*
|
|
92
|
-
* `reference` answers "what does this reference point at", and needs a value to answer it. Completion
|
|
93
|
-
* asks a different question — "could a reference go here?" — which is about the POSITION. With an
|
|
94
|
-
* empty `pullerId:` the first answer is correctly undefined, and a completion provider reading it got
|
|
95
|
-
* nothing at exactly the moment it is most needed: the developer has typed the key and is waiting for
|
|
96
|
-
* the list.
|
|
97
|
-
*
|
|
98
|
-
* Two questions, two answers, one resolution path. Both go through the same registry and the same
|
|
99
|
-
* nested-block handling, so they cannot disagree about where a property points.
|
|
100
|
-
*/
|
|
101
|
-
readonly referenceSlot?: ReferenceSlot;
|
|
102
|
-
/** Compose-time and runtime occurrences in the value, told apart (Story 3.8, FR-50). */
|
|
103
|
-
readonly templating: readonly TemplateOccurrence[];
|
|
104
|
-
/**
|
|
105
|
-
* True when the document does not parse cleanly, so everything above is from a RECOVERED tree.
|
|
106
|
-
*
|
|
107
|
-
* `doc.errors` was never read. The `yaml` parser recovers from a tab indent, an unclosed quote, a
|
|
108
|
-
* duplicate key or a stray `---` and still hands back `contents`, so resolution answered
|
|
109
|
-
* confidently from a partial tree with no way for a consumer to know — and a half-typed file is
|
|
110
|
-
* the normal editing state, not an edge case. A completion that would be wrong is better withheld
|
|
111
|
-
* than offered, and only the consumer can make that call.
|
|
112
|
-
*/
|
|
113
|
-
readonly parseErrors?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* WHERE the document fails to parse, and why. Absent exactly when `parseErrors` is.
|
|
116
|
-
*
|
|
117
|
-
* A boolean could only say "something is wrong somewhere", which is all the editor could then say
|
|
118
|
-
* too. The consumer's job is to turn a LINE red and name the problem, so it needs the position —
|
|
119
|
-
* added after code review found IntelliSense going silent on a tab indent 500 lines away with the
|
|
120
|
-
* reason reaching only the Output channel.
|
|
121
|
-
*
|
|
122
|
-
* Lines and columns are 1-BASED, as the parser reports them and as an editor shows them. A consumer
|
|
123
|
-
* building a `Range` has to subtract one, which is the tradeoff for a figure that matches what the
|
|
124
|
-
* developer reads in the gutter.
|
|
125
|
-
*/
|
|
126
|
-
readonly parseErrorDetail?: readonly YamlParseError[];
|
|
127
|
-
/**
|
|
128
|
-
* True when the file holds SEVERAL YAML documents and this answer covers only the first.
|
|
129
|
-
*
|
|
130
|
-
* `parseDocument` returns document one and silently drops the rest, so a caret in the second
|
|
131
|
-
* returned `{path: [], nodeKind: 'empty'}` — indistinguishable from an empty file.
|
|
132
|
-
*/
|
|
133
|
-
readonly multipleDocuments?: boolean;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* One YAML parse failure, positioned.
|
|
137
|
-
*
|
|
138
|
-
* 1-based line and column, matching both the parser and the editor gutter.
|
|
139
|
-
*/
|
|
140
|
-
export interface YamlParseError {
|
|
141
|
-
/** The parser's own code — `TAB_AS_INDENT`, `MISSING_CHAR`, … */
|
|
142
|
-
readonly code: string;
|
|
143
|
-
/** One line, without the parser's appended source excerpt. */
|
|
144
|
-
readonly message: string;
|
|
145
|
-
readonly line: number;
|
|
146
|
-
readonly column: number;
|
|
147
|
-
readonly endLine: number;
|
|
148
|
-
readonly endColumn: number;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* What a file outside any project resolves to.
|
|
152
|
-
*
|
|
153
|
-
* A distinct answer rather than a half-filled context, per Epic 2 Story 2.3: a consumer handed
|
|
154
|
-
* a context with everything undefined cannot tell "no project" from "nothing interesting here",
|
|
155
|
-
* and the two call for opposite behaviour.
|
|
156
|
-
*/
|
|
157
|
-
export interface NoProjectContext {
|
|
158
|
-
readonly kind: 'no-project-context';
|
|
159
|
-
readonly file: string;
|
|
160
|
-
}
|
|
161
|
-
export type CursorResolution = CursorContext | NoProjectContext;
|
|
162
|
-
export interface ResolveCursorInput {
|
|
163
|
-
/** The graph to read from. Nothing here builds one. */
|
|
164
|
-
readonly graph: EffectiveGraph;
|
|
165
|
-
readonly file: string;
|
|
166
|
-
/** The file's current text — the editor's, which may be newer than the graph's. */
|
|
167
|
-
readonly text: string;
|
|
168
|
-
/** Character offset of the cursor. */
|
|
169
|
-
readonly offset: number;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Locate the cursor within a YAML document.
|
|
173
|
-
*
|
|
174
|
-
* Walks the parsed AST rather than the text: a bracket-counting scan gets `a: "b: c"` wrong, and
|
|
175
|
-
* the parser already knows the answer. Returns the innermost node whose range contains the
|
|
176
|
-
* offset, along with the path to it.
|
|
177
|
-
*/
|
|
178
|
-
export declare function pathAtOffset(text: string, offset: number, parsed?: ReturnType<typeof parseDocument>): {
|
|
179
|
-
path: YamlPath;
|
|
180
|
-
nodeKind: NodeKind;
|
|
181
|
-
value?: unknown;
|
|
182
|
-
selection?: string;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Resolve what the cursor points at.
|
|
186
|
-
*
|
|
187
|
-
* Synchronous and pure by design — see the file header. Callable on every caret move.
|
|
188
|
-
*/
|
|
189
|
-
export declare function resolveCursorContext(input: ResolveCursorInput): CursorResolution;
|
|
190
|
-
/**
|
|
191
|
-
* Each parse failure with its position, one line of message.
|
|
192
|
-
*
|
|
193
|
-
* The parser appends a source excerpt to `message` ("… at line 3, column 1:\n\n\tname: …"); only the
|
|
194
|
-
* first line belongs in a diagnostic, because the editor is already showing the source.
|
|
195
|
-
*/
|
|
196
|
-
/**
|
|
197
|
-
* The YAML syntax errors in a document, positioned.
|
|
198
|
-
*
|
|
199
|
-
* Exported so the editor can squiggle them without re-deriving the parse. Same call and same shaping as
|
|
200
|
-
* `resolveCursorContext` uses for `parseErrorDetail`, so the diagnostic and the withheld completion can
|
|
201
|
-
* never disagree about whether the file is broken (code review D-4).
|
|
202
|
-
*/
|
|
203
|
-
export declare function yamlSyntaxErrors(text: string): readonly YamlParseError[];
|
|
204
|
-
//# sourceMappingURL=cursorContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cursorContext.d.ts","sourceRoot":"","sources":["../src/cursorContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,aAAa,EAAkC,MAAM,MAAM,CAAC;AACrE,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQ9E,sFAAsF;AACtF,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAEpD,mDAAmD;AACnD,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,eAAe,GAAG,OAAO,CAAC;AAWnE,4CAA4C;AAC5C,+EAA+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD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