likec4 1.10.0 → 1.10.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/dist/__app__/src/chunks/{-index-overview-DZ3H7kDb.js → -index-overview-CR08x_EG.js} +5 -5
- package/dist/__app__/src/chunks/{likec4-BqIZe8Y0.js → likec4-BFZn233G.js} +165 -117
- package/dist/__app__/src/chunks/{main-KEhBGhZ8.js → main-D12NE066.js} +2491 -2496
- package/dist/__app__/src/chunks/{tanstack-router-Bc_WYOzY.js → tanstack-router-DKnF_3kP.js} +1 -1
- package/dist/__app__/src/main.js +1 -1
- package/dist/__app__/webcomponent/webcomponent.js +2651 -2608
- package/dist/cli/index.mjs +20 -20
- package/dist/index.d.mts +827 -707
- package/dist/index.mjs +1 -1
- package/dist/shared/likec4.DKLo7EEm.mjs +1221 -0
- package/package.json +19 -19
- package/react/index.d.ts +2 -1
- package/react/index.mjs +2633 -2588
- package/dist/shared/likec4.BaYahRry.mjs +0 -1221
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
|
|
|
3
3
|
|
|
4
4
|
@category Type
|
|
5
5
|
*/
|
|
6
|
-
type Primitive =
|
|
6
|
+
type Primitive$1 =
|
|
7
7
|
| null
|
|
8
8
|
| undefined
|
|
9
9
|
| string
|
|
@@ -50,7 +50,7 @@ const pet: Pet2 = '';
|
|
|
50
50
|
*/
|
|
51
51
|
type LiteralUnion<
|
|
52
52
|
LiteralType,
|
|
53
|
-
BaseType extends Primitive,
|
|
53
|
+
BaseType extends Primitive$1,
|
|
54
54
|
> = LiteralType | (BaseType & Record<never, never>);
|
|
55
55
|
|
|
56
56
|
declare const tag$1: unique symbol;
|
|
@@ -728,158 +728,6 @@ declare namespace ViewChange {
|
|
|
728
728
|
}
|
|
729
729
|
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
|
|
730
730
|
|
|
731
|
-
type Numeric = number | bigint;
|
|
732
|
-
|
|
733
|
-
/**
|
|
734
|
-
Returns a boolean for whether the given type is `never`.
|
|
735
|
-
|
|
736
|
-
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
737
|
-
@link https://stackoverflow.com/a/53984913/10292952
|
|
738
|
-
@link https://www.zhenghao.io/posts/ts-never
|
|
739
|
-
|
|
740
|
-
Useful in type utilities, such as checking if something does not occur.
|
|
741
|
-
|
|
742
|
-
@example
|
|
743
|
-
```
|
|
744
|
-
import type {IsNever, And} from 'type-fest';
|
|
745
|
-
|
|
746
|
-
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
747
|
-
type AreStringsEqual<A extends string, B extends string> =
|
|
748
|
-
And<
|
|
749
|
-
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
750
|
-
IsNever<Exclude<B, A>> extends true ? true : false
|
|
751
|
-
>;
|
|
752
|
-
|
|
753
|
-
type EndIfEqual<I extends string, O extends string> =
|
|
754
|
-
AreStringsEqual<I, O> extends true
|
|
755
|
-
? never
|
|
756
|
-
: void;
|
|
757
|
-
|
|
758
|
-
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
759
|
-
if (input === output) {
|
|
760
|
-
process.exit(0);
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
endIfEqual('abc', 'abc');
|
|
765
|
-
//=> never
|
|
766
|
-
|
|
767
|
-
endIfEqual('abc', '123');
|
|
768
|
-
//=> void
|
|
769
|
-
```
|
|
770
|
-
|
|
771
|
-
@category Type Guard
|
|
772
|
-
@category Utilities
|
|
773
|
-
*/
|
|
774
|
-
type IsNever$1<T> = [T] extends [never] ? true : false;
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
Returns a boolean for whether the given type `T` is the specified `LiteralType`.
|
|
778
|
-
|
|
779
|
-
@link https://stackoverflow.com/a/52806744/10292952
|
|
780
|
-
|
|
781
|
-
@example
|
|
782
|
-
```
|
|
783
|
-
LiteralCheck<1, number>
|
|
784
|
-
//=> true
|
|
785
|
-
|
|
786
|
-
LiteralCheck<number, number>
|
|
787
|
-
//=> false
|
|
788
|
-
|
|
789
|
-
LiteralCheck<1, string>
|
|
790
|
-
//=> false
|
|
791
|
-
```
|
|
792
|
-
*/
|
|
793
|
-
type LiteralCheck<T, LiteralType extends Primitive> = (
|
|
794
|
-
IsNever$1<T> extends false // Must be wider than `never`
|
|
795
|
-
? [T] extends [LiteralType & infer U] // Remove any branding
|
|
796
|
-
? [U] extends [LiteralType] // Must be narrower than `LiteralType`
|
|
797
|
-
? [LiteralType] extends [U] // Cannot be wider than `LiteralType`
|
|
798
|
-
? false
|
|
799
|
-
: true
|
|
800
|
-
: false
|
|
801
|
-
: false
|
|
802
|
-
: false
|
|
803
|
-
);
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
Returns a boolean for whether the given type `T` is one of the specified literal types in `LiteralUnionType`.
|
|
807
|
-
|
|
808
|
-
@example
|
|
809
|
-
```
|
|
810
|
-
LiteralChecks<1, Numeric>
|
|
811
|
-
//=> true
|
|
812
|
-
|
|
813
|
-
LiteralChecks<1n, Numeric>
|
|
814
|
-
//=> true
|
|
815
|
-
|
|
816
|
-
LiteralChecks<bigint, Numeric>
|
|
817
|
-
//=> false
|
|
818
|
-
```
|
|
819
|
-
*/
|
|
820
|
-
type LiteralChecks<T, LiteralUnionType> = (
|
|
821
|
-
// Conditional type to force union distribution.
|
|
822
|
-
// If `T` is none of the literal types in the union `LiteralUnionType`, then `LiteralCheck<T, LiteralType>` will evaluate to `false` for the whole union.
|
|
823
|
-
// If `T` is one of the literal types in the union, it will evaluate to `boolean` (i.e. `true | false`)
|
|
824
|
-
IsNotFalse<LiteralUnionType extends Primitive
|
|
825
|
-
? LiteralCheck<T, LiteralUnionType>
|
|
826
|
-
: never
|
|
827
|
-
>
|
|
828
|
-
);
|
|
829
|
-
|
|
830
|
-
/**
|
|
831
|
-
Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
|
|
832
|
-
|
|
833
|
-
Useful for:
|
|
834
|
-
- providing strongly-typed functions when given literal arguments
|
|
835
|
-
- type utilities, such as when constructing parsers and ASTs
|
|
836
|
-
|
|
837
|
-
@example
|
|
838
|
-
```
|
|
839
|
-
import type {IsNumericLiteral} from 'type-fest';
|
|
840
|
-
|
|
841
|
-
// https://github.com/inocan-group/inferred-types/blob/master/src/types/boolean-logic/EndsWith.ts
|
|
842
|
-
type EndsWith<TValue, TEndsWith extends string> =
|
|
843
|
-
TValue extends string
|
|
844
|
-
? IsStringLiteral<TEndsWith> extends true
|
|
845
|
-
? IsStringLiteral<TValue> extends true
|
|
846
|
-
? TValue extends `${string}${TEndsWith}`
|
|
847
|
-
? true
|
|
848
|
-
: false
|
|
849
|
-
: boolean
|
|
850
|
-
: boolean
|
|
851
|
-
: TValue extends number
|
|
852
|
-
? IsNumericLiteral<TValue> extends true
|
|
853
|
-
? EndsWith<`${TValue}`, TEndsWith>
|
|
854
|
-
: false
|
|
855
|
-
: false;
|
|
856
|
-
|
|
857
|
-
function endsWith<Input extends string | number, End extends string>(input: Input, end: End) {
|
|
858
|
-
return `${input}`.endsWith(end) as EndsWith<Input, End>;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
endsWith('abc', 'c');
|
|
862
|
-
//=> true
|
|
863
|
-
|
|
864
|
-
endsWith(123456, '456');
|
|
865
|
-
//=> true
|
|
866
|
-
|
|
867
|
-
const end = '123' as string;
|
|
868
|
-
|
|
869
|
-
endsWith('abc123', end);
|
|
870
|
-
//=> boolean
|
|
871
|
-
```
|
|
872
|
-
|
|
873
|
-
@category Type Guard
|
|
874
|
-
@category Utilities
|
|
875
|
-
*/
|
|
876
|
-
type IsNumericLiteral<T> = LiteralChecks<T, Numeric>;
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
Returns a boolean for whether the given `boolean` is not `false`.
|
|
880
|
-
*/
|
|
881
|
-
type IsNotFalse<T extends boolean> = [T] extends [false] ? false : true;
|
|
882
|
-
|
|
883
731
|
declare const ElementColors: {
|
|
884
732
|
readonly primary: {
|
|
885
733
|
fill: "#3b82f6";
|
|
@@ -1409,94 +1257,267 @@ declare function compareByFqnHierarchically<T extends {
|
|
|
1409
1257
|
}>(a: T, b: T): 0 | 1 | -1;
|
|
1410
1258
|
|
|
1411
1259
|
/**
|
|
1412
|
-
|
|
1413
|
-
* array under the hood, this includes arrays *AND* tuples (of the form [x, y],
|
|
1414
|
-
* and of the form [x, ...y[]], etc...), and their readonly equivalent. This
|
|
1415
|
-
* allows us to be more inclusive to what functions can process.
|
|
1416
|
-
*
|
|
1417
|
-
* @example map<T extends ArrayLike>(items: T) { ... }
|
|
1418
|
-
*
|
|
1419
|
-
* We would've named this `ArrayLike`, but that's already used by typescript...
|
|
1420
|
-
* @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21)
|
|
1421
|
-
*/
|
|
1422
|
-
type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
|
|
1260
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
1423
1261
|
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
Item,
|
|
1435
|
-
...ArraySetRequired<T, Min, [unknown, ...Iteration]>
|
|
1436
|
-
] : never;
|
|
1437
|
-
/**
|
|
1438
|
-
* Checks if the given array has at least the defined number of elements. When
|
|
1439
|
-
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so
|
|
1440
|
-
* that those indices are defined when accessing the array even when using
|
|
1441
|
-
* typescript's 'noUncheckedIndexAccess'.
|
|
1442
|
-
*
|
|
1443
|
-
* @param data - The input array.
|
|
1444
|
-
* @param minimum - The minimum number of elements the array must have.
|
|
1445
|
-
* @returns True if the array's length is *at least* `minimum`. When `minimum`
|
|
1446
|
-
* is a literal value, the output is narrowed to ensure the first items are
|
|
1447
|
-
* guaranteed.
|
|
1448
|
-
* @signature
|
|
1449
|
-
* R.hasAtLeast(data, minimum)
|
|
1450
|
-
* @example
|
|
1451
|
-
* R.hasAtLeast([], 4); // => false
|
|
1452
|
-
*
|
|
1453
|
-
* const data: number[] = [1,2,3,4];
|
|
1454
|
-
* R.hasAtLeast(data, 1); // => true
|
|
1455
|
-
* data[0]; // 1, with type `number`
|
|
1456
|
-
* @dataFirst
|
|
1457
|
-
* @category Array
|
|
1458
|
-
*/
|
|
1459
|
-
declare function hasAtLeast<T extends IterableContainer, N extends number>(data: IterableContainer | T, minimum: IsNumericLiteral<N> extends true ? N : never): data is ArraySetRequired<T, N>;
|
|
1460
|
-
declare function hasAtLeast(data: IterableContainer, minimum: number): boolean;
|
|
1461
|
-
/**
|
|
1462
|
-
* Checks if the given array has at least the defined number of elements. When
|
|
1463
|
-
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so
|
|
1464
|
-
* that those indices are defined when accessing the array even when using
|
|
1465
|
-
* typescript's 'noUncheckedIndexAccess'.
|
|
1466
|
-
*
|
|
1467
|
-
* @param minimum - The minimum number of elements the array must have.
|
|
1468
|
-
* @returns True if the array's length is *at least* `minimum`. When `minimum`
|
|
1469
|
-
* is a literal value, the output is narrowed to ensure the first items are
|
|
1470
|
-
* guaranteed.
|
|
1471
|
-
* @signature
|
|
1472
|
-
* R.hasAtLeast(minimum)(data)
|
|
1473
|
-
* @example
|
|
1474
|
-
* R.pipe([], R.hasAtLeast(4)); // => false
|
|
1475
|
-
*
|
|
1476
|
-
* const data = [[1,2], [3], [4,5]];
|
|
1477
|
-
* R.pipe(
|
|
1478
|
-
* data,
|
|
1479
|
-
* R.filter(R.hasAtLeast(2)),
|
|
1480
|
-
* R.map(([, second]) => second),
|
|
1481
|
-
* ); // => [2,5], with type `number[]`
|
|
1482
|
-
* @dataLast
|
|
1483
|
-
* @category Array
|
|
1484
|
-
*/
|
|
1485
|
-
declare function hasAtLeast<N extends number>(minimum: IsNumericLiteral<N> extends true ? N : never): <T extends IterableContainer>(data: IterableContainer | T) => data is ArraySetRequired<T, N>;
|
|
1486
|
-
declare function hasAtLeast(minimum: number): (data: IterableContainer) => boolean;
|
|
1262
|
+
@category Type
|
|
1263
|
+
*/
|
|
1264
|
+
type Primitive =
|
|
1265
|
+
| null
|
|
1266
|
+
| undefined
|
|
1267
|
+
| string
|
|
1268
|
+
| number
|
|
1269
|
+
| boolean
|
|
1270
|
+
| symbol
|
|
1271
|
+
| bigint;
|
|
1487
1272
|
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1273
|
+
declare global {
|
|
1274
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
1275
|
+
interface SymbolConstructor {
|
|
1276
|
+
readonly observable: symbol;
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
type Numeric = number | bigint;
|
|
1496
1281
|
|
|
1497
1282
|
/**
|
|
1498
|
-
|
|
1499
|
-
|
|
1283
|
+
Returns a boolean for whether the given type is `never`.
|
|
1284
|
+
|
|
1285
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
1286
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
1287
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
1288
|
+
|
|
1289
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
1290
|
+
|
|
1291
|
+
@example
|
|
1292
|
+
```
|
|
1293
|
+
import type {IsNever, And} from 'type-fest';
|
|
1294
|
+
|
|
1295
|
+
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
1296
|
+
type AreStringsEqual<A extends string, B extends string> =
|
|
1297
|
+
And<
|
|
1298
|
+
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
1299
|
+
IsNever<Exclude<B, A>> extends true ? true : false
|
|
1300
|
+
>;
|
|
1301
|
+
|
|
1302
|
+
type EndIfEqual<I extends string, O extends string> =
|
|
1303
|
+
AreStringsEqual<I, O> extends true
|
|
1304
|
+
? never
|
|
1305
|
+
: void;
|
|
1306
|
+
|
|
1307
|
+
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
1308
|
+
if (input === output) {
|
|
1309
|
+
process.exit(0);
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
endIfEqual('abc', 'abc');
|
|
1314
|
+
//=> never
|
|
1315
|
+
|
|
1316
|
+
endIfEqual('abc', '123');
|
|
1317
|
+
//=> void
|
|
1318
|
+
```
|
|
1319
|
+
|
|
1320
|
+
@category Type Guard
|
|
1321
|
+
@category Utilities
|
|
1322
|
+
*/
|
|
1323
|
+
type IsNever$1<T> = [T] extends [never] ? true : false;
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
Returns a boolean for whether the given type `T` is the specified `LiteralType`.
|
|
1327
|
+
|
|
1328
|
+
@link https://stackoverflow.com/a/52806744/10292952
|
|
1329
|
+
|
|
1330
|
+
@example
|
|
1331
|
+
```
|
|
1332
|
+
LiteralCheck<1, number>
|
|
1333
|
+
//=> true
|
|
1334
|
+
|
|
1335
|
+
LiteralCheck<number, number>
|
|
1336
|
+
//=> false
|
|
1337
|
+
|
|
1338
|
+
LiteralCheck<1, string>
|
|
1339
|
+
//=> false
|
|
1340
|
+
```
|
|
1341
|
+
*/
|
|
1342
|
+
type LiteralCheck<T, LiteralType extends Primitive> = (
|
|
1343
|
+
IsNever$1<T> extends false // Must be wider than `never`
|
|
1344
|
+
? [T] extends [LiteralType & infer U] // Remove any branding
|
|
1345
|
+
? [U] extends [LiteralType] // Must be narrower than `LiteralType`
|
|
1346
|
+
? [LiteralType] extends [U] // Cannot be wider than `LiteralType`
|
|
1347
|
+
? false
|
|
1348
|
+
: true
|
|
1349
|
+
: false
|
|
1350
|
+
: false
|
|
1351
|
+
: false
|
|
1352
|
+
);
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
Returns a boolean for whether the given type `T` is one of the specified literal types in `LiteralUnionType`.
|
|
1356
|
+
|
|
1357
|
+
@example
|
|
1358
|
+
```
|
|
1359
|
+
LiteralChecks<1, Numeric>
|
|
1360
|
+
//=> true
|
|
1361
|
+
|
|
1362
|
+
LiteralChecks<1n, Numeric>
|
|
1363
|
+
//=> true
|
|
1364
|
+
|
|
1365
|
+
LiteralChecks<bigint, Numeric>
|
|
1366
|
+
//=> false
|
|
1367
|
+
```
|
|
1368
|
+
*/
|
|
1369
|
+
type LiteralChecks<T, LiteralUnionType> = (
|
|
1370
|
+
// Conditional type to force union distribution.
|
|
1371
|
+
// If `T` is none of the literal types in the union `LiteralUnionType`, then `LiteralCheck<T, LiteralType>` will evaluate to `false` for the whole union.
|
|
1372
|
+
// If `T` is one of the literal types in the union, it will evaluate to `boolean` (i.e. `true | false`)
|
|
1373
|
+
IsNotFalse<LiteralUnionType extends Primitive
|
|
1374
|
+
? LiteralCheck<T, LiteralUnionType>
|
|
1375
|
+
: never
|
|
1376
|
+
>
|
|
1377
|
+
);
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
|
|
1381
|
+
|
|
1382
|
+
Useful for:
|
|
1383
|
+
- providing strongly-typed functions when given literal arguments
|
|
1384
|
+
- type utilities, such as when constructing parsers and ASTs
|
|
1385
|
+
|
|
1386
|
+
@example
|
|
1387
|
+
```
|
|
1388
|
+
import type {IsNumericLiteral} from 'type-fest';
|
|
1389
|
+
|
|
1390
|
+
// https://github.com/inocan-group/inferred-types/blob/master/src/types/boolean-logic/EndsWith.ts
|
|
1391
|
+
type EndsWith<TValue, TEndsWith extends string> =
|
|
1392
|
+
TValue extends string
|
|
1393
|
+
? IsStringLiteral<TEndsWith> extends true
|
|
1394
|
+
? IsStringLiteral<TValue> extends true
|
|
1395
|
+
? TValue extends `${string}${TEndsWith}`
|
|
1396
|
+
? true
|
|
1397
|
+
: false
|
|
1398
|
+
: boolean
|
|
1399
|
+
: boolean
|
|
1400
|
+
: TValue extends number
|
|
1401
|
+
? IsNumericLiteral<TValue> extends true
|
|
1402
|
+
? EndsWith<`${TValue}`, TEndsWith>
|
|
1403
|
+
: false
|
|
1404
|
+
: false;
|
|
1405
|
+
|
|
1406
|
+
function endsWith<Input extends string | number, End extends string>(input: Input, end: End) {
|
|
1407
|
+
return `${input}`.endsWith(end) as EndsWith<Input, End>;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
endsWith('abc', 'c');
|
|
1411
|
+
//=> true
|
|
1412
|
+
|
|
1413
|
+
endsWith(123456, '456');
|
|
1414
|
+
//=> true
|
|
1415
|
+
|
|
1416
|
+
const end = '123' as string;
|
|
1417
|
+
|
|
1418
|
+
endsWith('abc123', end);
|
|
1419
|
+
//=> boolean
|
|
1420
|
+
```
|
|
1421
|
+
|
|
1422
|
+
@category Type Guard
|
|
1423
|
+
@category Utilities
|
|
1424
|
+
*/
|
|
1425
|
+
type IsNumericLiteral<T> = LiteralChecks<T, Numeric>;
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
Returns a boolean for whether the given `boolean` is not `false`.
|
|
1429
|
+
*/
|
|
1430
|
+
type IsNotFalse<T extends boolean> = [T] extends [false] ? false : true;
|
|
1431
|
+
|
|
1432
|
+
/**
|
|
1433
|
+
* This should only be used for defining generics which extend any kind of JS
|
|
1434
|
+
* array under the hood, this includes arrays *AND* tuples (of the form [x, y],
|
|
1435
|
+
* and of the form [x, ...y[]], etc...), and their readonly equivalent. This
|
|
1436
|
+
* allows us to be more inclusive to what functions can process.
|
|
1437
|
+
*
|
|
1438
|
+
* @example map<T extends ArrayLike>(items: T) { ... }
|
|
1439
|
+
*
|
|
1440
|
+
* We would've named this `ArrayLike`, but that's already used by typescript...
|
|
1441
|
+
* @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21)
|
|
1442
|
+
*/
|
|
1443
|
+
type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
|
|
1444
|
+
|
|
1445
|
+
type ArraySetRequired<T extends IterableContainer, Min extends number, Iteration extends ReadonlyArray<unknown> = []> = number extends Min ? never : Iteration["length"] extends Min ? T : T extends readonly [] ? never : T extends [infer Head, ...infer Rest] ? [
|
|
1446
|
+
Head,
|
|
1447
|
+
...ArraySetRequired<Rest, Min, [unknown, ...Iteration]>
|
|
1448
|
+
] : T extends readonly [infer Head, ...infer Rest] ? readonly [
|
|
1449
|
+
Head,
|
|
1450
|
+
...ArraySetRequired<Rest, Min, [unknown, ...Iteration]>
|
|
1451
|
+
] : T extends Array<infer Item> ? [
|
|
1452
|
+
Item,
|
|
1453
|
+
...ArraySetRequired<T, Min, [unknown, ...Iteration]>
|
|
1454
|
+
] : T extends ReadonlyArray<infer Item> ? readonly [
|
|
1455
|
+
Item,
|
|
1456
|
+
...ArraySetRequired<T, Min, [unknown, ...Iteration]>
|
|
1457
|
+
] : never;
|
|
1458
|
+
/**
|
|
1459
|
+
* Checks if the given array has at least the defined number of elements. When
|
|
1460
|
+
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so
|
|
1461
|
+
* that those indices are defined when accessing the array even when using
|
|
1462
|
+
* typescript's 'noUncheckedIndexAccess'.
|
|
1463
|
+
*
|
|
1464
|
+
* @param data - The input array.
|
|
1465
|
+
* @param minimum - The minimum number of elements the array must have.
|
|
1466
|
+
* @returns True if the array's length is *at least* `minimum`. When `minimum`
|
|
1467
|
+
* is a literal value, the output is narrowed to ensure the first items are
|
|
1468
|
+
* guaranteed.
|
|
1469
|
+
* @signature
|
|
1470
|
+
* R.hasAtLeast(data, minimum)
|
|
1471
|
+
* @example
|
|
1472
|
+
* R.hasAtLeast([], 4); // => false
|
|
1473
|
+
*
|
|
1474
|
+
* const data: number[] = [1,2,3,4];
|
|
1475
|
+
* R.hasAtLeast(data, 1); // => true
|
|
1476
|
+
* data[0]; // 1, with type `number`
|
|
1477
|
+
* @dataFirst
|
|
1478
|
+
* @category Array
|
|
1479
|
+
*/
|
|
1480
|
+
declare function hasAtLeast<T extends IterableContainer, N extends number>(data: IterableContainer | T, minimum: IsNumericLiteral<N> extends true ? N : never): data is ArraySetRequired<T, N>;
|
|
1481
|
+
declare function hasAtLeast(data: IterableContainer, minimum: number): boolean;
|
|
1482
|
+
/**
|
|
1483
|
+
* Checks if the given array has at least the defined number of elements. When
|
|
1484
|
+
* the minimum used is a literal (e.g. `3`) the output is refined accordingly so
|
|
1485
|
+
* that those indices are defined when accessing the array even when using
|
|
1486
|
+
* typescript's 'noUncheckedIndexAccess'.
|
|
1487
|
+
*
|
|
1488
|
+
* @param minimum - The minimum number of elements the array must have.
|
|
1489
|
+
* @returns True if the array's length is *at least* `minimum`. When `minimum`
|
|
1490
|
+
* is a literal value, the output is narrowed to ensure the first items are
|
|
1491
|
+
* guaranteed.
|
|
1492
|
+
* @signature
|
|
1493
|
+
* R.hasAtLeast(minimum)(data)
|
|
1494
|
+
* @example
|
|
1495
|
+
* R.pipe([], R.hasAtLeast(4)); // => false
|
|
1496
|
+
*
|
|
1497
|
+
* const data = [[1,2], [3], [4,5]];
|
|
1498
|
+
* R.pipe(
|
|
1499
|
+
* data,
|
|
1500
|
+
* R.filter(R.hasAtLeast(2)),
|
|
1501
|
+
* R.map(([, second]) => second),
|
|
1502
|
+
* ); // => [2,5], with type `number[]`
|
|
1503
|
+
* @dataLast
|
|
1504
|
+
* @category Array
|
|
1505
|
+
*/
|
|
1506
|
+
declare function hasAtLeast<N extends number>(minimum: IsNumericLiteral<N> extends true ? N : never): <T extends IterableContainer>(data: IterableContainer | T) => data is ArraySetRequired<T, N>;
|
|
1507
|
+
declare function hasAtLeast(minimum: number): (data: IterableContainer) => boolean;
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* Compares two relations hierarchically.
|
|
1511
|
+
* From the most general (implicit) to the most specific.
|
|
1512
|
+
*/
|
|
1513
|
+
declare const compareRelations: <T extends {
|
|
1514
|
+
source: string;
|
|
1515
|
+
target: string;
|
|
1516
|
+
}>(a: T, b: T) => 0 | 1 | -1;
|
|
1517
|
+
|
|
1518
|
+
/**
|
|
1519
|
+
* A tagging type for string properties that are actually document URIs.
|
|
1520
|
+
*/
|
|
1500
1521
|
type DocumentUri$1 = string;
|
|
1501
1522
|
declare namespace DocumentUri$1 {
|
|
1502
1523
|
function is(value: any): value is DocumentUri$1;
|
|
@@ -6716,7 +6737,7 @@ interface UriComponents {
|
|
|
6716
6737
|
}
|
|
6717
6738
|
|
|
6718
6739
|
/******************************************************************************
|
|
6719
|
-
* This file was generated by langium-cli 3.
|
|
6740
|
+
* This file was generated by langium-cli 3.2.0.
|
|
6720
6741
|
* DO NOT EDIT MANUALLY!
|
|
6721
6742
|
******************************************************************************/
|
|
6722
6743
|
|
|
@@ -7169,16 +7190,267 @@ interface FileSystemProvider {
|
|
|
7169
7190
|
}
|
|
7170
7191
|
|
|
7171
7192
|
/******************************************************************************
|
|
7172
|
-
* Copyright
|
|
7193
|
+
* Copyright 2021 TypeFox GmbH
|
|
7173
7194
|
* This program and the accompanying materials are made available under the
|
|
7174
7195
|
* terms of the MIT License, which is available in the project root.
|
|
7175
7196
|
******************************************************************************/
|
|
7176
|
-
|
|
7177
|
-
|
|
7197
|
+
/**
|
|
7198
|
+
* A stream is a read-only sequence of values. While the contents of an array can be accessed
|
|
7199
|
+
* both sequentially and randomly (via index), a stream allows only sequential access.
|
|
7200
|
+
*
|
|
7201
|
+
* The advantage of this is that a stream can be evaluated lazily, so it does not require
|
|
7202
|
+
* to store intermediate values. This can boost performance when a large sequence is
|
|
7203
|
+
* processed via filtering, mapping etc. and accessed at most once. However, lazy
|
|
7204
|
+
* evaluation means that all processing is repeated when you access the sequence multiple
|
|
7205
|
+
* times; in such a case, it may be better to store the resulting sequence into an array.
|
|
7206
|
+
*/
|
|
7207
|
+
interface Stream<T> extends Iterable<T> {
|
|
7178
7208
|
/**
|
|
7179
|
-
*
|
|
7180
|
-
|
|
7181
|
-
|
|
7209
|
+
* Returns an iterator for this stream. This is the same as calling the `Symbol.iterator` function property.
|
|
7210
|
+
*/
|
|
7211
|
+
iterator(): IterableIterator<T>;
|
|
7212
|
+
/**
|
|
7213
|
+
* Determines whether this stream contains no elements.
|
|
7214
|
+
*/
|
|
7215
|
+
isEmpty(): boolean;
|
|
7216
|
+
/**
|
|
7217
|
+
* Determines the number of elements in this stream.
|
|
7218
|
+
*/
|
|
7219
|
+
count(): number;
|
|
7220
|
+
/**
|
|
7221
|
+
* Collects all elements of this stream into an array.
|
|
7222
|
+
*/
|
|
7223
|
+
toArray(): T[];
|
|
7224
|
+
/**
|
|
7225
|
+
* Collects all elements of this stream into a Set.
|
|
7226
|
+
*/
|
|
7227
|
+
toSet(): Set<T>;
|
|
7228
|
+
/**
|
|
7229
|
+
* Collects all elements of this stream into a Map, applying the provided functions to determine keys and values.
|
|
7230
|
+
*
|
|
7231
|
+
* @param keyFn The function to derive map keys. If omitted, the stream elements are used as keys.
|
|
7232
|
+
* @param valueFn The function to derive map values. If omitted, the stream elements are used as values.
|
|
7233
|
+
*/
|
|
7234
|
+
toMap<K = T, V = T>(keyFn?: (e: T) => K, valueFn?: (e: T) => V): Map<K, V>;
|
|
7235
|
+
/**
|
|
7236
|
+
* Returns a string representation of a stream.
|
|
7237
|
+
*/
|
|
7238
|
+
toString(): string;
|
|
7239
|
+
/**
|
|
7240
|
+
* Combines two streams by returning a new stream that yields all elements of this stream and the other stream.
|
|
7241
|
+
*
|
|
7242
|
+
* @param other Stream to be concatenated with this one.
|
|
7243
|
+
*/
|
|
7244
|
+
concat<T2>(other: Iterable<T2>): Stream<T | T2>;
|
|
7245
|
+
/**
|
|
7246
|
+
* Adds all elements of the stream into a string, separated by the specified separator string.
|
|
7247
|
+
*
|
|
7248
|
+
* @param separator A string used to separate one element of the stream from the next in the resulting string.
|
|
7249
|
+
* If omitted, the steam elements are separated with a comma.
|
|
7250
|
+
*/
|
|
7251
|
+
join(separator?: string): string;
|
|
7252
|
+
/**
|
|
7253
|
+
* Returns the index of the first occurrence of a value in the stream, or -1 if it is not present.
|
|
7254
|
+
*
|
|
7255
|
+
* @param searchElement The value to locate in the array.
|
|
7256
|
+
* @param fromIndex The stream index at which to begin the search. If fromIndex is omitted, the search
|
|
7257
|
+
* starts at index 0.
|
|
7258
|
+
*/
|
|
7259
|
+
indexOf(searchElement: T, fromIndex?: number): number;
|
|
7260
|
+
/**
|
|
7261
|
+
* Determines whether all members of the stream satisfy the specified test.
|
|
7262
|
+
*
|
|
7263
|
+
* @param predicate This method calls the predicate function for each element in the stream until the
|
|
7264
|
+
* predicate returns a value which is coercible to the Boolean value `false`, or until the end
|
|
7265
|
+
* of the stream.
|
|
7266
|
+
*/
|
|
7267
|
+
every<S extends T>(predicate: (value: T) => value is S): this is Stream<S>;
|
|
7268
|
+
every(predicate: (value: T) => unknown): boolean;
|
|
7269
|
+
/**
|
|
7270
|
+
* Determines whether any member of the stream satisfies the specified test.
|
|
7271
|
+
*
|
|
7272
|
+
* @param predicate This method calls the predicate function for each element in the stream until the
|
|
7273
|
+
* predicate returns a value which is coercible to the Boolean value `true`, or until the end
|
|
7274
|
+
* of the stream.
|
|
7275
|
+
*/
|
|
7276
|
+
some(predicate: (value: T) => unknown): boolean;
|
|
7277
|
+
/**
|
|
7278
|
+
* Performs the specified action for each element in the stream.
|
|
7279
|
+
*
|
|
7280
|
+
* @param callbackfn Function called once for each element in the stream.
|
|
7281
|
+
*/
|
|
7282
|
+
forEach(callbackfn: (value: T, index: number) => void): void;
|
|
7283
|
+
/**
|
|
7284
|
+
* Returns a stream that yields the results of calling the specified callback function on each element
|
|
7285
|
+
* of the stream. The function is called when the resulting stream elements are actually accessed, so
|
|
7286
|
+
* accessing the resulting stream multiple times means the function is also called multiple times for
|
|
7287
|
+
* each element of the stream.
|
|
7288
|
+
*
|
|
7289
|
+
* @param callbackfn Lazily evaluated function mapping stream elements.
|
|
7290
|
+
*/
|
|
7291
|
+
map<U>(callbackfn: (value: T) => U): Stream<U>;
|
|
7292
|
+
/**
|
|
7293
|
+
* Returns the elements of the stream that meet the condition specified in a callback function.
|
|
7294
|
+
* The function is called when the resulting stream elements are actually accessed, so accessing the
|
|
7295
|
+
* resulting stream multiple times means the function is also called multiple times for each element
|
|
7296
|
+
* of the stream.
|
|
7297
|
+
*
|
|
7298
|
+
* @param predicate Lazily evaluated function checking a condition on stream elements.
|
|
7299
|
+
*/
|
|
7300
|
+
filter<S extends T>(predicate: (value: T) => value is S): Stream<S>;
|
|
7301
|
+
filter(predicate: (value: T) => unknown): Stream<T>;
|
|
7302
|
+
/**
|
|
7303
|
+
* Returns the elements of the stream that are _non-nullable_, which means they are neither `undefined`
|
|
7304
|
+
* nor `null`.
|
|
7305
|
+
*/
|
|
7306
|
+
nonNullable(): Stream<NonNullable<T>>;
|
|
7307
|
+
/**
|
|
7308
|
+
* Calls the specified callback function for all elements in the stream. The return value of the
|
|
7309
|
+
* callback function is the accumulated result, and is provided as an argument in the next call to
|
|
7310
|
+
* the callback function.
|
|
7311
|
+
*
|
|
7312
|
+
* @param callbackfn This method calls the function once for each element in the stream, providing
|
|
7313
|
+
* the previous and current values of the reduction.
|
|
7314
|
+
* @param initialValue If specified, `initialValue` is used as the initial value to start the
|
|
7315
|
+
* accumulation. The first call to the function provides this value as an argument instead
|
|
7316
|
+
* of a stream value.
|
|
7317
|
+
*/
|
|
7318
|
+
reduce(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;
|
|
7319
|
+
reduce<U = T>(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;
|
|
7320
|
+
/**
|
|
7321
|
+
* Calls the specified callback function for all elements in the stream, in descending order.
|
|
7322
|
+
* The return value of the callback function is the accumulated result, and is provided as an
|
|
7323
|
+
* argument in the next call to the callback function.
|
|
7324
|
+
*
|
|
7325
|
+
* @param callbackfn This method calls the function once for each element in the stream, providing
|
|
7326
|
+
* the previous and current values of the reduction.
|
|
7327
|
+
* @param initialValue If specified, `initialValue` is used as the initial value to start the
|
|
7328
|
+
* accumulation. The first call to the function provides this value as an argument instead
|
|
7329
|
+
* of an array value.
|
|
7330
|
+
*/
|
|
7331
|
+
reduceRight(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;
|
|
7332
|
+
reduceRight<U = T>(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;
|
|
7333
|
+
/**
|
|
7334
|
+
* Returns the value of the first element in the stream that meets the condition, or `undefined`
|
|
7335
|
+
* if there is no such element.
|
|
7336
|
+
*
|
|
7337
|
+
* @param predicate This method calls `predicate` once for each element of the stream, in ascending
|
|
7338
|
+
* order, until it finds one where `predicate` returns a value which is coercible to the
|
|
7339
|
+
* Boolean value `true`.
|
|
7340
|
+
*/
|
|
7341
|
+
find<S extends T>(predicate: (value: T) => value is S): S | undefined;
|
|
7342
|
+
find(predicate: (value: T) => unknown): T | undefined;
|
|
7343
|
+
/**
|
|
7344
|
+
* Returns the index of the first element in the stream that meets the condition, or `-1`
|
|
7345
|
+
* if there is no such element.
|
|
7346
|
+
*
|
|
7347
|
+
* @param predicate This method calls `predicate` once for each element of the stream, in ascending
|
|
7348
|
+
* order, until it finds one where `predicate` returns a value which is coercible to the
|
|
7349
|
+
* Boolean value `true`.
|
|
7350
|
+
*/
|
|
7351
|
+
findIndex(predicate: (value: T) => unknown): number;
|
|
7352
|
+
/**
|
|
7353
|
+
* Determines whether the stream includes a certain element, returning `true` or `false` as appropriate.
|
|
7354
|
+
*
|
|
7355
|
+
* @param searchElement The element to search for.
|
|
7356
|
+
*/
|
|
7357
|
+
includes(searchElement: T): boolean;
|
|
7358
|
+
/**
|
|
7359
|
+
* Calls a defined callback function on each element of the stream and then flattens the result into
|
|
7360
|
+
* a new stream. This is identical to a `map` followed by `flat` with depth 1.
|
|
7361
|
+
*
|
|
7362
|
+
* @param callbackfn Lazily evaluated function mapping stream elements.
|
|
7363
|
+
*/
|
|
7364
|
+
flatMap<U>(callbackfn: (value: T) => U | Iterable<U>): Stream<U>;
|
|
7365
|
+
/**
|
|
7366
|
+
* Returns a new stream with all sub-stream or sub-array elements concatenated into it recursively up
|
|
7367
|
+
* to the specified depth.
|
|
7368
|
+
*
|
|
7369
|
+
* @param depth The maximum recursion depth. Defaults to 1.
|
|
7370
|
+
*/
|
|
7371
|
+
flat<D extends number = 1>(depth?: D): FlatStream<T, D>;
|
|
7372
|
+
/**
|
|
7373
|
+
* Returns the first element in the stream, or `undefined` if the stream is empty.
|
|
7374
|
+
*/
|
|
7375
|
+
head(): T | undefined;
|
|
7376
|
+
/**
|
|
7377
|
+
* Returns a stream that skips the first `skipCount` elements from this stream.
|
|
7378
|
+
*
|
|
7379
|
+
* @param skipCount The number of elements to skip. If this is larger than the number of elements in
|
|
7380
|
+
* the stream, an empty stream is returned. Defaults to 1.
|
|
7381
|
+
*/
|
|
7382
|
+
tail(skipCount?: number): Stream<T>;
|
|
7383
|
+
/**
|
|
7384
|
+
* Returns a stream consisting of the elements of this stream, truncated to be no longer than `maxSize`
|
|
7385
|
+
* in length.
|
|
7386
|
+
*
|
|
7387
|
+
* @param maxSize The number of elements the stream should be limited to
|
|
7388
|
+
*/
|
|
7389
|
+
limit(maxSize: number): Stream<T>;
|
|
7390
|
+
/**
|
|
7391
|
+
* Returns a stream containing only the distinct elements from this stream.
|
|
7392
|
+
* Equality is determined with the same rules as a standard `Set`.
|
|
7393
|
+
*
|
|
7394
|
+
* @param by A function returning the key used to check equality with a previous stream element.
|
|
7395
|
+
* If omitted, the stream elements themselves are used for comparison.
|
|
7396
|
+
*/
|
|
7397
|
+
distinct<Key = T>(by?: (element: T) => Key): Stream<T>;
|
|
7398
|
+
/**
|
|
7399
|
+
* Returns a stream that contains all elements that don't exist in the {@link other} iterable.
|
|
7400
|
+
* Equality is determined with the same rules as a standard `Set`.
|
|
7401
|
+
* @param other The elements that should be exluded from this stream.
|
|
7402
|
+
* @param key A function returning the key used to check quality.
|
|
7403
|
+
* If omitted, the stream elements themselves are used for comparison.
|
|
7404
|
+
*/
|
|
7405
|
+
exclude<Key = T>(other: Iterable<T>, key?: (element: T) => Key): Stream<T>;
|
|
7406
|
+
}
|
|
7407
|
+
type FlatStream<T, Depth extends number> = {
|
|
7408
|
+
'done': Stream<T>;
|
|
7409
|
+
'recur': T extends Iterable<infer Content> ? FlatStream<Content, MinusOne<Depth>> : Stream<T>;
|
|
7410
|
+
}[Depth extends 0 ? 'done' : 'recur'];
|
|
7411
|
+
type MinusOne<N extends number> = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][N];
|
|
7412
|
+
|
|
7413
|
+
/******************************************************************************
|
|
7414
|
+
* Copyright 2021 TypeFox GmbH
|
|
7415
|
+
* This program and the accompanying materials are made available under the
|
|
7416
|
+
* terms of the MIT License, which is available in the project root.
|
|
7417
|
+
******************************************************************************/
|
|
7418
|
+
|
|
7419
|
+
interface TokenBuilderOptions {
|
|
7420
|
+
caseInsensitive?: boolean;
|
|
7421
|
+
}
|
|
7422
|
+
interface TokenBuilder {
|
|
7423
|
+
buildTokens(grammar: Grammar, options?: TokenBuilderOptions): TokenVocabulary;
|
|
7424
|
+
/**
|
|
7425
|
+
* Produces a lexing report for the given text that was just tokenized using the tokens provided by this builder.
|
|
7426
|
+
*
|
|
7427
|
+
* @param text The text that was tokenized.
|
|
7428
|
+
*/
|
|
7429
|
+
flushLexingReport?(text: string): LexingReport;
|
|
7430
|
+
}
|
|
7431
|
+
/**
|
|
7432
|
+
* A custom lexing report that can be produced by the token builder during the lexing process.
|
|
7433
|
+
* Adopters need to ensure that the any custom fields are serializable so they can be sent across worker threads.
|
|
7434
|
+
*/
|
|
7435
|
+
interface LexingReport {
|
|
7436
|
+
diagnostics: LexingDiagnostic[];
|
|
7437
|
+
}
|
|
7438
|
+
type LexingDiagnosticSeverity = 'error' | 'warning' | 'info' | 'hint';
|
|
7439
|
+
interface LexingDiagnostic extends ILexingError {
|
|
7440
|
+
severity?: LexingDiagnosticSeverity;
|
|
7441
|
+
}
|
|
7442
|
+
|
|
7443
|
+
/******************************************************************************
|
|
7444
|
+
* Copyright 2022 TypeFox GmbH
|
|
7445
|
+
* This program and the accompanying materials are made available under the
|
|
7446
|
+
* terms of the MIT License, which is available in the project root.
|
|
7447
|
+
******************************************************************************/
|
|
7448
|
+
|
|
7449
|
+
interface LexerResult {
|
|
7450
|
+
/**
|
|
7451
|
+
* A list of all tokens that were lexed from the input.
|
|
7452
|
+
*
|
|
7453
|
+
* Note that Langium requires the optional properties
|
|
7182
7454
|
* `startLine`, `startColumn`, `endOffset`, `endLine` and `endColumn` to be set on each token.
|
|
7183
7455
|
*/
|
|
7184
7456
|
tokens: IToken[];
|
|
@@ -7187,10 +7459,15 @@ interface LexerResult {
|
|
|
7187
7459
|
*/
|
|
7188
7460
|
hidden: IToken[];
|
|
7189
7461
|
errors: ILexingError[];
|
|
7462
|
+
report?: LexingReport;
|
|
7463
|
+
}
|
|
7464
|
+
type TokenizeMode = 'full' | 'partial';
|
|
7465
|
+
interface TokenizeOptions {
|
|
7466
|
+
mode?: TokenizeMode;
|
|
7190
7467
|
}
|
|
7191
7468
|
interface Lexer {
|
|
7192
7469
|
readonly definition: TokenTypeDictionary;
|
|
7193
|
-
tokenize(text: string): LexerResult;
|
|
7470
|
+
tokenize(text: string, options?: TokenizeOptions): LexerResult;
|
|
7194
7471
|
}
|
|
7195
7472
|
|
|
7196
7473
|
/******************************************************************************
|
|
@@ -7203,6 +7480,7 @@ type ParseResult<T = AstNode> = {
|
|
|
7203
7480
|
value: T;
|
|
7204
7481
|
parserErrors: IRecognitionException[];
|
|
7205
7482
|
lexerErrors: ILexingError[];
|
|
7483
|
+
lexerReport?: LexingReport;
|
|
7206
7484
|
};
|
|
7207
7485
|
type RuleResult = (args: Args) => any;
|
|
7208
7486
|
type Args = Record<string, boolean>;
|
|
@@ -7365,268 +7643,47 @@ declare class LangiumCompletionParser extends AbstractLangiumParser {
|
|
|
7365
7643
|
*/
|
|
7366
7644
|
declare class ChevrotainWrapper extends EmbeddedActionsParser {
|
|
7367
7645
|
definitionErrors: IParserDefinitionError[];
|
|
7368
|
-
constructor(tokens: TokenVocabulary, config?: IParserConfig);
|
|
7369
|
-
get IS_RECORDING(): boolean;
|
|
7370
|
-
DEFINE_RULE(name: string, impl: RuleImpl): RuleResult;
|
|
7371
|
-
wrapSelfAnalysis(): void;
|
|
7372
|
-
wrapConsume(idx: number, tokenType: TokenType): IToken;
|
|
7373
|
-
wrapSubrule(idx: number, rule: RuleResult, args: Args): unknown;
|
|
7374
|
-
wrapOr(idx: number, choices: Array<IOrAlt<any>>): void;
|
|
7375
|
-
wrapOption(idx: number, callback: DSLMethodOpts<unknown>): void;
|
|
7376
|
-
wrapMany(idx: number, callback: DSLMethodOpts<unknown>): void;
|
|
7377
|
-
wrapAtLeastOne(idx: number, callback: DSLMethodOpts<unknown>): void;
|
|
7378
|
-
}
|
|
7379
|
-
|
|
7380
|
-
/******************************************************************************
|
|
7381
|
-
* Copyright 2021 TypeFox GmbH
|
|
7382
|
-
* This program and the accompanying materials are made available under the
|
|
7383
|
-
* terms of the MIT License, which is available in the project root.
|
|
7384
|
-
******************************************************************************/
|
|
7385
|
-
|
|
7386
|
-
/**
|
|
7387
|
-
* The service registry provides access to the language-specific {@link LangiumCoreServices} optionally including LSP-related services.
|
|
7388
|
-
* These are resolved via the URI of a text document.
|
|
7389
|
-
*/
|
|
7390
|
-
interface ServiceRegistry {
|
|
7391
|
-
/**
|
|
7392
|
-
* Register a language via its injected services.
|
|
7393
|
-
*/
|
|
7394
|
-
register(language: LangiumCoreServices): void;
|
|
7395
|
-
/**
|
|
7396
|
-
* Retrieve the language-specific services for the given URI. In case only one language is
|
|
7397
|
-
* registered, it may be used regardless of the URI format.
|
|
7398
|
-
*/
|
|
7399
|
-
getServices(uri: URI): LangiumCoreServices;
|
|
7400
|
-
/**
|
|
7401
|
-
* Check whether services are available for the given URI.
|
|
7402
|
-
*/
|
|
7403
|
-
hasServices(uri: URI): boolean;
|
|
7404
|
-
/**
|
|
7405
|
-
* The full set of registered language services.
|
|
7406
|
-
*/
|
|
7407
|
-
readonly all: readonly LangiumCoreServices[];
|
|
7408
|
-
}
|
|
7409
|
-
|
|
7410
|
-
/******************************************************************************
|
|
7411
|
-
* Copyright 2021 TypeFox GmbH
|
|
7412
|
-
* This program and the accompanying materials are made available under the
|
|
7413
|
-
* terms of the MIT License, which is available in the project root.
|
|
7414
|
-
******************************************************************************/
|
|
7415
|
-
/**
|
|
7416
|
-
* A stream is a read-only sequence of values. While the contents of an array can be accessed
|
|
7417
|
-
* both sequentially and randomly (via index), a stream allows only sequential access.
|
|
7418
|
-
*
|
|
7419
|
-
* The advantage of this is that a stream can be evaluated lazily, so it does not require
|
|
7420
|
-
* to store intermediate values. This can boost performance when a large sequence is
|
|
7421
|
-
* processed via filtering, mapping etc. and accessed at most once. However, lazy
|
|
7422
|
-
* evaluation means that all processing is repeated when you access the sequence multiple
|
|
7423
|
-
* times; in such a case, it may be better to store the resulting sequence into an array.
|
|
7424
|
-
*/
|
|
7425
|
-
interface Stream<T> extends Iterable<T> {
|
|
7426
|
-
/**
|
|
7427
|
-
* Returns an iterator for this stream. This is the same as calling the `Symbol.iterator` function property.
|
|
7428
|
-
*/
|
|
7429
|
-
iterator(): IterableIterator<T>;
|
|
7430
|
-
/**
|
|
7431
|
-
* Determines whether this stream contains no elements.
|
|
7432
|
-
*/
|
|
7433
|
-
isEmpty(): boolean;
|
|
7434
|
-
/**
|
|
7435
|
-
* Determines the number of elements in this stream.
|
|
7436
|
-
*/
|
|
7437
|
-
count(): number;
|
|
7438
|
-
/**
|
|
7439
|
-
* Collects all elements of this stream into an array.
|
|
7440
|
-
*/
|
|
7441
|
-
toArray(): T[];
|
|
7442
|
-
/**
|
|
7443
|
-
* Collects all elements of this stream into a Set.
|
|
7444
|
-
*/
|
|
7445
|
-
toSet(): Set<T>;
|
|
7446
|
-
/**
|
|
7447
|
-
* Collects all elements of this stream into a Map, applying the provided functions to determine keys and values.
|
|
7448
|
-
*
|
|
7449
|
-
* @param keyFn The function to derive map keys. If omitted, the stream elements are used as keys.
|
|
7450
|
-
* @param valueFn The function to derive map values. If omitted, the stream elements are used as values.
|
|
7451
|
-
*/
|
|
7452
|
-
toMap<K = T, V = T>(keyFn?: (e: T) => K, valueFn?: (e: T) => V): Map<K, V>;
|
|
7453
|
-
/**
|
|
7454
|
-
* Returns a string representation of a stream.
|
|
7455
|
-
*/
|
|
7456
|
-
toString(): string;
|
|
7457
|
-
/**
|
|
7458
|
-
* Combines two streams by returning a new stream that yields all elements of this stream and the other stream.
|
|
7459
|
-
*
|
|
7460
|
-
* @param other Stream to be concatenated with this one.
|
|
7461
|
-
*/
|
|
7462
|
-
concat<T2>(other: Iterable<T2>): Stream<T | T2>;
|
|
7463
|
-
/**
|
|
7464
|
-
* Adds all elements of the stream into a string, separated by the specified separator string.
|
|
7465
|
-
*
|
|
7466
|
-
* @param separator A string used to separate one element of the stream from the next in the resulting string.
|
|
7467
|
-
* If omitted, the steam elements are separated with a comma.
|
|
7468
|
-
*/
|
|
7469
|
-
join(separator?: string): string;
|
|
7470
|
-
/**
|
|
7471
|
-
* Returns the index of the first occurrence of a value in the stream, or -1 if it is not present.
|
|
7472
|
-
*
|
|
7473
|
-
* @param searchElement The value to locate in the array.
|
|
7474
|
-
* @param fromIndex The stream index at which to begin the search. If fromIndex is omitted, the search
|
|
7475
|
-
* starts at index 0.
|
|
7476
|
-
*/
|
|
7477
|
-
indexOf(searchElement: T, fromIndex?: number): number;
|
|
7478
|
-
/**
|
|
7479
|
-
* Determines whether all members of the stream satisfy the specified test.
|
|
7480
|
-
*
|
|
7481
|
-
* @param predicate This method calls the predicate function for each element in the stream until the
|
|
7482
|
-
* predicate returns a value which is coercible to the Boolean value `false`, or until the end
|
|
7483
|
-
* of the stream.
|
|
7484
|
-
*/
|
|
7485
|
-
every<S extends T>(predicate: (value: T) => value is S): this is Stream<S>;
|
|
7486
|
-
every(predicate: (value: T) => unknown): boolean;
|
|
7487
|
-
/**
|
|
7488
|
-
* Determines whether any member of the stream satisfies the specified test.
|
|
7489
|
-
*
|
|
7490
|
-
* @param predicate This method calls the predicate function for each element in the stream until the
|
|
7491
|
-
* predicate returns a value which is coercible to the Boolean value `true`, or until the end
|
|
7492
|
-
* of the stream.
|
|
7493
|
-
*/
|
|
7494
|
-
some(predicate: (value: T) => unknown): boolean;
|
|
7495
|
-
/**
|
|
7496
|
-
* Performs the specified action for each element in the stream.
|
|
7497
|
-
*
|
|
7498
|
-
* @param callbackfn Function called once for each element in the stream.
|
|
7499
|
-
*/
|
|
7500
|
-
forEach(callbackfn: (value: T, index: number) => void): void;
|
|
7501
|
-
/**
|
|
7502
|
-
* Returns a stream that yields the results of calling the specified callback function on each element
|
|
7503
|
-
* of the stream. The function is called when the resulting stream elements are actually accessed, so
|
|
7504
|
-
* accessing the resulting stream multiple times means the function is also called multiple times for
|
|
7505
|
-
* each element of the stream.
|
|
7506
|
-
*
|
|
7507
|
-
* @param callbackfn Lazily evaluated function mapping stream elements.
|
|
7508
|
-
*/
|
|
7509
|
-
map<U>(callbackfn: (value: T) => U): Stream<U>;
|
|
7510
|
-
/**
|
|
7511
|
-
* Returns the elements of the stream that meet the condition specified in a callback function.
|
|
7512
|
-
* The function is called when the resulting stream elements are actually accessed, so accessing the
|
|
7513
|
-
* resulting stream multiple times means the function is also called multiple times for each element
|
|
7514
|
-
* of the stream.
|
|
7515
|
-
*
|
|
7516
|
-
* @param predicate Lazily evaluated function checking a condition on stream elements.
|
|
7517
|
-
*/
|
|
7518
|
-
filter<S extends T>(predicate: (value: T) => value is S): Stream<S>;
|
|
7519
|
-
filter(predicate: (value: T) => unknown): Stream<T>;
|
|
7520
|
-
/**
|
|
7521
|
-
* Returns the elements of the stream that are _non-nullable_, which means they are neither `undefined`
|
|
7522
|
-
* nor `null`.
|
|
7523
|
-
*/
|
|
7524
|
-
nonNullable(): Stream<NonNullable<T>>;
|
|
7525
|
-
/**
|
|
7526
|
-
* Calls the specified callback function for all elements in the stream. The return value of the
|
|
7527
|
-
* callback function is the accumulated result, and is provided as an argument in the next call to
|
|
7528
|
-
* the callback function.
|
|
7529
|
-
*
|
|
7530
|
-
* @param callbackfn This method calls the function once for each element in the stream, providing
|
|
7531
|
-
* the previous and current values of the reduction.
|
|
7532
|
-
* @param initialValue If specified, `initialValue` is used as the initial value to start the
|
|
7533
|
-
* accumulation. The first call to the function provides this value as an argument instead
|
|
7534
|
-
* of a stream value.
|
|
7535
|
-
*/
|
|
7536
|
-
reduce(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;
|
|
7537
|
-
reduce<U = T>(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;
|
|
7538
|
-
/**
|
|
7539
|
-
* Calls the specified callback function for all elements in the stream, in descending order.
|
|
7540
|
-
* The return value of the callback function is the accumulated result, and is provided as an
|
|
7541
|
-
* argument in the next call to the callback function.
|
|
7542
|
-
*
|
|
7543
|
-
* @param callbackfn This method calls the function once for each element in the stream, providing
|
|
7544
|
-
* the previous and current values of the reduction.
|
|
7545
|
-
* @param initialValue If specified, `initialValue` is used as the initial value to start the
|
|
7546
|
-
* accumulation. The first call to the function provides this value as an argument instead
|
|
7547
|
-
* of an array value.
|
|
7548
|
-
*/
|
|
7549
|
-
reduceRight(callbackfn: (previousValue: T, currentValue: T) => T): T | undefined;
|
|
7550
|
-
reduceRight<U = T>(callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U): U;
|
|
7551
|
-
/**
|
|
7552
|
-
* Returns the value of the first element in the stream that meets the condition, or `undefined`
|
|
7553
|
-
* if there is no such element.
|
|
7554
|
-
*
|
|
7555
|
-
* @param predicate This method calls `predicate` once for each element of the stream, in ascending
|
|
7556
|
-
* order, until it finds one where `predicate` returns a value which is coercible to the
|
|
7557
|
-
* Boolean value `true`.
|
|
7558
|
-
*/
|
|
7559
|
-
find<S extends T>(predicate: (value: T) => value is S): S | undefined;
|
|
7560
|
-
find(predicate: (value: T) => unknown): T | undefined;
|
|
7561
|
-
/**
|
|
7562
|
-
* Returns the index of the first element in the stream that meets the condition, or `-1`
|
|
7563
|
-
* if there is no such element.
|
|
7564
|
-
*
|
|
7565
|
-
* @param predicate This method calls `predicate` once for each element of the stream, in ascending
|
|
7566
|
-
* order, until it finds one where `predicate` returns a value which is coercible to the
|
|
7567
|
-
* Boolean value `true`.
|
|
7568
|
-
*/
|
|
7569
|
-
findIndex(predicate: (value: T) => unknown): number;
|
|
7570
|
-
/**
|
|
7571
|
-
* Determines whether the stream includes a certain element, returning `true` or `false` as appropriate.
|
|
7572
|
-
*
|
|
7573
|
-
* @param searchElement The element to search for.
|
|
7574
|
-
*/
|
|
7575
|
-
includes(searchElement: T): boolean;
|
|
7576
|
-
/**
|
|
7577
|
-
* Calls a defined callback function on each element of the stream and then flattens the result into
|
|
7578
|
-
* a new stream. This is identical to a `map` followed by `flat` with depth 1.
|
|
7579
|
-
*
|
|
7580
|
-
* @param callbackfn Lazily evaluated function mapping stream elements.
|
|
7581
|
-
*/
|
|
7582
|
-
flatMap<U>(callbackfn: (value: T) => U | Iterable<U>): Stream<U>;
|
|
7583
|
-
/**
|
|
7584
|
-
* Returns a new stream with all sub-stream or sub-array elements concatenated into it recursively up
|
|
7585
|
-
* to the specified depth.
|
|
7586
|
-
*
|
|
7587
|
-
* @param depth The maximum recursion depth. Defaults to 1.
|
|
7588
|
-
*/
|
|
7589
|
-
flat<D extends number = 1>(depth?: D): FlatStream<T, D>;
|
|
7590
|
-
/**
|
|
7591
|
-
* Returns the first element in the stream, or `undefined` if the stream is empty.
|
|
7592
|
-
*/
|
|
7593
|
-
head(): T | undefined;
|
|
7646
|
+
constructor(tokens: TokenVocabulary, config?: IParserConfig);
|
|
7647
|
+
get IS_RECORDING(): boolean;
|
|
7648
|
+
DEFINE_RULE(name: string, impl: RuleImpl): RuleResult;
|
|
7649
|
+
wrapSelfAnalysis(): void;
|
|
7650
|
+
wrapConsume(idx: number, tokenType: TokenType): IToken;
|
|
7651
|
+
wrapSubrule(idx: number, rule: RuleResult, args: Args): unknown;
|
|
7652
|
+
wrapOr(idx: number, choices: Array<IOrAlt<any>>): void;
|
|
7653
|
+
wrapOption(idx: number, callback: DSLMethodOpts<unknown>): void;
|
|
7654
|
+
wrapMany(idx: number, callback: DSLMethodOpts<unknown>): void;
|
|
7655
|
+
wrapAtLeastOne(idx: number, callback: DSLMethodOpts<unknown>): void;
|
|
7656
|
+
}
|
|
7657
|
+
|
|
7658
|
+
/******************************************************************************
|
|
7659
|
+
* Copyright 2021 TypeFox GmbH
|
|
7660
|
+
* This program and the accompanying materials are made available under the
|
|
7661
|
+
* terms of the MIT License, which is available in the project root.
|
|
7662
|
+
******************************************************************************/
|
|
7663
|
+
|
|
7664
|
+
/**
|
|
7665
|
+
* The service registry provides access to the language-specific {@link LangiumCoreServices} optionally including LSP-related services.
|
|
7666
|
+
* These are resolved via the URI of a text document.
|
|
7667
|
+
*/
|
|
7668
|
+
interface ServiceRegistry {
|
|
7594
7669
|
/**
|
|
7595
|
-
*
|
|
7596
|
-
*
|
|
7597
|
-
* @param skipCount The number of elements to skip. If this is larger than the number of elements in
|
|
7598
|
-
* the stream, an empty stream is returned. Defaults to 1.
|
|
7670
|
+
* Register a language via its injected services.
|
|
7599
7671
|
*/
|
|
7600
|
-
|
|
7672
|
+
register(language: LangiumCoreServices): void;
|
|
7601
7673
|
/**
|
|
7602
|
-
*
|
|
7603
|
-
*
|
|
7604
|
-
*
|
|
7605
|
-
* @param maxSize The number of elements the stream should be limited to
|
|
7674
|
+
* Retrieve the language-specific services for the given URI. In case only one language is
|
|
7675
|
+
* registered, it may be used regardless of the URI format.
|
|
7606
7676
|
*/
|
|
7607
|
-
|
|
7677
|
+
getServices(uri: URI): LangiumCoreServices;
|
|
7608
7678
|
/**
|
|
7609
|
-
*
|
|
7610
|
-
* Equality is determined with the same rules as a standard `Set`.
|
|
7611
|
-
*
|
|
7612
|
-
* @param by A function returning the key used to check equality with a previous stream element.
|
|
7613
|
-
* If omitted, the stream elements themselves are used for comparison.
|
|
7679
|
+
* Check whether services are available for the given URI.
|
|
7614
7680
|
*/
|
|
7615
|
-
|
|
7681
|
+
hasServices(uri: URI): boolean;
|
|
7616
7682
|
/**
|
|
7617
|
-
*
|
|
7618
|
-
* Equality is determined with the same rules as a standard `Set`.
|
|
7619
|
-
* @param other The elements that should be exluded from this stream.
|
|
7620
|
-
* @param key A function returning the key used to check quality.
|
|
7621
|
-
* If omitted, the stream elements themselves are used for comparison.
|
|
7683
|
+
* The full set of registered language services.
|
|
7622
7684
|
*/
|
|
7623
|
-
|
|
7685
|
+
readonly all: readonly LangiumCoreServices[];
|
|
7624
7686
|
}
|
|
7625
|
-
type FlatStream<T, Depth extends number> = {
|
|
7626
|
-
'done': Stream<T>;
|
|
7627
|
-
'recur': T extends Iterable<infer Content> ? FlatStream<Content, MinusOne<Depth>> : Stream<T>;
|
|
7628
|
-
}[Depth extends 0 ? 'done' : 'recur'];
|
|
7629
|
-
type MinusOne<N extends number> = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][N];
|
|
7630
7687
|
|
|
7631
7688
|
/******************************************************************************
|
|
7632
7689
|
* Copyright 2021 TypeFox GmbH
|
|
@@ -7849,7 +7906,7 @@ interface DocumentSegment {
|
|
|
7849
7906
|
* No implementation object is expected to be offered by `LangiumCoreServices`, but only by `LangiumLSPServices`.
|
|
7850
7907
|
*/
|
|
7851
7908
|
type TextDocumentProvider = {
|
|
7852
|
-
get(uri: string): TextDocument | undefined;
|
|
7909
|
+
get(uri: string | URI): TextDocument | undefined;
|
|
7853
7910
|
};
|
|
7854
7911
|
/**
|
|
7855
7912
|
* Shared service for creating `LangiumDocument` instances.
|
|
@@ -8465,6 +8522,8 @@ interface Linker {
|
|
|
8465
8522
|
*
|
|
8466
8523
|
* @param document A LangiumDocument that shall be linked.
|
|
8467
8524
|
* @param cancelToken A token for cancelling the operation.
|
|
8525
|
+
*
|
|
8526
|
+
* @throws `OperationCancelled` if a cancellation event is detected
|
|
8468
8527
|
*/
|
|
8469
8528
|
link(document: LangiumDocument, cancelToken?: CancellationToken): Promise<void>;
|
|
8470
8529
|
/**
|
|
@@ -8546,29 +8605,24 @@ declare class Deferred<T = void> {
|
|
|
8546
8605
|
******************************************************************************/
|
|
8547
8606
|
|
|
8548
8607
|
/**
|
|
8549
|
-
* Async parser that allows
|
|
8550
|
-
* The sync parser implementation is blocking the event loop, which can become quite problematic for large files.
|
|
8608
|
+
* Async parser that allows cancellation of the current parsing process.
|
|
8551
8609
|
*
|
|
8552
|
-
*
|
|
8553
|
-
* A real implementation would create worker threads or web workers to offload the parsing work.
|
|
8610
|
+
* @remark The sync parser implementation is blocking the event loop, which can become quite problematic for large files.
|
|
8611
|
+
* @remark The default implementation is not actually async. It just wraps the sync parser in a promise. A real implementation would create worker threads or web workers to offload the parsing work.
|
|
8554
8612
|
*/
|
|
8555
8613
|
interface AsyncParser {
|
|
8614
|
+
/**
|
|
8615
|
+
* Parses the given text and returns the parse result.
|
|
8616
|
+
*
|
|
8617
|
+
* @param text The text to parse.
|
|
8618
|
+
* @param cancelToken A cancellation token that can be used to cancel the parsing process.
|
|
8619
|
+
* @returns A promise that resolves to the parse result.
|
|
8620
|
+
*
|
|
8621
|
+
* @throw `OperationCancelled` if the parsing process is cancelled.
|
|
8622
|
+
*/
|
|
8556
8623
|
parse<T extends AstNode>(text: string, cancelToken: CancellationToken): Promise<ParseResult<T>>;
|
|
8557
8624
|
}
|
|
8558
8625
|
|
|
8559
|
-
/******************************************************************************
|
|
8560
|
-
* Copyright 2021 TypeFox GmbH
|
|
8561
|
-
* This program and the accompanying materials are made available under the
|
|
8562
|
-
* terms of the MIT License, which is available in the project root.
|
|
8563
|
-
******************************************************************************/
|
|
8564
|
-
|
|
8565
|
-
interface TokenBuilderOptions {
|
|
8566
|
-
caseInsensitive?: boolean;
|
|
8567
|
-
}
|
|
8568
|
-
interface TokenBuilder {
|
|
8569
|
-
buildTokens(grammar: Grammar, options?: TokenBuilderOptions): TokenVocabulary;
|
|
8570
|
-
}
|
|
8571
|
-
|
|
8572
8626
|
/******************************************************************************
|
|
8573
8627
|
* Copyright 2021 TypeFox GmbH
|
|
8574
8628
|
* This program and the accompanying materials are made available under the
|
|
@@ -8706,7 +8760,7 @@ declare class DefaultScopeComputation implements ScopeComputation {
|
|
|
8706
8760
|
* @param document The document containing the AST node to be exported.
|
|
8707
8761
|
* @param children A function called with {@link parentNode} as single argument and returning an {@link Iterable} supplying the children to be visited, which must be directly or transitively contained in {@link parentNode}.
|
|
8708
8762
|
* @param cancelToken Indicates when to cancel the current operation.
|
|
8709
|
-
* @throws `
|
|
8763
|
+
* @throws `OperationCancelled` if a user action occurs during execution.
|
|
8710
8764
|
* @returns A list of {@link AstNodeDescription AstNodeDescriptions} to be published to index.
|
|
8711
8765
|
*/
|
|
8712
8766
|
computeExportsForNode(parentNode: AstNode, document: LangiumDocument<AstNode>, children?: (root: AstNode) => Iterable<AstNode>, cancelToken?: CancellationToken): Promise<AstNodeDescription[]>;
|
|
@@ -8794,7 +8848,8 @@ type DiagnosticInfo<N extends AstNode, P extends string = Properties<N>> = {
|
|
|
8794
8848
|
/** A data entry field that is preserved between a `textDocument/publishDiagnostics` notification and `textDocument/codeAction` request. */
|
|
8795
8849
|
data?: unknown;
|
|
8796
8850
|
};
|
|
8797
|
-
type
|
|
8851
|
+
type ValidationSeverity = 'error' | 'warning' | 'info' | 'hint';
|
|
8852
|
+
type ValidationAcceptor = <N extends AstNode>(severity: ValidationSeverity, message: string, info: DiagnosticInfo<N>) => void;
|
|
8798
8853
|
type ValidationCheck<T extends AstNode = AstNode> = (node: T, accept: ValidationAcceptor, cancelToken: CancellationToken) => MaybePromise<void>;
|
|
8799
8854
|
/**
|
|
8800
8855
|
* A utility type for associating non-primitive AST types to corresponding validation checks. For example:
|
|
@@ -8888,6 +8943,9 @@ interface DocumentValidator {
|
|
|
8888
8943
|
}
|
|
8889
8944
|
declare namespace DocumentValidator {
|
|
8890
8945
|
const LexingError = "lexing-error";
|
|
8946
|
+
const LexingWarning = "lexing-warning";
|
|
8947
|
+
const LexingInfo = "lexing-info";
|
|
8948
|
+
const LexingHint = "lexing-hint";
|
|
8891
8949
|
const ParsingError = "parsing-error";
|
|
8892
8950
|
const LinkingError = "linking-error";
|
|
8893
8951
|
}
|
|
@@ -13548,6 +13606,9 @@ interface WorkspaceManager {
|
|
|
13548
13606
|
* each language file and stores it locally.
|
|
13549
13607
|
*
|
|
13550
13608
|
* @param folders The set of workspace folders to be indexed.
|
|
13609
|
+
* @param cancelToken A cancellation token that can be used to cancel the operation.
|
|
13610
|
+
*
|
|
13611
|
+
* @throws OperationCancelled if a cancellation event has been detected
|
|
13551
13612
|
*/
|
|
13552
13613
|
initializeWorkspace(folders: WorkspaceFolder[], cancelToken?: CancellationToken): Promise<void>;
|
|
13553
13614
|
}
|
|
@@ -13604,51 +13665,51 @@ declare class DefaultWorkspaceManager implements WorkspaceManager {
|
|
|
13604
13665
|
* grammar definition and the language configuration.
|
|
13605
13666
|
*/
|
|
13606
13667
|
type LangiumGeneratedCoreServices = {
|
|
13607
|
-
Grammar: Grammar;
|
|
13608
|
-
LanguageMetaData: LanguageMetaData;
|
|
13609
|
-
parser: {
|
|
13610
|
-
ParserConfig?: IParserConfig;
|
|
13668
|
+
readonly Grammar: Grammar;
|
|
13669
|
+
readonly LanguageMetaData: LanguageMetaData;
|
|
13670
|
+
readonly parser: {
|
|
13671
|
+
readonly ParserConfig?: IParserConfig;
|
|
13611
13672
|
};
|
|
13612
13673
|
};
|
|
13613
13674
|
/**
|
|
13614
13675
|
* Core services for a specific language of which Langium provides default implementations.
|
|
13615
13676
|
*/
|
|
13616
13677
|
type LangiumDefaultCoreServices = {
|
|
13617
|
-
parser: {
|
|
13618
|
-
AsyncParser: AsyncParser;
|
|
13619
|
-
GrammarConfig: GrammarConfig;
|
|
13620
|
-
ValueConverter: ValueConverter;
|
|
13621
|
-
LangiumParser: LangiumParser;
|
|
13622
|
-
ParserErrorMessageProvider: IParserErrorMessageProvider;
|
|
13623
|
-
CompletionParser: LangiumCompletionParser;
|
|
13624
|
-
TokenBuilder: TokenBuilder;
|
|
13625
|
-
Lexer: Lexer;
|
|
13678
|
+
readonly parser: {
|
|
13679
|
+
readonly AsyncParser: AsyncParser;
|
|
13680
|
+
readonly GrammarConfig: GrammarConfig;
|
|
13681
|
+
readonly ValueConverter: ValueConverter;
|
|
13682
|
+
readonly LangiumParser: LangiumParser;
|
|
13683
|
+
readonly ParserErrorMessageProvider: IParserErrorMessageProvider;
|
|
13684
|
+
readonly CompletionParser: LangiumCompletionParser;
|
|
13685
|
+
readonly TokenBuilder: TokenBuilder;
|
|
13686
|
+
readonly Lexer: Lexer;
|
|
13626
13687
|
};
|
|
13627
|
-
documentation: {
|
|
13628
|
-
CommentProvider: CommentProvider;
|
|
13629
|
-
DocumentationProvider: DocumentationProvider;
|
|
13688
|
+
readonly documentation: {
|
|
13689
|
+
readonly CommentProvider: CommentProvider;
|
|
13690
|
+
readonly DocumentationProvider: DocumentationProvider;
|
|
13630
13691
|
};
|
|
13631
|
-
references: {
|
|
13632
|
-
Linker: Linker;
|
|
13633
|
-
NameProvider: NameProvider;
|
|
13634
|
-
References: References;
|
|
13635
|
-
ScopeProvider: ScopeProvider;
|
|
13636
|
-
ScopeComputation: ScopeComputation;
|
|
13692
|
+
readonly references: {
|
|
13693
|
+
readonly Linker: Linker;
|
|
13694
|
+
readonly NameProvider: NameProvider;
|
|
13695
|
+
readonly References: References;
|
|
13696
|
+
readonly ScopeProvider: ScopeProvider;
|
|
13697
|
+
readonly ScopeComputation: ScopeComputation;
|
|
13637
13698
|
};
|
|
13638
|
-
serializer: {
|
|
13639
|
-
Hydrator: Hydrator;
|
|
13640
|
-
JsonSerializer: JsonSerializer;
|
|
13699
|
+
readonly serializer: {
|
|
13700
|
+
readonly Hydrator: Hydrator;
|
|
13701
|
+
readonly JsonSerializer: JsonSerializer;
|
|
13641
13702
|
};
|
|
13642
|
-
validation: {
|
|
13643
|
-
DocumentValidator: DocumentValidator;
|
|
13644
|
-
ValidationRegistry: ValidationRegistry;
|
|
13703
|
+
readonly validation: {
|
|
13704
|
+
readonly DocumentValidator: DocumentValidator;
|
|
13705
|
+
readonly ValidationRegistry: ValidationRegistry;
|
|
13645
13706
|
};
|
|
13646
|
-
workspace: {
|
|
13647
|
-
AstNodeLocator: AstNodeLocator;
|
|
13648
|
-
AstNodeDescriptionProvider: AstNodeDescriptionProvider;
|
|
13649
|
-
ReferenceDescriptionProvider: ReferenceDescriptionProvider;
|
|
13707
|
+
readonly workspace: {
|
|
13708
|
+
readonly AstNodeLocator: AstNodeLocator;
|
|
13709
|
+
readonly AstNodeDescriptionProvider: AstNodeDescriptionProvider;
|
|
13710
|
+
readonly ReferenceDescriptionProvider: ReferenceDescriptionProvider;
|
|
13650
13711
|
};
|
|
13651
|
-
shared: LangiumSharedCoreServices;
|
|
13712
|
+
readonly shared: LangiumSharedCoreServices;
|
|
13652
13713
|
};
|
|
13653
13714
|
/**
|
|
13654
13715
|
* The core set of services available for a language. These are either generated by `langium-cli`
|
|
@@ -13660,23 +13721,23 @@ type LangiumCoreServices = LangiumGeneratedCoreServices & LangiumDefaultCoreServ
|
|
|
13660
13721
|
* derived from the grammar definition.
|
|
13661
13722
|
*/
|
|
13662
13723
|
type LangiumGeneratedSharedCoreServices = {
|
|
13663
|
-
AstReflection: AstReflection;
|
|
13724
|
+
readonly AstReflection: AstReflection;
|
|
13664
13725
|
};
|
|
13665
13726
|
/**
|
|
13666
13727
|
* Core services shared between multiple languages where Langium provides default implementations.
|
|
13667
13728
|
*/
|
|
13668
13729
|
type LangiumDefaultSharedCoreServices = {
|
|
13669
|
-
ServiceRegistry: ServiceRegistry;
|
|
13670
|
-
workspace: {
|
|
13671
|
-
ConfigurationProvider: ConfigurationProvider;
|
|
13672
|
-
DocumentBuilder: DocumentBuilder;
|
|
13673
|
-
FileSystemProvider: FileSystemProvider;
|
|
13674
|
-
IndexManager: IndexManager;
|
|
13675
|
-
LangiumDocuments: LangiumDocuments;
|
|
13676
|
-
LangiumDocumentFactory: LangiumDocumentFactory;
|
|
13677
|
-
TextDocuments?: TextDocumentProvider;
|
|
13678
|
-
WorkspaceLock: WorkspaceLock;
|
|
13679
|
-
WorkspaceManager: WorkspaceManager;
|
|
13730
|
+
readonly ServiceRegistry: ServiceRegistry;
|
|
13731
|
+
readonly workspace: {
|
|
13732
|
+
readonly ConfigurationProvider: ConfigurationProvider;
|
|
13733
|
+
readonly DocumentBuilder: DocumentBuilder;
|
|
13734
|
+
readonly FileSystemProvider: FileSystemProvider;
|
|
13735
|
+
readonly IndexManager: IndexManager;
|
|
13736
|
+
readonly LangiumDocuments: LangiumDocuments;
|
|
13737
|
+
readonly LangiumDocumentFactory: LangiumDocumentFactory;
|
|
13738
|
+
readonly TextDocuments?: TextDocumentProvider;
|
|
13739
|
+
readonly WorkspaceLock: WorkspaceLock;
|
|
13740
|
+
readonly WorkspaceManager: WorkspaceManager;
|
|
13680
13741
|
};
|
|
13681
13742
|
};
|
|
13682
13743
|
/**
|
|
@@ -13897,23 +13958,6 @@ interface DiagnosticFeatureShape {
|
|
|
13897
13958
|
};
|
|
13898
13959
|
}
|
|
13899
13960
|
|
|
13900
|
-
/**
|
|
13901
|
-
* We should use a mapped type to create this from Connection.
|
|
13902
|
-
*/
|
|
13903
|
-
interface TextDocumentConnection {
|
|
13904
|
-
onDidOpenTextDocument(handler: NotificationHandler<DidOpenTextDocumentParams>): Disposable$1;
|
|
13905
|
-
onDidChangeTextDocument(handler: NotificationHandler<DidChangeTextDocumentParams>): Disposable$1;
|
|
13906
|
-
onDidCloseTextDocument(handler: NotificationHandler<DidCloseTextDocumentParams>): Disposable$1;
|
|
13907
|
-
onWillSaveTextDocument(handler: NotificationHandler<WillSaveTextDocumentParams>): Disposable$1;
|
|
13908
|
-
onWillSaveTextDocumentWaitUntil(handler: RequestHandler<WillSaveTextDocumentParams, TextEdit$1[] | undefined | null, void>): Disposable$1;
|
|
13909
|
-
onDidSaveTextDocument(handler: NotificationHandler<DidSaveTextDocumentParams>): Disposable$1;
|
|
13910
|
-
}
|
|
13911
|
-
interface TextDocumentsConfiguration<T extends {
|
|
13912
|
-
uri: DocumentUri$1;
|
|
13913
|
-
}> {
|
|
13914
|
-
create(uri: DocumentUri$1, languageId: string, version: number, content: string): T;
|
|
13915
|
-
update(document: T, changes: TextDocumentContentChangeEvent[], version: number): T;
|
|
13916
|
-
}
|
|
13917
13961
|
/**
|
|
13918
13962
|
* Event to signal changes to a text document.
|
|
13919
13963
|
*/
|
|
@@ -13936,96 +13980,6 @@ interface TextDocumentWillSaveEvent<T> {
|
|
|
13936
13980
|
*/
|
|
13937
13981
|
reason: TextDocumentSaveReason;
|
|
13938
13982
|
}
|
|
13939
|
-
/**
|
|
13940
|
-
* A manager for simple text documents. The manager requires at a minimum that
|
|
13941
|
-
* the server registered for the following text document sync events in the
|
|
13942
|
-
* initialize handler or via dynamic registration:
|
|
13943
|
-
*
|
|
13944
|
-
* - open and close events.
|
|
13945
|
-
* - change events.
|
|
13946
|
-
*
|
|
13947
|
-
* Registering for save and will save events is optional.
|
|
13948
|
-
*/
|
|
13949
|
-
declare class TextDocuments<T extends {
|
|
13950
|
-
uri: DocumentUri$1;
|
|
13951
|
-
}> {
|
|
13952
|
-
private readonly _configuration;
|
|
13953
|
-
private readonly _syncedDocuments;
|
|
13954
|
-
private readonly _onDidChangeContent;
|
|
13955
|
-
private readonly _onDidOpen;
|
|
13956
|
-
private readonly _onDidClose;
|
|
13957
|
-
private readonly _onDidSave;
|
|
13958
|
-
private readonly _onWillSave;
|
|
13959
|
-
private _willSaveWaitUntil;
|
|
13960
|
-
/**
|
|
13961
|
-
* Create a new text document manager.
|
|
13962
|
-
*/
|
|
13963
|
-
constructor(configuration: TextDocumentsConfiguration<T>);
|
|
13964
|
-
/**
|
|
13965
|
-
* An event that fires when a text document managed by this manager
|
|
13966
|
-
* has been opened.
|
|
13967
|
-
*/
|
|
13968
|
-
get onDidOpen(): Event<TextDocumentChangeEvent<T>>;
|
|
13969
|
-
/**
|
|
13970
|
-
* An event that fires when a text document managed by this manager
|
|
13971
|
-
* has been opened or the content changes.
|
|
13972
|
-
*/
|
|
13973
|
-
get onDidChangeContent(): Event<TextDocumentChangeEvent<T>>;
|
|
13974
|
-
/**
|
|
13975
|
-
* An event that fires when a text document managed by this manager
|
|
13976
|
-
* will be saved.
|
|
13977
|
-
*/
|
|
13978
|
-
get onWillSave(): Event<TextDocumentWillSaveEvent<T>>;
|
|
13979
|
-
/**
|
|
13980
|
-
* Sets a handler that will be called if a participant wants to provide
|
|
13981
|
-
* edits during a text document save.
|
|
13982
|
-
*/
|
|
13983
|
-
onWillSaveWaitUntil(handler: RequestHandler<TextDocumentWillSaveEvent<T>, TextEdit$1[], void>): void;
|
|
13984
|
-
/**
|
|
13985
|
-
* An event that fires when a text document managed by this manager
|
|
13986
|
-
* has been saved.
|
|
13987
|
-
*/
|
|
13988
|
-
get onDidSave(): Event<TextDocumentChangeEvent<T>>;
|
|
13989
|
-
/**
|
|
13990
|
-
* An event that fires when a text document managed by this manager
|
|
13991
|
-
* has been closed.
|
|
13992
|
-
*/
|
|
13993
|
-
get onDidClose(): Event<TextDocumentChangeEvent<T>>;
|
|
13994
|
-
/**
|
|
13995
|
-
* Returns the document for the given URI. Returns undefined if
|
|
13996
|
-
* the document is not managed by this instance.
|
|
13997
|
-
*
|
|
13998
|
-
* @param uri The text document's URI to retrieve.
|
|
13999
|
-
* @return the text document or `undefined`.
|
|
14000
|
-
*/
|
|
14001
|
-
get(uri: string): T | undefined;
|
|
14002
|
-
/**
|
|
14003
|
-
* Returns all text documents managed by this instance.
|
|
14004
|
-
*
|
|
14005
|
-
* @return all text documents.
|
|
14006
|
-
*/
|
|
14007
|
-
all(): T[];
|
|
14008
|
-
/**
|
|
14009
|
-
* Returns the URIs of all text documents managed by this instance.
|
|
14010
|
-
*
|
|
14011
|
-
* @return the URI's of all text documents.
|
|
14012
|
-
*/
|
|
14013
|
-
keys(): string[];
|
|
14014
|
-
/**
|
|
14015
|
-
* Listens for `low level` notification on the given connection to
|
|
14016
|
-
* update the text documents managed by this instance.
|
|
14017
|
-
*
|
|
14018
|
-
* Please note that the connection only provides handlers not an event model. Therefore
|
|
14019
|
-
* listening on a connection will overwrite the following handlers on a connection:
|
|
14020
|
-
* `onDidOpenTextDocument`, `onDidChangeTextDocument`, `onDidCloseTextDocument`,
|
|
14021
|
-
* `onWillSaveTextDocument`, `onWillSaveTextDocumentWaitUntil` and `onDidSaveTextDocument`.
|
|
14022
|
-
*
|
|
14023
|
-
* Use the corresponding events on the TextDocuments instance instead.
|
|
14024
|
-
*
|
|
14025
|
-
* @param connection The connection to listen on.
|
|
14026
|
-
*/
|
|
14027
|
-
listen(connection: TextDocumentConnection): Disposable$1;
|
|
14028
|
-
}
|
|
14029
13983
|
|
|
14030
13984
|
/**
|
|
14031
13985
|
* Shape of the notebooks feature
|
|
@@ -14819,6 +14773,11 @@ interface DefinitionProvider {
|
|
|
14819
14773
|
/**
|
|
14820
14774
|
* Handle a go to definition request.
|
|
14821
14775
|
*
|
|
14776
|
+
* @param document The document in which the request was triggered.
|
|
14777
|
+
* @param params The parameters of the request.
|
|
14778
|
+
* @param cancelToken A cancellation token that can be used to cancel the request.
|
|
14779
|
+
* @returns A list of location links to the definition(s) of the symbol at the given position.
|
|
14780
|
+
*
|
|
14822
14781
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
14823
14782
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
14824
14783
|
*/
|
|
@@ -14838,6 +14797,10 @@ interface DocumentHighlightProvider {
|
|
|
14838
14797
|
/**
|
|
14839
14798
|
* Handle a document highlight request.
|
|
14840
14799
|
*
|
|
14800
|
+
* @param document The document in which the request was received.
|
|
14801
|
+
* @param params The parameters of the document highlight request.
|
|
14802
|
+
* @param cancelToken A cancellation token that can be used to cancel the request.
|
|
14803
|
+
* @returns The document highlights or `undefined` if no highlights are available.
|
|
14841
14804
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
14842
14805
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
14843
14806
|
*/
|
|
@@ -14848,7 +14811,7 @@ declare class DefaultDocumentHighlightProvider implements DocumentHighlightProvi
|
|
|
14848
14811
|
protected readonly nameProvider: NameProvider;
|
|
14849
14812
|
protected readonly grammarConfig: GrammarConfig;
|
|
14850
14813
|
constructor(services: LangiumServices);
|
|
14851
|
-
getDocumentHighlight(document: LangiumDocument, params: DocumentHighlightParams): MaybePromise<DocumentHighlight[] | undefined>;
|
|
14814
|
+
getDocumentHighlight(document: LangiumDocument, params: DocumentHighlightParams, _cancelToken?: CancellationToken): MaybePromise<DocumentHighlight[] | undefined>;
|
|
14852
14815
|
/**
|
|
14853
14816
|
* Override this method to determine the highlight kind of the given reference.
|
|
14854
14817
|
*/
|
|
@@ -14911,6 +14874,11 @@ interface DocumentSymbolProvider {
|
|
|
14911
14874
|
/**
|
|
14912
14875
|
* Handle a document symbols request.
|
|
14913
14876
|
*
|
|
14877
|
+
* @param document The document in the workspace.
|
|
14878
|
+
* @param params The parameters of the request.
|
|
14879
|
+
* @param cancelToken A cancellation token that migh be used to cancel the request.
|
|
14880
|
+
* @returns The symbols for the given document.
|
|
14881
|
+
*
|
|
14914
14882
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
14915
14883
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
14916
14884
|
*/
|
|
@@ -14927,17 +14895,40 @@ interface DocumentSymbolProvider {
|
|
|
14927
14895
|
* Shared service for handling text document changes and watching relevant files.
|
|
14928
14896
|
*/
|
|
14929
14897
|
interface DocumentUpdateHandler {
|
|
14898
|
+
/**
|
|
14899
|
+
* A document open event was triggered by the `TextDocuments` service.
|
|
14900
|
+
* @param event The document change event.
|
|
14901
|
+
*/
|
|
14930
14902
|
didOpenDocument?(event: TextDocumentChangeEvent<TextDocument>): void;
|
|
14931
14903
|
/**
|
|
14932
14904
|
* A content change event was triggered by the `TextDocuments` service.
|
|
14905
|
+
* @param event The document change event.
|
|
14933
14906
|
*/
|
|
14934
14907
|
didChangeContent?(event: TextDocumentChangeEvent<TextDocument>): void;
|
|
14908
|
+
/**
|
|
14909
|
+
* A document save event (initiated) was triggered by the `TextDocuments` service.
|
|
14910
|
+
* @param event The document change event.
|
|
14911
|
+
*/
|
|
14935
14912
|
willSaveDocument?(event: TextDocumentWillSaveEvent<TextDocument>): void;
|
|
14913
|
+
/**
|
|
14914
|
+
* A document save event (initiated) was triggered by the `TextDocuments` service.
|
|
14915
|
+
* @param event The document change event.
|
|
14916
|
+
* @returns An array of text edits which will be applied to the document before it is saved.
|
|
14917
|
+
*/
|
|
14936
14918
|
willSaveDocumentWaitUntil?(event: TextDocumentWillSaveEvent<TextDocument>): MaybePromise<TextEdit$1[]>;
|
|
14919
|
+
/**
|
|
14920
|
+
* A document save event (completed) was triggered by the `TextDocuments` service.
|
|
14921
|
+
* @param event The document change event.
|
|
14922
|
+
*/
|
|
14937
14923
|
didSaveDocument?(event: TextDocumentChangeEvent<TextDocument>): void;
|
|
14924
|
+
/**
|
|
14925
|
+
* A document close event was triggered by the `TextDocuments` service.
|
|
14926
|
+
* @param event The document change event.
|
|
14927
|
+
*/
|
|
14938
14928
|
didCloseDocument?(event: TextDocumentChangeEvent<TextDocument>): void;
|
|
14939
14929
|
/**
|
|
14940
14930
|
* The client detected changes to files and folders watched by the language client.
|
|
14931
|
+
* @param params The files/folders change event.
|
|
14941
14932
|
*/
|
|
14942
14933
|
didChangeWatchedFiles?(params: DidChangeWatchedFilesParams): void;
|
|
14943
14934
|
}
|
|
@@ -15019,6 +15010,11 @@ interface FoldingRangeProvider {
|
|
|
15019
15010
|
/**
|
|
15020
15011
|
* Handle a folding range request.
|
|
15021
15012
|
*
|
|
15013
|
+
* @param document The document to compute folding ranges for
|
|
15014
|
+
* @param params The folding range parameters
|
|
15015
|
+
* @param cancelToken A cancellation token that can be used to cancel the request
|
|
15016
|
+
* @returns The computed folding ranges
|
|
15017
|
+
*
|
|
15022
15018
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
15023
15019
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
15024
15020
|
*/
|
|
@@ -15163,6 +15159,11 @@ interface ReferencesProvider {
|
|
|
15163
15159
|
/**
|
|
15164
15160
|
* Handle a find references request.
|
|
15165
15161
|
*
|
|
15162
|
+
* @param document The document in which to search for references.
|
|
15163
|
+
* @param params The parameters of the find references request.
|
|
15164
|
+
* @param cancelToken A cancellation token that can be used to cancel the request.
|
|
15165
|
+
* @returns The locations of the references.
|
|
15166
|
+
*
|
|
15166
15167
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
15167
15168
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
15168
15169
|
*/
|
|
@@ -15182,6 +15183,11 @@ interface RenameProvider {
|
|
|
15182
15183
|
/**
|
|
15183
15184
|
* Handle a rename request.
|
|
15184
15185
|
*
|
|
15186
|
+
* @param document The document in which the rename request was triggered.
|
|
15187
|
+
* @param params The rename parameters.
|
|
15188
|
+
* @param cancelToken A cancellation token that can be used to cancel the request.
|
|
15189
|
+
* @returns A workspace edit that describes the changes to be applied to the workspace.
|
|
15190
|
+
*
|
|
15185
15191
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
15186
15192
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
15187
15193
|
*/
|
|
@@ -15189,6 +15195,11 @@ interface RenameProvider {
|
|
|
15189
15195
|
/**
|
|
15190
15196
|
* Handle a prepare rename request.
|
|
15191
15197
|
*
|
|
15198
|
+
* @param document The document in which the prepare rename request was triggered.
|
|
15199
|
+
* @param params The prepare rename parameters.
|
|
15200
|
+
* @param cancelToken A cancellation token that can be used to cancel the request.
|
|
15201
|
+
* @returns A range that describes the range of the symbol to be renamed.
|
|
15202
|
+
*
|
|
15192
15203
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
15193
15204
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
15194
15205
|
*/
|
|
@@ -15205,6 +15216,9 @@ interface SemanticTokenProvider {
|
|
|
15205
15216
|
semanticHighlight(document: LangiumDocument, params: SemanticTokensParams, cancelToken?: CancellationToken): MaybePromise<SemanticTokens>;
|
|
15206
15217
|
semanticHighlightRange(document: LangiumDocument, params: SemanticTokensRangeParams, cancelToken?: CancellationToken): MaybePromise<SemanticTokens>;
|
|
15207
15218
|
semanticHighlightDelta(document: LangiumDocument, params: SemanticTokensDeltaParams, cancelToken?: CancellationToken): MaybePromise<SemanticTokens | SemanticTokensDelta>;
|
|
15219
|
+
readonly tokenTypes: Record<string, number>;
|
|
15220
|
+
readonly tokenModifiers: Record<string, number>;
|
|
15221
|
+
readonly semanticTokensOptions: SemanticTokensOptions;
|
|
15208
15222
|
}
|
|
15209
15223
|
type SemanticTokenAcceptorOptions<N extends AstNode = AstNode> = ({
|
|
15210
15224
|
line: number;
|
|
@@ -15280,6 +15294,9 @@ declare abstract class AbstractSemanticTokenProvider implements SemanticTokenPro
|
|
|
15280
15294
|
protected clientCapabilities?: SemanticTokensClientCapabilities;
|
|
15281
15295
|
constructor(services: LangiumServices);
|
|
15282
15296
|
initialize(clientCapabilities?: SemanticTokensClientCapabilities): void;
|
|
15297
|
+
get tokenTypes(): Record<string, number>;
|
|
15298
|
+
get tokenModifiers(): Record<string, number>;
|
|
15299
|
+
get semanticTokensOptions(): SemanticTokensOptions;
|
|
15283
15300
|
semanticHighlight(document: LangiumDocument, _params: SemanticTokensParams, cancelToken?: CancellationToken): Promise<SemanticTokens>;
|
|
15284
15301
|
semanticHighlightRange(document: LangiumDocument, params: SemanticTokensRangeParams, cancelToken?: CancellationToken): Promise<SemanticTokens>;
|
|
15285
15302
|
semanticHighlightDelta(document: LangiumDocument, params: SemanticTokensDeltaParams, cancelToken?: CancellationToken): Promise<SemanticTokens | SemanticTokensDelta>;
|
|
@@ -15360,6 +15377,10 @@ interface WorkspaceSymbolProvider$1 {
|
|
|
15360
15377
|
/**
|
|
15361
15378
|
* Handle a workspace symbols request.
|
|
15362
15379
|
*
|
|
15380
|
+
* @param params workspaces symbols request parameters
|
|
15381
|
+
* @param cancelToken a cancellation token tha can be used to cancel the request
|
|
15382
|
+
* @returns a list of workspace symbols
|
|
15383
|
+
*
|
|
15363
15384
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
15364
15385
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
15365
15386
|
*/
|
|
@@ -15367,6 +15388,10 @@ interface WorkspaceSymbolProvider$1 {
|
|
|
15367
15388
|
/**
|
|
15368
15389
|
* Handle a resolve request for a workspace symbol.
|
|
15369
15390
|
*
|
|
15391
|
+
* @param symbol the workspace symbol to resolve
|
|
15392
|
+
* @param cancelToken a cancellation token tha can be used to cancel the request
|
|
15393
|
+
* @returns the resolved workspace symbol
|
|
15394
|
+
*
|
|
15370
15395
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
15371
15396
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
15372
15397
|
*/
|
|
@@ -15381,6 +15406,96 @@ declare class DefaultWorkspaceSymbolProvider implements WorkspaceSymbolProvider$
|
|
|
15381
15406
|
protected getWorkspaceSymbol(astDescription: AstNodeDescription): WorkspaceSymbol | undefined;
|
|
15382
15407
|
}
|
|
15383
15408
|
|
|
15409
|
+
/******************************************************************************
|
|
15410
|
+
* Copyright 2024 TypeFox GmbH
|
|
15411
|
+
* This program and the accompanying materials are made available under the
|
|
15412
|
+
* terms of the MIT License, which is available in the project root.
|
|
15413
|
+
******************************************************************************/
|
|
15414
|
+
|
|
15415
|
+
/**
|
|
15416
|
+
* A manager service that keeps track of all currently opened text documents.
|
|
15417
|
+
*
|
|
15418
|
+
* Designed to be compatible with the `TextDocuments` class in the `vscode-languageserver` package.
|
|
15419
|
+
*/
|
|
15420
|
+
interface TextDocuments<T extends {
|
|
15421
|
+
uri: string;
|
|
15422
|
+
}> {
|
|
15423
|
+
/**
|
|
15424
|
+
* An event that fires when a text document managed by this manager
|
|
15425
|
+
* has been opened.
|
|
15426
|
+
*/
|
|
15427
|
+
readonly onDidOpen: Event<TextDocumentChangeEvent<T>>;
|
|
15428
|
+
/**
|
|
15429
|
+
* An event that fires when a text document managed by this manager
|
|
15430
|
+
* has been opened or the content changes.
|
|
15431
|
+
*/
|
|
15432
|
+
readonly onDidChangeContent: Event<TextDocumentChangeEvent<T>>;
|
|
15433
|
+
/**
|
|
15434
|
+
* An event that fires when a text document managed by this manager
|
|
15435
|
+
* will be saved.
|
|
15436
|
+
*/
|
|
15437
|
+
readonly onWillSave: Event<TextDocumentWillSaveEvent<T>>;
|
|
15438
|
+
/**
|
|
15439
|
+
* Sets a handler that will be called if a participant wants to provide
|
|
15440
|
+
* edits during a text document save.
|
|
15441
|
+
*/
|
|
15442
|
+
onWillSaveWaitUntil(handler: RequestHandler<TextDocumentWillSaveEvent<T>, TextEdit$1[], void>): void;
|
|
15443
|
+
/**
|
|
15444
|
+
* An event that fires when a text document managed by this manager
|
|
15445
|
+
* has been saved.
|
|
15446
|
+
*/
|
|
15447
|
+
readonly onDidSave: Event<TextDocumentChangeEvent<T>>;
|
|
15448
|
+
/**
|
|
15449
|
+
* An event that fires when a text document managed by this manager
|
|
15450
|
+
* has been closed.
|
|
15451
|
+
*/
|
|
15452
|
+
readonly onDidClose: Event<TextDocumentChangeEvent<T>>;
|
|
15453
|
+
/**
|
|
15454
|
+
* Returns the document for the given URI. Returns undefined if
|
|
15455
|
+
* the document is not managed by this instance.
|
|
15456
|
+
*
|
|
15457
|
+
* @param uri The text document's URI to retrieve.
|
|
15458
|
+
* @return the text document or `undefined`.
|
|
15459
|
+
*/
|
|
15460
|
+
get(uri: string | URI): T | undefined;
|
|
15461
|
+
/**
|
|
15462
|
+
* Sets the text document managed by this instance.
|
|
15463
|
+
* @param document The text document to add.
|
|
15464
|
+
* @returns `true` if the document didn't exist yet, `false` if it was already present.
|
|
15465
|
+
*/
|
|
15466
|
+
set(document: T): boolean;
|
|
15467
|
+
/**
|
|
15468
|
+
* Deletes a text document managed by this instance.
|
|
15469
|
+
*/
|
|
15470
|
+
delete(uri: string | URI | T): void;
|
|
15471
|
+
/**
|
|
15472
|
+
* Returns all text documents managed by this instance.
|
|
15473
|
+
*
|
|
15474
|
+
* @return all text documents.
|
|
15475
|
+
*/
|
|
15476
|
+
all(): T[];
|
|
15477
|
+
/**
|
|
15478
|
+
* Returns the URIs of all text documents managed by this instance.
|
|
15479
|
+
*
|
|
15480
|
+
* @return the URI's of all text documents.
|
|
15481
|
+
*/
|
|
15482
|
+
keys(): string[];
|
|
15483
|
+
/**
|
|
15484
|
+
* Listens for `low level` notification on the given connection to
|
|
15485
|
+
* update the text documents managed by this instance.
|
|
15486
|
+
*
|
|
15487
|
+
* Please note that the connection only provides handlers not an event model. Therefore
|
|
15488
|
+
* listening on a connection will overwrite the following handlers on a connection:
|
|
15489
|
+
* `onDidOpenTextDocument`, `onDidChangeTextDocument`, `onDidCloseTextDocument`,
|
|
15490
|
+
* `onWillSaveTextDocument`, `onWillSaveTextDocumentWaitUntil` and `onDidSaveTextDocument`.
|
|
15491
|
+
*
|
|
15492
|
+
* Use the corresponding events on the TextDocuments instance instead.
|
|
15493
|
+
*
|
|
15494
|
+
* @param connection The connection to listen on.
|
|
15495
|
+
*/
|
|
15496
|
+
listen(connection: Connection): Disposable$1;
|
|
15497
|
+
}
|
|
15498
|
+
|
|
15384
15499
|
/******************************************************************************
|
|
15385
15500
|
* Copyright 2023 TypeFox GmbH
|
|
15386
15501
|
* This program and the accompanying materials are made available under the
|
|
@@ -15399,46 +15514,46 @@ type LangiumSharedServices = LangiumSharedCoreServices & LangiumSharedLSPService
|
|
|
15399
15514
|
* LSP services for a specific language of which Langium provides default implementations.
|
|
15400
15515
|
*/
|
|
15401
15516
|
type LangiumLSPServices = {
|
|
15402
|
-
lsp: {
|
|
15403
|
-
CompletionProvider?: CompletionProvider;
|
|
15404
|
-
DocumentHighlightProvider?: DocumentHighlightProvider;
|
|
15405
|
-
DocumentSymbolProvider?: DocumentSymbolProvider;
|
|
15406
|
-
HoverProvider?: HoverProvider;
|
|
15407
|
-
FoldingRangeProvider?: FoldingRangeProvider;
|
|
15408
|
-
DefinitionProvider?: DefinitionProvider;
|
|
15409
|
-
TypeProvider?: TypeDefinitionProvider;
|
|
15410
|
-
ImplementationProvider?: ImplementationProvider;
|
|
15411
|
-
ReferencesProvider?: ReferencesProvider;
|
|
15412
|
-
CodeActionProvider?: CodeActionProvider;
|
|
15413
|
-
SemanticTokenProvider?: SemanticTokenProvider;
|
|
15414
|
-
RenameProvider?: RenameProvider;
|
|
15415
|
-
Formatter?: Formatter;
|
|
15416
|
-
SignatureHelp?: SignatureHelpProvider;
|
|
15417
|
-
CallHierarchyProvider?: CallHierarchyProvider;
|
|
15418
|
-
TypeHierarchyProvider?: TypeHierarchyProvider;
|
|
15419
|
-
DeclarationProvider?: DeclarationProvider;
|
|
15420
|
-
InlayHintProvider?: InlayHintProvider;
|
|
15421
|
-
CodeLensProvider?: CodeLensProvider;
|
|
15422
|
-
DocumentLinkProvider?: DocumentLinkProvider;
|
|
15517
|
+
readonly lsp: {
|
|
15518
|
+
readonly CompletionProvider?: CompletionProvider;
|
|
15519
|
+
readonly DocumentHighlightProvider?: DocumentHighlightProvider;
|
|
15520
|
+
readonly DocumentSymbolProvider?: DocumentSymbolProvider;
|
|
15521
|
+
readonly HoverProvider?: HoverProvider;
|
|
15522
|
+
readonly FoldingRangeProvider?: FoldingRangeProvider;
|
|
15523
|
+
readonly DefinitionProvider?: DefinitionProvider;
|
|
15524
|
+
readonly TypeProvider?: TypeDefinitionProvider;
|
|
15525
|
+
readonly ImplementationProvider?: ImplementationProvider;
|
|
15526
|
+
readonly ReferencesProvider?: ReferencesProvider;
|
|
15527
|
+
readonly CodeActionProvider?: CodeActionProvider;
|
|
15528
|
+
readonly SemanticTokenProvider?: SemanticTokenProvider;
|
|
15529
|
+
readonly RenameProvider?: RenameProvider;
|
|
15530
|
+
readonly Formatter?: Formatter;
|
|
15531
|
+
readonly SignatureHelp?: SignatureHelpProvider;
|
|
15532
|
+
readonly CallHierarchyProvider?: CallHierarchyProvider;
|
|
15533
|
+
readonly TypeHierarchyProvider?: TypeHierarchyProvider;
|
|
15534
|
+
readonly DeclarationProvider?: DeclarationProvider;
|
|
15535
|
+
readonly InlayHintProvider?: InlayHintProvider;
|
|
15536
|
+
readonly CodeLensProvider?: CodeLensProvider;
|
|
15537
|
+
readonly DocumentLinkProvider?: DocumentLinkProvider;
|
|
15423
15538
|
};
|
|
15424
|
-
shared: LangiumSharedServices;
|
|
15539
|
+
readonly shared: LangiumSharedServices;
|
|
15425
15540
|
};
|
|
15426
15541
|
/**
|
|
15427
15542
|
* LSP services shared between multiple languages of which Langium provides default implementations.
|
|
15428
15543
|
*/
|
|
15429
15544
|
type LangiumSharedLSPServices = {
|
|
15430
|
-
lsp: {
|
|
15431
|
-
Connection?: Connection;
|
|
15432
|
-
DocumentUpdateHandler: DocumentUpdateHandler;
|
|
15433
|
-
ExecuteCommandHandler?: ExecuteCommandHandler;
|
|
15434
|
-
FileOperationHandler?: FileOperationHandler;
|
|
15435
|
-
FuzzyMatcher: FuzzyMatcher;
|
|
15436
|
-
LanguageServer: LanguageServer;
|
|
15437
|
-
NodeKindProvider: NodeKindProvider$1;
|
|
15438
|
-
WorkspaceSymbolProvider?: WorkspaceSymbolProvider$1;
|
|
15545
|
+
readonly lsp: {
|
|
15546
|
+
readonly Connection?: Connection;
|
|
15547
|
+
readonly DocumentUpdateHandler: DocumentUpdateHandler;
|
|
15548
|
+
readonly ExecuteCommandHandler?: ExecuteCommandHandler;
|
|
15549
|
+
readonly FileOperationHandler?: FileOperationHandler;
|
|
15550
|
+
readonly FuzzyMatcher: FuzzyMatcher;
|
|
15551
|
+
readonly LanguageServer: LanguageServer;
|
|
15552
|
+
readonly NodeKindProvider: NodeKindProvider$1;
|
|
15553
|
+
readonly WorkspaceSymbolProvider?: WorkspaceSymbolProvider$1;
|
|
15439
15554
|
};
|
|
15440
|
-
workspace: {
|
|
15441
|
-
TextDocuments: TextDocuments<TextDocument>;
|
|
15555
|
+
readonly workspace: {
|
|
15556
|
+
readonly TextDocuments: TextDocuments<TextDocument>;
|
|
15442
15557
|
};
|
|
15443
15558
|
};
|
|
15444
15559
|
|
|
@@ -15533,6 +15648,10 @@ interface CompletionProvider {
|
|
|
15533
15648
|
/**
|
|
15534
15649
|
* Handle a completion request.
|
|
15535
15650
|
*
|
|
15651
|
+
* @param document - the document for which the completion request was triggered
|
|
15652
|
+
* @param params - the completion parameters
|
|
15653
|
+
* @param cancelToken - a token that can be used to cancel the request
|
|
15654
|
+
*
|
|
15536
15655
|
* @throws `OperationCancelled` if cancellation is detected during execution
|
|
15537
15656
|
* @throws `ResponseError` if an error is detected that should be sent as response to the client
|
|
15538
15657
|
*/
|
|
@@ -15555,8 +15674,9 @@ declare class DefaultCompletionProvider implements CompletionProvider {
|
|
|
15555
15674
|
protected readonly fuzzyMatcher: FuzzyMatcher;
|
|
15556
15675
|
protected readonly grammarConfig: GrammarConfig;
|
|
15557
15676
|
protected readonly astReflection: AstReflection;
|
|
15677
|
+
readonly completionOptions?: CompletionProviderOptions;
|
|
15558
15678
|
constructor(services: LangiumServices);
|
|
15559
|
-
getCompletion(document: LangiumDocument, params: CompletionParams): Promise<CompletionList | undefined>;
|
|
15679
|
+
getCompletion(document: LangiumDocument, params: CompletionParams, _cancelToken?: CancellationToken): Promise<CompletionList | undefined>;
|
|
15560
15680
|
/**
|
|
15561
15681
|
* The completion algorithm could yield the same reference/keyword multiple times.
|
|
15562
15682
|
*
|
|
@@ -15620,7 +15740,7 @@ interface ChangeViewRequestParams {
|
|
|
15620
15740
|
}
|
|
15621
15741
|
|
|
15622
15742
|
/******************************************************************************
|
|
15623
|
-
* This file was generated by langium-cli 3.
|
|
15743
|
+
* This file was generated by langium-cli 3.2.0.
|
|
15624
15744
|
* DO NOT EDIT MANUALLY!
|
|
15625
15745
|
******************************************************************************/
|
|
15626
15746
|
|