@rustledger/wasm 0.4.0 → 0.5.1

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  "Rustledger Contributors"
6
6
  ],
7
7
  "description": "Beancount WebAssembly bindings for JavaScript/TypeScript",
8
- "version": "0.4.0",
8
+ "version": "0.5.1",
9
9
  "license": "GPL-3.0-only",
10
10
  "repository": {
11
11
  "type": "git",
@@ -220,6 +220,24 @@ export interface EditorDocumentSymbol {
220
220
  deprecated?: boolean;
221
221
  }
222
222
 
223
+ /** The kind of reference. */
224
+ export type ReferenceKind = 'account' | 'currency' | 'payee';
225
+
226
+ /** A reference to a symbol in the document. */
227
+ export interface EditorReference {
228
+ range: EditorRange;
229
+ kind: ReferenceKind;
230
+ is_definition: boolean;
231
+ context?: string;
232
+ }
233
+
234
+ /** Result of a find-references request. */
235
+ export interface EditorReferencesResult {
236
+ symbol: string;
237
+ kind: ReferenceKind;
238
+ references: EditorReference[];
239
+ }
240
+
223
241
  /**
224
242
  * A parsed and validated ledger that caches the parse result.
225
243
  * Use this class when you need to perform multiple operations on the same
@@ -280,6 +298,9 @@ export class ParsedLedger {
280
298
 
281
299
  /** Get all document symbols for the outline view. */
282
300
  getDocumentSymbols(): EditorDocumentSymbol[];
301
+
302
+ /** Find all references to the symbol at the given position. */
303
+ getReferences(line: number, character: number): EditorReferencesResult | null;
283
304
  }
284
305
 
285
306
 
@@ -362,6 +383,13 @@ export class ParsedLedger {
362
383
  * Get parse errors only.
363
384
  */
364
385
  getParseErrors(): any;
386
+ /**
387
+ * Find all references to the symbol at the given position.
388
+ *
389
+ * Returns all occurrences of accounts, currencies, or payees in the document.
390
+ * Uses cached data for efficient lookup.
391
+ */
392
+ getReferences(line: number, character: number): any;
365
393
  /**
366
394
  * Get validation errors only.
367
395
  */
@@ -490,6 +518,7 @@ export interface InitOutput {
490
518
  readonly parsedledger_getHoverInfo: (a: number, b: number, c: number, d: number) => void;
491
519
  readonly parsedledger_getOptions: (a: number, b: number) => void;
492
520
  readonly parsedledger_getParseErrors: (a: number, b: number) => void;
521
+ readonly parsedledger_getReferences: (a: number, b: number, c: number, d: number) => void;
493
522
  readonly parsedledger_getValidationErrors: (a: number, b: number) => void;
494
523
  readonly parsedledger_isValid: (a: number) => number;
495
524
  readonly parsedledger_new: (a: number, b: number) => number;
@@ -261,6 +261,30 @@ export class ParsedLedger {
261
261
  wasm.__wbindgen_add_to_stack_pointer(16);
262
262
  }
263
263
  }
264
+ /**
265
+ * Find all references to the symbol at the given position.
266
+ *
267
+ * Returns all occurrences of accounts, currencies, or payees in the document.
268
+ * Uses cached data for efficient lookup.
269
+ * @param {number} line
270
+ * @param {number} character
271
+ * @returns {any}
272
+ */
273
+ getReferences(line, character) {
274
+ try {
275
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
276
+ wasm.parsedledger_getReferences(retptr, this.__wbg_ptr, line, character);
277
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
278
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
279
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
280
+ if (r2) {
281
+ throw takeObject(r1);
282
+ }
283
+ return takeObject(r0);
284
+ } finally {
285
+ wasm.__wbindgen_add_to_stack_pointer(16);
286
+ }
287
+ }
264
288
  /**
265
289
  * Get validation errors only.
266
290
  * @returns {any}
Binary file