@rohal12/spindle 0.62.2 → 0.62.3
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/dist/pkg/format.js +1 -1
- package/dist/pkg/headless.js +462 -271
- package/dist/pkg/story-variables.js +590 -386
- package/dist/pkg/tooling.js +1 -0
- package/package.json +1 -1
- package/src/code-check.ts +1 -1
- package/src/completion-context.ts +226 -0
- package/src/components/Passage.tsx +28 -3
- package/src/define-macro.ts +6 -1
- package/src/macro-discovery.ts +27 -15
- package/src/markup/code-attributes.ts +10 -3
- package/src/markup/parse.ts +19 -4
- package/src/markup/spindle.d.peggy.ts +2 -0
- package/src/markup/spindle.peggy +22 -13
- package/src/passage-render-state.ts +7 -0
- package/src/saves/format.ts +4 -0
- package/src/saves/types.ts +6 -6
- package/src/static-literal.ts +24 -22
- package/src/store.ts +42 -16
- package/src/tooling.ts +4 -0
- package/src/triggers.ts +107 -0
- package/src/twine-editor/references.ts +9 -11
- package/src/widgets/ast-scanner.ts +40 -44
- package/src/widgets/widget-def.ts +74 -45
- package/types/tooling.d.ts +17 -0
package/types/tooling.d.ts
CHANGED
|
@@ -1241,3 +1241,20 @@ export declare function macroArgumentSpans(
|
|
|
1241
1241
|
rawArgs: string,
|
|
1242
1242
|
parameters: readonly ParameterDef[],
|
|
1243
1243
|
): MacroArgumentSpan[];
|
|
1244
|
+
|
|
1245
|
+
/** Executable code at a cursor, or prose/literal text that suppresses completion. */
|
|
1246
|
+
export type CompletionContext =
|
|
1247
|
+
| { kind: 'literal' }
|
|
1248
|
+
| (PieceBase & { kind: 'code'; code: string; goal: JsGoal; cursor: number });
|
|
1249
|
+
|
|
1250
|
+
/** Inspect only the prefix before cursor (UTF-16), accepting unfinished markup.
|
|
1251
|
+
* Strings, comments, regexes and template text are literal; template
|
|
1252
|
+
* interpolations are code. Code offsets map to source with pieceOffset.
|
|
1253
|
+
* Uses macro parameter metadata for nested labels, attributes and held code.
|
|
1254
|
+
* Throws RangeError for an invalid cursor; never executes story code.
|
|
1255
|
+
*/
|
|
1256
|
+
export declare function completionContext(
|
|
1257
|
+
source: string,
|
|
1258
|
+
cursor: number,
|
|
1259
|
+
macros?: Iterable<ToolingMacro>,
|
|
1260
|
+
): CompletionContext;
|