@effect/language-service 0.24.2 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/cli.js +747 -520
- package/cli.js.map +1 -1
- package/index.js +529 -308
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +360 -182
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -56,9 +56,9 @@ var dual = function(arity, body) {
|
|
|
56
56
|
if (arguments.length >= arity) {
|
|
57
57
|
return body.apply(this, arguments);
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const args2 = arguments;
|
|
60
60
|
return function(self) {
|
|
61
|
-
return body(self, ...
|
|
61
|
+
return body(self, ...args2);
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
}
|
|
@@ -144,7 +144,6 @@ var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue
|
|
|
144
144
|
|
|
145
145
|
// node_modules/.pnpm/effect@3.16.12/node_modules/effect/dist/esm/Utils.js
|
|
146
146
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
147
|
-
var isGenKind = (u) => isObject(u) && GenKindTypeId in u;
|
|
148
147
|
var GenKindImpl = class {
|
|
149
148
|
value;
|
|
150
149
|
constructor(value) {
|
|
@@ -477,32 +476,32 @@ var redact = (u) => {
|
|
|
477
476
|
};
|
|
478
477
|
|
|
479
478
|
// node_modules/.pnpm/effect@3.16.12/node_modules/effect/dist/esm/Pipeable.js
|
|
480
|
-
var pipeArguments = (self,
|
|
481
|
-
switch (
|
|
479
|
+
var pipeArguments = (self, args2) => {
|
|
480
|
+
switch (args2.length) {
|
|
482
481
|
case 0:
|
|
483
482
|
return self;
|
|
484
483
|
case 1:
|
|
485
|
-
return
|
|
484
|
+
return args2[0](self);
|
|
486
485
|
case 2:
|
|
487
|
-
return
|
|
486
|
+
return args2[1](args2[0](self));
|
|
488
487
|
case 3:
|
|
489
|
-
return
|
|
488
|
+
return args2[2](args2[1](args2[0](self)));
|
|
490
489
|
case 4:
|
|
491
|
-
return
|
|
490
|
+
return args2[3](args2[2](args2[1](args2[0](self))));
|
|
492
491
|
case 5:
|
|
493
|
-
return
|
|
492
|
+
return args2[4](args2[3](args2[2](args2[1](args2[0](self)))));
|
|
494
493
|
case 6:
|
|
495
|
-
return
|
|
494
|
+
return args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self))))));
|
|
496
495
|
case 7:
|
|
497
|
-
return
|
|
496
|
+
return args2[6](args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self)))))));
|
|
498
497
|
case 8:
|
|
499
|
-
return
|
|
498
|
+
return args2[7](args2[6](args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self))))))));
|
|
500
499
|
case 9:
|
|
501
|
-
return
|
|
500
|
+
return args2[8](args2[7](args2[6](args2[5](args2[4](args2[3](args2[2](args2[1](args2[0](self)))))))));
|
|
502
501
|
default: {
|
|
503
502
|
let ret = self;
|
|
504
|
-
for (let i = 0, len =
|
|
505
|
-
ret =
|
|
503
|
+
for (let i = 0, len = args2.length; i < len; i++) {
|
|
504
|
+
ret = args2[i](ret);
|
|
506
505
|
}
|
|
507
506
|
return ret;
|
|
508
507
|
}
|
|
@@ -834,181 +833,253 @@ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
|
834
833
|
var dedupe = (self) => dedupeWith(self, equivalence());
|
|
835
834
|
|
|
836
835
|
// src/core/Nano.ts
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
836
|
+
var NanoTag = class {
|
|
837
|
+
constructor(key) {
|
|
838
|
+
this.key = key;
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
var Tag = (identifier) => new NanoTag(identifier);
|
|
842
|
+
var evaluate = Symbol.for("Nano.evaluate");
|
|
843
|
+
var contA = Symbol.for("Nano.contA");
|
|
844
|
+
var contE = Symbol.for("Nano.contE");
|
|
845
|
+
var contAll = Symbol.for("Nano.contAll");
|
|
846
|
+
var NanoYield = Symbol.for("Nano.yield");
|
|
847
|
+
var args = Symbol.for("Nano.args");
|
|
843
848
|
var NanoDefectException = class {
|
|
844
849
|
constructor(message) {
|
|
845
850
|
this.message = message;
|
|
846
851
|
}
|
|
847
852
|
_tag = "@effect/language-service/NanoDefectException";
|
|
848
853
|
};
|
|
849
|
-
var
|
|
850
|
-
|
|
851
|
-
|
|
854
|
+
var PrimitiveProto = {
|
|
855
|
+
[Symbol.iterator]() {
|
|
856
|
+
return new SingleShotGen(new YieldWrap(this));
|
|
852
857
|
}
|
|
853
858
|
};
|
|
854
|
-
var
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
859
|
+
var SucceedProto = {
|
|
860
|
+
...PrimitiveProto,
|
|
861
|
+
_tag: "Success",
|
|
862
|
+
get value() {
|
|
863
|
+
return this[args];
|
|
864
|
+
},
|
|
865
|
+
[evaluate](fiber) {
|
|
866
|
+
const cont = fiber.getCont(contA);
|
|
867
|
+
return cont ? cont[contA](this[args], fiber) : fiber.yieldWith(this);
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
var succeed = (value) => {
|
|
871
|
+
const nano = Object.create(SucceedProto);
|
|
872
|
+
nano[args] = value;
|
|
863
873
|
return nano;
|
|
864
|
-
}
|
|
865
|
-
var
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
874
|
+
};
|
|
875
|
+
var FailureProto = {
|
|
876
|
+
...PrimitiveProto,
|
|
877
|
+
_tag: "Failure",
|
|
878
|
+
get value() {
|
|
879
|
+
return this[args];
|
|
880
|
+
},
|
|
881
|
+
[evaluate](fiber) {
|
|
882
|
+
const cont = fiber.getCont(contE);
|
|
883
|
+
return cont ? cont[contE](this[args], fiber) : fiber.yieldWith(this);
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
var fail = (error) => {
|
|
887
|
+
const nano = Object.create(FailureProto);
|
|
888
|
+
nano[args] = error;
|
|
889
|
+
return nano;
|
|
890
|
+
};
|
|
891
|
+
var SuspendProto = {
|
|
892
|
+
...PrimitiveProto,
|
|
893
|
+
[evaluate]() {
|
|
894
|
+
return this[args]();
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
var suspend = (fn2) => {
|
|
898
|
+
const nano = Object.create(SuspendProto);
|
|
899
|
+
nano[args] = fn2;
|
|
900
|
+
return nano;
|
|
901
|
+
};
|
|
902
|
+
var NanoFiber = class {
|
|
903
|
+
_stack = [];
|
|
904
|
+
_yielded = void 0;
|
|
905
|
+
_services = {};
|
|
906
|
+
runLoop(nano) {
|
|
907
|
+
let current = nano;
|
|
908
|
+
while (true) {
|
|
909
|
+
current = current[evaluate](this);
|
|
910
|
+
if (current === NanoYield) {
|
|
911
|
+
return this._yielded;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
getCont(symbol3) {
|
|
916
|
+
while (true) {
|
|
917
|
+
const op = this._stack.pop();
|
|
918
|
+
if (!op) return void 0;
|
|
919
|
+
const cont = op[contAll] && op[contAll](this);
|
|
920
|
+
if (cont) return { [symbol3]: cont };
|
|
921
|
+
if (op[symbol3]) return op;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
yieldWith(value) {
|
|
925
|
+
this._yielded = value;
|
|
926
|
+
return NanoYield;
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
var unsafeRun = (nano) => {
|
|
930
|
+
const fiber = new NanoFiber();
|
|
931
|
+
const result = fiber.runLoop(nano);
|
|
932
|
+
if (result._tag === "Success") {
|
|
933
|
+
return right2(result.value);
|
|
934
|
+
}
|
|
935
|
+
return left2(result.value);
|
|
936
|
+
};
|
|
937
|
+
var run = (nano) => {
|
|
878
938
|
try {
|
|
879
|
-
return unsafeRun(
|
|
939
|
+
return unsafeRun(nano);
|
|
880
940
|
} catch (e) {
|
|
881
941
|
return left2(new NanoDefectException(e));
|
|
882
942
|
}
|
|
883
943
|
};
|
|
884
|
-
var
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
944
|
+
var OnSuccessProto = {
|
|
945
|
+
...PrimitiveProto,
|
|
946
|
+
[evaluate](fiber) {
|
|
947
|
+
fiber._stack.push(this);
|
|
948
|
+
return this[args];
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
var flatMap2 = dual(2, (fa, f) => {
|
|
952
|
+
const nano = Object.create(OnSuccessProto);
|
|
953
|
+
nano[args] = fa;
|
|
954
|
+
nano[contA] = f;
|
|
955
|
+
return nano;
|
|
956
|
+
});
|
|
957
|
+
var map4 = dual(2, (fa, f) => flatMap2(fa, (_) => succeed(f(_))));
|
|
958
|
+
var SyncProto = {
|
|
959
|
+
...PrimitiveProto,
|
|
960
|
+
[evaluate](fiber) {
|
|
961
|
+
const value = this[args]();
|
|
962
|
+
const cont = fiber.getCont(contA);
|
|
963
|
+
return cont ? cont[contA](value, fiber) : fiber.yieldWith(succeed(value));
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
var sync = (f) => {
|
|
967
|
+
const nano = Object.create(SyncProto);
|
|
968
|
+
nano[args] = f;
|
|
891
969
|
return nano;
|
|
892
970
|
};
|
|
893
|
-
var
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
971
|
+
var void_ = succeed(void 0);
|
|
972
|
+
var FromIteratorProto = {
|
|
973
|
+
...PrimitiveProto,
|
|
974
|
+
[contA](value, fiber) {
|
|
975
|
+
const state = this[args][0].next(value);
|
|
976
|
+
if (state.done) return succeed(state.value);
|
|
977
|
+
fiber._stack.push(this);
|
|
978
|
+
return yieldWrapGet(state.value);
|
|
979
|
+
},
|
|
980
|
+
[evaluate](fiber) {
|
|
981
|
+
return this[contA](this[args][1], fiber);
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
var unsafeFromIterator = (iterator, initial) => {
|
|
985
|
+
const nano = Object.create(FromIteratorProto);
|
|
986
|
+
nano[args] = [iterator, initial];
|
|
900
987
|
return nano;
|
|
901
988
|
};
|
|
902
|
-
var
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
989
|
+
var gen = (...args2) => suspend(() => unsafeFromIterator(args2[0]()));
|
|
990
|
+
var fn = (_) => (body) => (...args2) => suspend(() => unsafeFromIterator(body(...args2)));
|
|
991
|
+
var MatchProto = {
|
|
992
|
+
...PrimitiveProto,
|
|
993
|
+
[evaluate](fiber) {
|
|
994
|
+
fiber._stack.push(this);
|
|
995
|
+
return this[args];
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
var match2 = (fa, opts) => {
|
|
999
|
+
const nano = Object.create(MatchProto);
|
|
1000
|
+
nano[args] = fa;
|
|
1001
|
+
nano[contA] = opts.onSuccess;
|
|
1002
|
+
nano[contE] = opts.onFailure;
|
|
1003
|
+
return nano;
|
|
1004
|
+
};
|
|
1005
|
+
var orElse2 = (f) => (fa) => {
|
|
1006
|
+
const nano = Object.create(MatchProto);
|
|
1007
|
+
nano[args] = fa;
|
|
1008
|
+
nano[contE] = f;
|
|
909
1009
|
return nano;
|
|
910
1010
|
};
|
|
911
|
-
var flatMap2 = dual(2, (fa, f) => make3((ctx) => {
|
|
912
|
-
const result = fa.run(ctx);
|
|
913
|
-
if (result._tag !== "Right") return result;
|
|
914
|
-
return f(result.value).run(ctx);
|
|
915
|
-
}));
|
|
916
|
-
var map4 = dual(2, (fa, f) => make3((ctx) => {
|
|
917
|
-
const result = fa.run(ctx);
|
|
918
|
-
if (result._tag !== "Right") return result;
|
|
919
|
-
return makeInternalSuccess(f(result.value));
|
|
920
|
-
}));
|
|
921
|
-
var orElse2 = (f) => (fa) => make3((ctx) => {
|
|
922
|
-
const result = fa.run(ctx);
|
|
923
|
-
if (result._tag === "Left") return f(result.value).run(ctx);
|
|
924
|
-
return result;
|
|
925
|
-
});
|
|
926
1011
|
var firstSuccessOf = (arr) => arr.slice(1).reduce((arr2, fa) => orElse2(() => fa)(arr2), arr[0]);
|
|
927
|
-
var
|
|
928
|
-
|
|
929
|
-
)
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
return result;
|
|
947
|
-
}
|
|
948
|
-
state = iterator.next(result.value);
|
|
1012
|
+
var ProvideServiceProto = {
|
|
1013
|
+
...PrimitiveProto,
|
|
1014
|
+
[evaluate](fiber) {
|
|
1015
|
+
const prevServices = fiber._services;
|
|
1016
|
+
const [fa, tag, value] = this[args];
|
|
1017
|
+
fiber._services = {
|
|
1018
|
+
...fiber._services,
|
|
1019
|
+
[tag.key]: value
|
|
1020
|
+
};
|
|
1021
|
+
return match2(fa, {
|
|
1022
|
+
onSuccess: (_) => {
|
|
1023
|
+
fiber._services = prevServices;
|
|
1024
|
+
return succeed(_);
|
|
1025
|
+
},
|
|
1026
|
+
onFailure: (_) => {
|
|
1027
|
+
fiber._services = prevServices;
|
|
1028
|
+
return fail(_);
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
949
1031
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1032
|
+
};
|
|
1033
|
+
var provideService = (tag, value) => (fa) => {
|
|
1034
|
+
const nano = Object.create(ProvideServiceProto);
|
|
1035
|
+
nano[args] = [fa, tag, value];
|
|
1036
|
+
return nano;
|
|
1037
|
+
};
|
|
1038
|
+
var ServiceProto = {
|
|
1039
|
+
...PrimitiveProto,
|
|
1040
|
+
[evaluate](fiber) {
|
|
1041
|
+
const tag = this[args];
|
|
1042
|
+
if (tag.key in fiber._services) {
|
|
1043
|
+
const value = fiber._services[tag.key];
|
|
1044
|
+
const cont2 = fiber.getCont(contA);
|
|
1045
|
+
return cont2 ? cont2[contA](value, fiber) : fiber.yieldWith(succeed(value));
|
|
960
1046
|
}
|
|
961
|
-
|
|
1047
|
+
const cont = fiber.getCont(contE);
|
|
1048
|
+
return cont ? cont[contE](tag, fiber) : fiber.yieldWith(fail(new NanoDefectException(`Service ${tag.key} not found`)));
|
|
962
1049
|
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1050
|
+
};
|
|
1051
|
+
var service = (tag) => {
|
|
1052
|
+
const nano = Object.create(ServiceProto);
|
|
1053
|
+
nano[args] = tag;
|
|
1054
|
+
return nano;
|
|
1055
|
+
};
|
|
1056
|
+
function cachedBy(fa, _key, _lookupKey) {
|
|
1057
|
+
return (...args2) => fa(...args2);
|
|
1058
|
+
}
|
|
1059
|
+
var option = (fa) => {
|
|
1060
|
+
const nano = Object.create(MatchProto);
|
|
1061
|
+
nano[args] = fa;
|
|
1062
|
+
nano[contA] = (_) => succeed(some2(_));
|
|
1063
|
+
nano[contE] = (_) => _ instanceof NanoDefectException ? fail(_) : succeed(none2());
|
|
1064
|
+
return nano;
|
|
1065
|
+
};
|
|
1066
|
+
var ignore = (fa) => {
|
|
1067
|
+
const nano = Object.create(MatchProto);
|
|
1068
|
+
nano[args] = fa;
|
|
1069
|
+
nano[contA] = (_) => void_;
|
|
1070
|
+
nano[contE] = (_) => _ instanceof NanoDefectException ? fail(_) : void_;
|
|
1071
|
+
return nano;
|
|
1072
|
+
};
|
|
1073
|
+
var all = fn("all")(
|
|
1074
|
+
function* (...args2) {
|
|
1075
|
+
const results = [];
|
|
1076
|
+
for (const fa of args2) {
|
|
1077
|
+
const result = yield* fa;
|
|
1078
|
+
results.push(result);
|
|
1079
|
+
}
|
|
1080
|
+
return results;
|
|
974
1081
|
}
|
|
975
|
-
});
|
|
976
|
-
var successUndefined = makeInternalSuccess(void 0);
|
|
977
|
-
var void_ = make3(() => successUndefined);
|
|
978
|
-
var ignore = (fa) => make3((ctx) => {
|
|
979
|
-
fa.run(ctx);
|
|
980
|
-
return successUndefined;
|
|
981
|
-
});
|
|
982
|
-
var all = (...args) => make3((ctx) => {
|
|
983
|
-
const results = [];
|
|
984
|
-
for (const arg of args) {
|
|
985
|
-
const result = arg.run(ctx);
|
|
986
|
-
if (result._tag !== "Right") return result;
|
|
987
|
-
results.push(result.value);
|
|
988
|
-
}
|
|
989
|
-
return makeInternalSuccess(results);
|
|
990
|
-
});
|
|
991
|
-
var internalNanoCache = Tag(
|
|
992
|
-
"@effect/language-service/internalNanoCache"
|
|
993
1082
|
);
|
|
994
|
-
function cachedBy(fa, key, lookupKey) {
|
|
995
|
-
return (...args) => make3((ctx) => {
|
|
996
|
-
const cacheObj = ctx.value[internalNanoCache.key];
|
|
997
|
-
let cache = cacheObj[key];
|
|
998
|
-
if (!cache) {
|
|
999
|
-
cache = /* @__PURE__ */ new Map();
|
|
1000
|
-
cacheObj[key] = cache;
|
|
1001
|
-
}
|
|
1002
|
-
const lookup = lookupKey(...args);
|
|
1003
|
-
const cached2 = cache.get(lookup);
|
|
1004
|
-
if (cached2 !== void 0) {
|
|
1005
|
-
return cached2;
|
|
1006
|
-
}
|
|
1007
|
-
const result = fa(...args).run(ctx);
|
|
1008
|
-
cache.set(lookup, result);
|
|
1009
|
-
return result;
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
1083
|
|
|
1013
1084
|
// src/core/TypeScriptApi.ts
|
|
1014
1085
|
var TypeScriptApi = Tag("TypeScriptApi");
|
|
@@ -1568,10 +1639,10 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1568
1639
|
const sectionOverrides = {};
|
|
1569
1640
|
const skippedRules = [];
|
|
1570
1641
|
const regex = /@effect-diagnostics(-next-line)?((?:\s[a-zA-Z0-9/]+:(?:off|warning|error|message|suggestion|skip-file))+)?/gm;
|
|
1571
|
-
let
|
|
1572
|
-
while ((
|
|
1573
|
-
const nextLineCaptureGroup =
|
|
1574
|
-
const rulesCaptureGroup =
|
|
1642
|
+
let match3;
|
|
1643
|
+
while ((match3 = regex.exec(sourceFile.text)) !== null) {
|
|
1644
|
+
const nextLineCaptureGroup = match3[1];
|
|
1645
|
+
const rulesCaptureGroup = match3[2];
|
|
1575
1646
|
if (rulesCaptureGroup) {
|
|
1576
1647
|
const trimmedRuleString = rulesCaptureGroup.trim();
|
|
1577
1648
|
if (trimmedRuleString) {
|
|
@@ -1583,7 +1654,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1583
1654
|
if (ruleLevel === "skip-file") skippedRules.push(ruleName);
|
|
1584
1655
|
const isOverrideNextLine = nextLineCaptureGroup && nextLineCaptureGroup.trim().toLowerCase() === "-next-line";
|
|
1585
1656
|
if (isOverrideNextLine) {
|
|
1586
|
-
const node = findNodeWithLeadingCommentAtPosition(
|
|
1657
|
+
const node = findNodeWithLeadingCommentAtPosition(match3.index);
|
|
1587
1658
|
if (node) {
|
|
1588
1659
|
lineOverrides[ruleName] = lineOverrides[ruleName] || [];
|
|
1589
1660
|
lineOverrides[ruleName].unshift({
|
|
@@ -1595,7 +1666,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1595
1666
|
} else {
|
|
1596
1667
|
sectionOverrides[ruleName] = sectionOverrides[ruleName] || [];
|
|
1597
1668
|
sectionOverrides[ruleName].unshift({
|
|
1598
|
-
pos:
|
|
1669
|
+
pos: match3.index,
|
|
1599
1670
|
level: ruleLevel
|
|
1600
1671
|
});
|
|
1601
1672
|
}
|
|
@@ -1725,93 +1796,6 @@ var contextSelfInClasses = createCompletion({
|
|
|
1725
1796
|
})
|
|
1726
1797
|
});
|
|
1727
1798
|
|
|
1728
|
-
// src/completions/effectDataClasses.ts
|
|
1729
|
-
var effectDataClasses = createCompletion({
|
|
1730
|
-
name: "effectDataClasses",
|
|
1731
|
-
apply: fn("effectDataClasses")(function* (sourceFile, position) {
|
|
1732
|
-
const ts = yield* service(TypeScriptApi);
|
|
1733
|
-
const maybeInfos = yield* option(
|
|
1734
|
-
parseDataForExtendsClassCompletion(sourceFile, position)
|
|
1735
|
-
);
|
|
1736
|
-
if (isNone2(maybeInfos)) return [];
|
|
1737
|
-
const { accessedObject, className, replacementSpan } = maybeInfos.value;
|
|
1738
|
-
const dataName = yield* option(
|
|
1739
|
-
findImportedModuleIdentifierByPackageAndNameOrBarrel(
|
|
1740
|
-
sourceFile,
|
|
1741
|
-
"effect",
|
|
1742
|
-
"Data"
|
|
1743
|
-
)
|
|
1744
|
-
);
|
|
1745
|
-
const effectDataIdentifier = match(dataName, {
|
|
1746
|
-
onNone: () => "Data",
|
|
1747
|
-
onSome: (_) => _.text
|
|
1748
|
-
});
|
|
1749
|
-
if (effectDataIdentifier !== accessedObject.text) return [];
|
|
1750
|
-
const name = className.text;
|
|
1751
|
-
return [{
|
|
1752
|
-
name: `TaggedError("${name}")`,
|
|
1753
|
-
kind: ts.ScriptElementKind.constElement,
|
|
1754
|
-
insertText: `${effectDataIdentifier}.TaggedError("${name}")<{${"${0}"}}>{}`,
|
|
1755
|
-
replacementSpan,
|
|
1756
|
-
isSnippet: true
|
|
1757
|
-
}, {
|
|
1758
|
-
name: `TaggedClass("${name}")`,
|
|
1759
|
-
kind: ts.ScriptElementKind.constElement,
|
|
1760
|
-
insertText: `${effectDataIdentifier}.TaggedClass("${name}")<{${"${0}"}}>{}`,
|
|
1761
|
-
replacementSpan,
|
|
1762
|
-
isSnippet: true
|
|
1763
|
-
}];
|
|
1764
|
-
})
|
|
1765
|
-
});
|
|
1766
|
-
|
|
1767
|
-
// src/diagnostics/duplicatePackage.ts
|
|
1768
|
-
var checkedPackagesCache = /* @__PURE__ */ new Map();
|
|
1769
|
-
var programResolvedCacheSize = /* @__PURE__ */ new Map();
|
|
1770
|
-
var duplicatePackage = createDiagnostic({
|
|
1771
|
-
name: "duplicatePackage",
|
|
1772
|
-
code: 6,
|
|
1773
|
-
severity: "warning",
|
|
1774
|
-
apply: fn("duplicatePackage.apply")(function* (sourceFile, report) {
|
|
1775
|
-
const program = yield* service(TypeScriptProgram);
|
|
1776
|
-
const options = yield* service(LanguageServicePluginOptions);
|
|
1777
|
-
if (sourceFile.statements.length < 1) return;
|
|
1778
|
-
let resolvedPackages = checkedPackagesCache.get(sourceFile.fileName) || {};
|
|
1779
|
-
const newResolvedModuleSize = hasProperty(program, "resolvedModules") && hasProperty(program.resolvedModules, "size") && isNumber(program.resolvedModules.size) ? program.resolvedModules.size : 0;
|
|
1780
|
-
const oldResolvedSize = programResolvedCacheSize.get(sourceFile.fileName) || -1;
|
|
1781
|
-
if (newResolvedModuleSize !== oldResolvedSize) {
|
|
1782
|
-
const seenPackages = /* @__PURE__ */ new Set();
|
|
1783
|
-
resolvedPackages = {};
|
|
1784
|
-
program.getSourceFiles().map((_) => {
|
|
1785
|
-
const packageInfo = parsePackageContentNameAndVersionFromScope(_);
|
|
1786
|
-
if (!packageInfo) return;
|
|
1787
|
-
const packageNameAndVersion = packageInfo.name + "@" + packageInfo.version;
|
|
1788
|
-
if (seenPackages.has(packageNameAndVersion)) return;
|
|
1789
|
-
seenPackages.add(packageNameAndVersion);
|
|
1790
|
-
if (!(packageInfo.name === "effect" || packageInfo.hasEffectInPeerDependencies)) return;
|
|
1791
|
-
if (options.allowedDuplicatedPackages.indexOf(packageInfo.name) > -1) return;
|
|
1792
|
-
resolvedPackages[packageInfo.name] = resolvedPackages[packageInfo.name] || {};
|
|
1793
|
-
resolvedPackages[packageInfo.name][packageInfo.version] = packageInfo.packageDirectory;
|
|
1794
|
-
});
|
|
1795
|
-
checkedPackagesCache.set(sourceFile.fileName, resolvedPackages);
|
|
1796
|
-
programResolvedCacheSize.set(sourceFile.fileName, newResolvedModuleSize);
|
|
1797
|
-
}
|
|
1798
|
-
for (const packageName of Object.keys(resolvedPackages)) {
|
|
1799
|
-
if (Object.keys(resolvedPackages[packageName]).length > 1) {
|
|
1800
|
-
const versions = Object.keys(resolvedPackages[packageName]);
|
|
1801
|
-
report({
|
|
1802
|
-
node: sourceFile.statements[0],
|
|
1803
|
-
messageText: `Package ${packageName} is referenced multiple times with different versions (${versions.join(", ")}) and may cause unexpected type errors.
|
|
1804
|
-
Cleanup your dependencies and your package lockfile to avoid multiple instances of this package and reload the project.
|
|
1805
|
-
If this is intended set the LSP config "allowedDuplicatedPackages" to ${JSON.stringify(options.allowedDuplicatedPackages.concat([packageName]))}.
|
|
1806
|
-
|
|
1807
|
-
${versions.map((version) => `- found ${version} at ${resolvedPackages[packageName][version]}`).join("\n")}`,
|
|
1808
|
-
fixes: []
|
|
1809
|
-
});
|
|
1810
|
-
}
|
|
1811
|
-
}
|
|
1812
|
-
})
|
|
1813
|
-
});
|
|
1814
|
-
|
|
1815
1799
|
// src/core/TypeCheckerApi.ts
|
|
1816
1800
|
var TypeCheckerApi = Tag("TypeChecker");
|
|
1817
1801
|
var TypeCheckerApiCache = Tag("TypeCheckerApiCache");
|
|
@@ -2018,6 +2002,19 @@ var expectedAndRealType = fn("TypeCheckerApi.expectedAndRealType")(function* (so
|
|
|
2018
2002
|
cache.expectedAndRealType.set(sourceFile, result);
|
|
2019
2003
|
return result;
|
|
2020
2004
|
});
|
|
2005
|
+
var unrollUnionMembers = (type) => {
|
|
2006
|
+
const result = [];
|
|
2007
|
+
let toTest = [type];
|
|
2008
|
+
while (toTest.length > 0) {
|
|
2009
|
+
const type2 = toTest.pop();
|
|
2010
|
+
if (type2.isUnion()) {
|
|
2011
|
+
toTest = toTest.concat(type2.types);
|
|
2012
|
+
} else {
|
|
2013
|
+
result.push(type2);
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
return result;
|
|
2017
|
+
};
|
|
2021
2018
|
var appendToUniqueTypesMap = fn(
|
|
2022
2019
|
"TypeCheckerApi.appendToUniqueTypesMap"
|
|
2023
2020
|
)(
|
|
@@ -2073,16 +2070,145 @@ function makeResolveExternalModuleName(typeChecker) {
|
|
|
2073
2070
|
};
|
|
2074
2071
|
}
|
|
2075
2072
|
|
|
2073
|
+
// src/completions/durationInput.ts
|
|
2074
|
+
var durationInput = createCompletion({
|
|
2075
|
+
name: "durationInput",
|
|
2076
|
+
apply: fn("durationInput")(function* (sourceFile, position) {
|
|
2077
|
+
const ts = yield* service(TypeScriptApi);
|
|
2078
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
2079
|
+
let isInString = false;
|
|
2080
|
+
const previousToken = ts.findPrecedingToken(position, sourceFile);
|
|
2081
|
+
if (previousToken && ts.isStringTextContainingNode(previousToken)) {
|
|
2082
|
+
const start = previousToken.getStart(sourceFile);
|
|
2083
|
+
const end = previousToken.getEnd();
|
|
2084
|
+
if (start < position && position < end) {
|
|
2085
|
+
isInString = true;
|
|
2086
|
+
}
|
|
2087
|
+
if (position === end) {
|
|
2088
|
+
isInString = !!previousToken.isUnterminated;
|
|
2089
|
+
}
|
|
2090
|
+
if (isInString && ts.isExpression(previousToken)) {
|
|
2091
|
+
const type = typeChecker.getContextualType(previousToken);
|
|
2092
|
+
if (type) {
|
|
2093
|
+
if (!type.isUnion()) return [];
|
|
2094
|
+
for (const member of type.types) {
|
|
2095
|
+
if (member.flags & ts.TypeFlags.TemplateLiteral) {
|
|
2096
|
+
if (hasProperty(member, "texts") && isArray(member.texts) && member.texts.length === 2 && String(member.texts[1]).trim() === "nanos") {
|
|
2097
|
+
return ["nanos", "micros", "millis", "seconds", "minutes", "hours", "days", "weeks"].map(
|
|
2098
|
+
(name) => ({
|
|
2099
|
+
name,
|
|
2100
|
+
kind: ts.ScriptElementKind.string,
|
|
2101
|
+
insertText: `${"${0}"} ${name}`,
|
|
2102
|
+
isSnippet: true
|
|
2103
|
+
})
|
|
2104
|
+
);
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
return [];
|
|
2112
|
+
})
|
|
2113
|
+
});
|
|
2114
|
+
|
|
2115
|
+
// src/completions/effectDataClasses.ts
|
|
2116
|
+
var effectDataClasses = createCompletion({
|
|
2117
|
+
name: "effectDataClasses",
|
|
2118
|
+
apply: fn("effectDataClasses")(function* (sourceFile, position) {
|
|
2119
|
+
const ts = yield* service(TypeScriptApi);
|
|
2120
|
+
const maybeInfos = yield* option(
|
|
2121
|
+
parseDataForExtendsClassCompletion(sourceFile, position)
|
|
2122
|
+
);
|
|
2123
|
+
if (isNone2(maybeInfos)) return [];
|
|
2124
|
+
const { accessedObject, className, replacementSpan } = maybeInfos.value;
|
|
2125
|
+
const dataName = yield* option(
|
|
2126
|
+
findImportedModuleIdentifierByPackageAndNameOrBarrel(
|
|
2127
|
+
sourceFile,
|
|
2128
|
+
"effect",
|
|
2129
|
+
"Data"
|
|
2130
|
+
)
|
|
2131
|
+
);
|
|
2132
|
+
const effectDataIdentifier = match(dataName, {
|
|
2133
|
+
onNone: () => "Data",
|
|
2134
|
+
onSome: (_) => _.text
|
|
2135
|
+
});
|
|
2136
|
+
if (effectDataIdentifier !== accessedObject.text) return [];
|
|
2137
|
+
const name = className.text;
|
|
2138
|
+
return [{
|
|
2139
|
+
name: `TaggedError("${name}")`,
|
|
2140
|
+
kind: ts.ScriptElementKind.constElement,
|
|
2141
|
+
insertText: `${effectDataIdentifier}.TaggedError("${name}")<{${"${0}"}}>{}`,
|
|
2142
|
+
replacementSpan,
|
|
2143
|
+
isSnippet: true
|
|
2144
|
+
}, {
|
|
2145
|
+
name: `TaggedClass("${name}")`,
|
|
2146
|
+
kind: ts.ScriptElementKind.constElement,
|
|
2147
|
+
insertText: `${effectDataIdentifier}.TaggedClass("${name}")<{${"${0}"}}>{}`,
|
|
2148
|
+
replacementSpan,
|
|
2149
|
+
isSnippet: true
|
|
2150
|
+
}];
|
|
2151
|
+
})
|
|
2152
|
+
});
|
|
2153
|
+
|
|
2154
|
+
// src/diagnostics/duplicatePackage.ts
|
|
2155
|
+
var checkedPackagesCache = /* @__PURE__ */ new Map();
|
|
2156
|
+
var programResolvedCacheSize = /* @__PURE__ */ new Map();
|
|
2157
|
+
var duplicatePackage = createDiagnostic({
|
|
2158
|
+
name: "duplicatePackage",
|
|
2159
|
+
code: 6,
|
|
2160
|
+
severity: "warning",
|
|
2161
|
+
apply: fn("duplicatePackage.apply")(function* (sourceFile, report) {
|
|
2162
|
+
const program = yield* service(TypeScriptProgram);
|
|
2163
|
+
const options = yield* service(LanguageServicePluginOptions);
|
|
2164
|
+
if (sourceFile.statements.length < 1) return;
|
|
2165
|
+
let resolvedPackages = checkedPackagesCache.get(sourceFile.fileName) || {};
|
|
2166
|
+
const newResolvedModuleSize = hasProperty(program, "resolvedModules") && hasProperty(program.resolvedModules, "size") && isNumber(program.resolvedModules.size) ? program.resolvedModules.size : 0;
|
|
2167
|
+
const oldResolvedSize = programResolvedCacheSize.get(sourceFile.fileName) || -1;
|
|
2168
|
+
if (newResolvedModuleSize !== oldResolvedSize) {
|
|
2169
|
+
const seenPackages = /* @__PURE__ */ new Set();
|
|
2170
|
+
resolvedPackages = {};
|
|
2171
|
+
program.getSourceFiles().map((_) => {
|
|
2172
|
+
const packageInfo = parsePackageContentNameAndVersionFromScope(_);
|
|
2173
|
+
if (!packageInfo) return;
|
|
2174
|
+
const packageNameAndVersion = packageInfo.name + "@" + packageInfo.version;
|
|
2175
|
+
if (seenPackages.has(packageNameAndVersion)) return;
|
|
2176
|
+
seenPackages.add(packageNameAndVersion);
|
|
2177
|
+
if (!(packageInfo.name === "effect" || packageInfo.hasEffectInPeerDependencies)) return;
|
|
2178
|
+
if (options.allowedDuplicatedPackages.indexOf(packageInfo.name) > -1) return;
|
|
2179
|
+
resolvedPackages[packageInfo.name] = resolvedPackages[packageInfo.name] || {};
|
|
2180
|
+
resolvedPackages[packageInfo.name][packageInfo.version] = packageInfo.packageDirectory;
|
|
2181
|
+
});
|
|
2182
|
+
checkedPackagesCache.set(sourceFile.fileName, resolvedPackages);
|
|
2183
|
+
programResolvedCacheSize.set(sourceFile.fileName, newResolvedModuleSize);
|
|
2184
|
+
}
|
|
2185
|
+
for (const packageName of Object.keys(resolvedPackages)) {
|
|
2186
|
+
if (Object.keys(resolvedPackages[packageName]).length > 1) {
|
|
2187
|
+
const versions = Object.keys(resolvedPackages[packageName]);
|
|
2188
|
+
report({
|
|
2189
|
+
node: sourceFile.statements[0],
|
|
2190
|
+
messageText: `Package ${packageName} is referenced multiple times with different versions (${versions.join(", ")}) and may cause unexpected type errors.
|
|
2191
|
+
Cleanup your dependencies and your package lockfile to avoid multiple instances of this package and reload the project.
|
|
2192
|
+
If this is intended set the LSP config "allowedDuplicatedPackages" to ${JSON.stringify(options.allowedDuplicatedPackages.concat([packageName]))}.
|
|
2193
|
+
|
|
2194
|
+
${versions.map((version) => `- found ${version} at ${resolvedPackages[packageName][version]}`).join("\n")}`,
|
|
2195
|
+
fixes: []
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
})
|
|
2200
|
+
});
|
|
2201
|
+
|
|
2076
2202
|
// src/core/TypeParser.ts
|
|
2077
2203
|
var TypeParser = Tag("@effect/language-service/TypeParser");
|
|
2078
2204
|
var TypeParserIssue = class _TypeParserIssue {
|
|
2079
2205
|
_tag = "@effect/language-service/TypeParserIssue";
|
|
2080
2206
|
static issue = fail(new _TypeParserIssue());
|
|
2081
2207
|
};
|
|
2082
|
-
function
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2208
|
+
function typeParserIssue(_message, _type, _node) {
|
|
2209
|
+
return TypeParserIssue.issue;
|
|
2210
|
+
}
|
|
2211
|
+
function make3(ts, typeChecker) {
|
|
2086
2212
|
function covariantTypeArgument(type) {
|
|
2087
2213
|
const signatures = type.getCallSignatures();
|
|
2088
2214
|
if (signatures.length !== 1) {
|
|
@@ -2527,8 +2653,8 @@ function make4(ts, typeChecker) {
|
|
|
2527
2653
|
return succeed({ node, subject: node.expression.expression, args: Array.from(node.arguments) });
|
|
2528
2654
|
}
|
|
2529
2655
|
if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "pipe" && node.arguments.length > 0) {
|
|
2530
|
-
const [subject, ...
|
|
2531
|
-
return succeed({ node, subject, args });
|
|
2656
|
+
const [subject, ...args2] = node.arguments;
|
|
2657
|
+
return succeed({ node, subject, args: args2 });
|
|
2532
2658
|
}
|
|
2533
2659
|
return typeParserIssue("Node is not a pipe call", void 0, node);
|
|
2534
2660
|
},
|
|
@@ -2572,6 +2698,53 @@ function make4(ts, typeChecker) {
|
|
|
2572
2698
|
};
|
|
2573
2699
|
}
|
|
2574
2700
|
|
|
2701
|
+
// src/diagnostics/effectInVoidSuccess.ts
|
|
2702
|
+
var effectInVoidSuccess = createDiagnostic({
|
|
2703
|
+
name: "effectInVoidSuccess",
|
|
2704
|
+
code: 14,
|
|
2705
|
+
severity: "warning",
|
|
2706
|
+
apply: fn("effectInVoidSuccess.apply")(function* (sourceFile, report) {
|
|
2707
|
+
const ts = yield* service(TypeScriptApi);
|
|
2708
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
2709
|
+
const typeParser = yield* service(TypeParser);
|
|
2710
|
+
const checkForEffectInVoid = fn("effectInVoidSuccess.checkForEffectInVoid")(function* (node, expectedType, valueNode, realType) {
|
|
2711
|
+
const expectedEffect = yield* typeParser.effectType(expectedType, node);
|
|
2712
|
+
const realEffect = yield* typeParser.effectType(realType, valueNode);
|
|
2713
|
+
if (expectedEffect.A.flags & ts.TypeFlags.Void) {
|
|
2714
|
+
const voidValueTypes = unrollUnionMembers(realEffect.A);
|
|
2715
|
+
const voidedEffect = yield* firstSuccessOf(
|
|
2716
|
+
voidValueTypes.map((_) => map4(typeParser.strictEffectType(_, node), () => _))
|
|
2717
|
+
);
|
|
2718
|
+
return { voidedEffect };
|
|
2719
|
+
}
|
|
2720
|
+
return yield* fail(typeParserIssue("expectedEffect success is not void"));
|
|
2721
|
+
});
|
|
2722
|
+
const entries = yield* expectedAndRealType(sourceFile);
|
|
2723
|
+
for (const [node, expectedType, valueNode, realType] of entries) {
|
|
2724
|
+
if (expectedType !== realType) {
|
|
2725
|
+
yield* pipe(
|
|
2726
|
+
checkForEffectInVoid(
|
|
2727
|
+
node,
|
|
2728
|
+
expectedType,
|
|
2729
|
+
valueNode,
|
|
2730
|
+
realType
|
|
2731
|
+
),
|
|
2732
|
+
map4(({ voidedEffect }) => {
|
|
2733
|
+
report(
|
|
2734
|
+
{
|
|
2735
|
+
node,
|
|
2736
|
+
messageText: `There is a nested '${typeChecker.typeToString(voidedEffect)}' in the 'void' success channel, beware that this could lead to nested Effect<Effect<...>> that won't be executed.`,
|
|
2737
|
+
fixes: []
|
|
2738
|
+
}
|
|
2739
|
+
);
|
|
2740
|
+
}),
|
|
2741
|
+
ignore
|
|
2742
|
+
);
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
})
|
|
2746
|
+
});
|
|
2747
|
+
|
|
2575
2748
|
// src/diagnostics/floatingEffect.ts
|
|
2576
2749
|
var floatingEffect = createDiagnostic({
|
|
2577
2750
|
name: "floatingEffect",
|
|
@@ -3394,6 +3567,51 @@ Consider using "scoped" instead to get rid of the scope in the requirements.`,
|
|
|
3394
3567
|
})
|
|
3395
3568
|
});
|
|
3396
3569
|
|
|
3570
|
+
// src/diagnostics/tryCatchInEffectGen.ts
|
|
3571
|
+
var tryCatchInEffectGen = createDiagnostic({
|
|
3572
|
+
name: "tryCatchInEffectGen",
|
|
3573
|
+
code: 12,
|
|
3574
|
+
severity: "warning",
|
|
3575
|
+
apply: fn("tryCatchInEffectGen.apply")(function* (sourceFile, report) {
|
|
3576
|
+
const ts = yield* service(TypeScriptApi);
|
|
3577
|
+
const typeParser = yield* service(TypeParser);
|
|
3578
|
+
const nodeToVisit = [];
|
|
3579
|
+
const appendNodeToVisit = (node) => {
|
|
3580
|
+
nodeToVisit.push(node);
|
|
3581
|
+
return void 0;
|
|
3582
|
+
};
|
|
3583
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
3584
|
+
while (nodeToVisit.length > 0) {
|
|
3585
|
+
const node = nodeToVisit.shift();
|
|
3586
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
3587
|
+
if (ts.isTryStatement(node)) {
|
|
3588
|
+
const generatorOrRegularFunction = ts.findAncestor(
|
|
3589
|
+
node,
|
|
3590
|
+
(_) => ts.isFunctionExpression(_) || ts.isFunctionDeclaration(_) || ts.isMethodDeclaration(_) || ts.isArrowFunction(_) || ts.isGetAccessor(_) || ts.isFunctionLike(_)
|
|
3591
|
+
);
|
|
3592
|
+
if (!(generatorOrRegularFunction && "asteriskToken" in generatorOrRegularFunction && generatorOrRegularFunction.asteriskToken)) continue;
|
|
3593
|
+
if (!generatorOrRegularFunction) continue;
|
|
3594
|
+
if (generatorOrRegularFunction && generatorOrRegularFunction.parent) {
|
|
3595
|
+
const effectGenNode = generatorOrRegularFunction.parent;
|
|
3596
|
+
yield* pipe(
|
|
3597
|
+
typeParser.effectGen(effectGenNode),
|
|
3598
|
+
orElse2(() => typeParser.effectFnUntracedGen(effectGenNode)),
|
|
3599
|
+
orElse2(() => typeParser.effectFnGen(effectGenNode)),
|
|
3600
|
+
map4(() => {
|
|
3601
|
+
report({
|
|
3602
|
+
node,
|
|
3603
|
+
messageText: "Avoid using try/catch inside Effect generators. Use Effect's error handling mechanisms instead (e.g., Effect.try, Effect.tryPromise, Effect.catchAll, Effect.catchTag).",
|
|
3604
|
+
fixes: []
|
|
3605
|
+
});
|
|
3606
|
+
}),
|
|
3607
|
+
ignore
|
|
3608
|
+
);
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
})
|
|
3613
|
+
});
|
|
3614
|
+
|
|
3397
3615
|
// src/diagnostics/unnecessaryEffectGen.ts
|
|
3398
3616
|
var unnecessaryEffectGen = createDiagnostic({
|
|
3399
3617
|
name: "unnecessaryEffectGen",
|
|
@@ -3457,8 +3675,8 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
3457
3675
|
if (ts.isCallExpression(node)) {
|
|
3458
3676
|
yield* pipe(
|
|
3459
3677
|
typeParser.pipeCall(node),
|
|
3460
|
-
map4(({ args, subject }) => {
|
|
3461
|
-
if (
|
|
3678
|
+
map4(({ args: args2, subject }) => {
|
|
3679
|
+
if (args2.length === 0) {
|
|
3462
3680
|
report({
|
|
3463
3681
|
node,
|
|
3464
3682
|
messageText: `This pipe call contains no arguments.`,
|
|
@@ -3495,8 +3713,10 @@ var diagnostics = [
|
|
|
3495
3713
|
unnecessaryPipe,
|
|
3496
3714
|
genericEffectServices,
|
|
3497
3715
|
returnEffectInGen,
|
|
3716
|
+
tryCatchInEffectGen,
|
|
3498
3717
|
importFromBarrel,
|
|
3499
|
-
scopeInLayerEffect
|
|
3718
|
+
scopeInLayerEffect,
|
|
3719
|
+
effectInVoidSuccess
|
|
3500
3720
|
];
|
|
3501
3721
|
|
|
3502
3722
|
// src/completions/effectDiagnosticsComment.ts
|
|
@@ -3505,9 +3725,9 @@ var effectDiagnosticsComment = createCompletion({
|
|
|
3505
3725
|
apply: fn("effectDiagnosticsComment")(function* (sourceFile, position) {
|
|
3506
3726
|
const ts = yield* service(TypeScriptApi);
|
|
3507
3727
|
const sourceText = sourceFile.text;
|
|
3508
|
-
const
|
|
3509
|
-
if (
|
|
3510
|
-
const lastIndex =
|
|
3728
|
+
const match3 = /(\/\/|\/\*(?:\*?))\s*(@)\s*$/id.exec(sourceText.substring(0, position));
|
|
3729
|
+
if (match3 && match3.indices) {
|
|
3730
|
+
const lastIndex = match3.indices[2][0];
|
|
3511
3731
|
const replacementSpan = {
|
|
3512
3732
|
start: lastIndex,
|
|
3513
3733
|
length: Math.max(0, position - lastIndex)
|
|
@@ -3738,7 +3958,8 @@ var completions = [
|
|
|
3738
3958
|
genFunctionStar,
|
|
3739
3959
|
fnFunctionStar,
|
|
3740
3960
|
effectDataClasses,
|
|
3741
|
-
effectDiagnosticsComment
|
|
3961
|
+
effectDiagnosticsComment,
|
|
3962
|
+
durationInput
|
|
3742
3963
|
];
|
|
3743
3964
|
|
|
3744
3965
|
// src/completions/middlewareAutoImports.ts
|
|
@@ -5238,7 +5459,7 @@ var read_buf = (strm, buf, start, size) => {
|
|
|
5238
5459
|
var longest_match = (s, cur_match) => {
|
|
5239
5460
|
let chain_length = s.max_chain_length;
|
|
5240
5461
|
let scan = s.strstart;
|
|
5241
|
-
let
|
|
5462
|
+
let match3;
|
|
5242
5463
|
let len;
|
|
5243
5464
|
let best_len = s.prev_length;
|
|
5244
5465
|
let nice_match = s.nice_match;
|
|
@@ -5256,14 +5477,14 @@ var longest_match = (s, cur_match) => {
|
|
|
5256
5477
|
nice_match = s.lookahead;
|
|
5257
5478
|
}
|
|
5258
5479
|
do {
|
|
5259
|
-
|
|
5260
|
-
if (_win[
|
|
5480
|
+
match3 = cur_match;
|
|
5481
|
+
if (_win[match3 + best_len] !== scan_end || _win[match3 + best_len - 1] !== scan_end1 || _win[match3] !== _win[scan] || _win[++match3] !== _win[scan + 1]) {
|
|
5261
5482
|
continue;
|
|
5262
5483
|
}
|
|
5263
5484
|
scan += 2;
|
|
5264
|
-
|
|
5485
|
+
match3++;
|
|
5265
5486
|
do {
|
|
5266
|
-
} while (_win[++scan] === _win[++
|
|
5487
|
+
} while (_win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && scan < strend);
|
|
5267
5488
|
len = MAX_MATCH - (strend - scan);
|
|
5268
5489
|
scan = strend - MAX_MATCH;
|
|
5269
5490
|
if (len > best_len) {
|
|
@@ -6964,7 +7185,7 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
6964
7185
|
let mask;
|
|
6965
7186
|
let next;
|
|
6966
7187
|
let base = null;
|
|
6967
|
-
let
|
|
7188
|
+
let match3;
|
|
6968
7189
|
const count = new Uint16Array(MAXBITS + 1);
|
|
6969
7190
|
const offs = new Uint16Array(MAXBITS + 1);
|
|
6970
7191
|
let extra = null;
|
|
@@ -7020,15 +7241,15 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
7020
7241
|
}
|
|
7021
7242
|
if (type === CODES$1) {
|
|
7022
7243
|
base = extra = work;
|
|
7023
|
-
|
|
7244
|
+
match3 = 20;
|
|
7024
7245
|
} else if (type === LENS$1) {
|
|
7025
7246
|
base = lbase;
|
|
7026
7247
|
extra = lext;
|
|
7027
|
-
|
|
7248
|
+
match3 = 257;
|
|
7028
7249
|
} else {
|
|
7029
7250
|
base = dbase;
|
|
7030
7251
|
extra = dext;
|
|
7031
|
-
|
|
7252
|
+
match3 = 0;
|
|
7032
7253
|
}
|
|
7033
7254
|
huff = 0;
|
|
7034
7255
|
sym = 0;
|
|
@@ -7044,12 +7265,12 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
7044
7265
|
}
|
|
7045
7266
|
for (; ; ) {
|
|
7046
7267
|
here_bits = len - drop;
|
|
7047
|
-
if (work[sym] + 1 <
|
|
7268
|
+
if (work[sym] + 1 < match3) {
|
|
7048
7269
|
here_op = 0;
|
|
7049
7270
|
here_val = work[sym];
|
|
7050
|
-
} else if (work[sym] >=
|
|
7051
|
-
here_op = extra[work[sym] -
|
|
7052
|
-
here_val = base[work[sym] -
|
|
7271
|
+
} else if (work[sym] >= match3) {
|
|
7272
|
+
here_op = extra[work[sym] - match3];
|
|
7273
|
+
here_val = base[work[sym] - match3];
|
|
7053
7274
|
} else {
|
|
7054
7275
|
here_op = 32 + 64;
|
|
7055
7276
|
here_val = 0;
|
|
@@ -8561,10 +8782,10 @@ var GraphNodeLeaf = class {
|
|
|
8561
8782
|
_tag = "GraphNodeLeaf";
|
|
8562
8783
|
};
|
|
8563
8784
|
var GraphNodeCompoundTransform = class {
|
|
8564
|
-
constructor(id, node,
|
|
8785
|
+
constructor(id, node, args2, rout, rin) {
|
|
8565
8786
|
this.id = id;
|
|
8566
8787
|
this.node = node;
|
|
8567
|
-
this.args =
|
|
8788
|
+
this.args = args2;
|
|
8568
8789
|
this.rout = rout;
|
|
8569
8790
|
this.rin = rin;
|
|
8570
8791
|
}
|
|
@@ -9842,13 +10063,13 @@ var makeSchemaGenContext = fn("SchemaGen.makeSchemaGenContext")(function* (sourc
|
|
|
9842
10063
|
ts.factory.createIdentifier(effectSchemaIdentifier),
|
|
9843
10064
|
apiName
|
|
9844
10065
|
),
|
|
9845
|
-
createApiCall: (apiName,
|
|
10066
|
+
createApiCall: (apiName, args2) => ts.factory.createCallExpression(
|
|
9846
10067
|
ts.factory.createPropertyAccessExpression(
|
|
9847
10068
|
ts.factory.createIdentifier(effectSchemaIdentifier),
|
|
9848
10069
|
apiName
|
|
9849
10070
|
),
|
|
9850
10071
|
[],
|
|
9851
|
-
|
|
10072
|
+
args2
|
|
9852
10073
|
),
|
|
9853
10074
|
entityNameToDataTypeName: (name) => {
|
|
9854
10075
|
if (ts.isIdentifier(name)) {
|
|
@@ -10414,12 +10635,12 @@ var init = (modules) => {
|
|
|
10414
10635
|
const proxy = /* @__PURE__ */ Object.create(null);
|
|
10415
10636
|
proxy[LSP_INJECTED_URI] = true;
|
|
10416
10637
|
for (const k of Object.keys(languageService)) {
|
|
10417
|
-
proxy[k] = (...
|
|
10638
|
+
proxy[k] = (...args2) => languageService[k].apply(languageService, args2);
|
|
10418
10639
|
}
|
|
10419
10640
|
function runNano(program) {
|
|
10420
10641
|
return (fa) => pipe(
|
|
10421
10642
|
fa,
|
|
10422
|
-
provideService(TypeParser,
|
|
10643
|
+
provideService(TypeParser, make3(modules.typescript, program.getTypeChecker())),
|
|
10423
10644
|
provideService(TypeScriptProgram, program),
|
|
10424
10645
|
provideService(TypeCheckerApi, program.getTypeChecker()),
|
|
10425
10646
|
provideService(
|
|
@@ -10435,8 +10656,8 @@ var init = (modules) => {
|
|
|
10435
10656
|
);
|
|
10436
10657
|
}
|
|
10437
10658
|
const effectCodeFixesForFile = /* @__PURE__ */ new Map();
|
|
10438
|
-
proxy.getSemanticDiagnostics = (fileName, ...
|
|
10439
|
-
const applicableDiagnostics = languageService.getSemanticDiagnostics(fileName, ...
|
|
10659
|
+
proxy.getSemanticDiagnostics = (fileName, ...args2) => {
|
|
10660
|
+
const applicableDiagnostics = languageService.getSemanticDiagnostics(fileName, ...args2);
|
|
10440
10661
|
const program = languageService.getProgram();
|
|
10441
10662
|
if (languageServicePluginOptions.diagnostics && program) {
|
|
10442
10663
|
effectCodeFixesForFile.delete(fileName);
|
|
@@ -10455,10 +10676,10 @@ var init = (modules) => {
|
|
|
10455
10676
|
}
|
|
10456
10677
|
return applicableDiagnostics;
|
|
10457
10678
|
};
|
|
10458
|
-
proxy.getSupportedCodeFixes = (...
|
|
10679
|
+
proxy.getSupportedCodeFixes = (...args2) => languageService.getSupportedCodeFixes(...args2).concat(
|
|
10459
10680
|
diagnosticsErrorCodes.map((_) => "" + _)
|
|
10460
10681
|
);
|
|
10461
|
-
proxy.getCodeFixesAtPosition = (fileName, start, end, errorCodes, formatOptions, preferences, ...
|
|
10682
|
+
proxy.getCodeFixesAtPosition = (fileName, start, end, errorCodes, formatOptions, preferences, ...args2) => {
|
|
10462
10683
|
const applicableCodeFixes = languageService.getCodeFixesAtPosition(
|
|
10463
10684
|
fileName,
|
|
10464
10685
|
start,
|
|
@@ -10466,7 +10687,7 @@ var init = (modules) => {
|
|
|
10466
10687
|
errorCodes,
|
|
10467
10688
|
formatOptions,
|
|
10468
10689
|
preferences,
|
|
10469
|
-
...
|
|
10690
|
+
...args2
|
|
10470
10691
|
);
|
|
10471
10692
|
return pipe(
|
|
10472
10693
|
sync(() => {
|
|
@@ -10504,9 +10725,9 @@ var init = (modules) => {
|
|
|
10504
10725
|
getOrElse(() => applicableCodeFixes)
|
|
10505
10726
|
);
|
|
10506
10727
|
};
|
|
10507
|
-
proxy.getApplicableRefactors = (...
|
|
10508
|
-
const applicableRefactors = languageService.getApplicableRefactors(...
|
|
10509
|
-
const [fileName, positionOrRange] =
|
|
10728
|
+
proxy.getApplicableRefactors = (...args2) => {
|
|
10729
|
+
const applicableRefactors = languageService.getApplicableRefactors(...args2);
|
|
10730
|
+
const [fileName, positionOrRange] = args2;
|
|
10510
10731
|
const program = languageService.getProgram();
|
|
10511
10732
|
if (program) {
|
|
10512
10733
|
const sourceFile = program.getSourceFile(fileName);
|
|
@@ -10521,7 +10742,7 @@ var init = (modules) => {
|
|
|
10521
10742
|
}
|
|
10522
10743
|
return applicableRefactors;
|
|
10523
10744
|
};
|
|
10524
|
-
proxy.getEditsForRefactor = (fileName, formatOptions, positionOrRange, refactorName, actionName, preferences, ...
|
|
10745
|
+
proxy.getEditsForRefactor = (fileName, formatOptions, positionOrRange, refactorName, actionName, preferences, ...args2) => {
|
|
10525
10746
|
const program = languageService.getProgram();
|
|
10526
10747
|
if (program) {
|
|
10527
10748
|
const sourceFile = program.getSourceFile(fileName);
|
|
@@ -10564,11 +10785,11 @@ var init = (modules) => {
|
|
|
10564
10785
|
refactorName,
|
|
10565
10786
|
actionName,
|
|
10566
10787
|
preferences,
|
|
10567
|
-
...
|
|
10788
|
+
...args2
|
|
10568
10789
|
);
|
|
10569
10790
|
};
|
|
10570
|
-
proxy.getQuickInfoAtPosition = (fileName, position, ...
|
|
10571
|
-
const applicableQuickInfo = languageService.getQuickInfoAtPosition(fileName, position, ...
|
|
10791
|
+
proxy.getQuickInfoAtPosition = (fileName, position, ...args2) => {
|
|
10792
|
+
const applicableQuickInfo = languageService.getQuickInfoAtPosition(fileName, position, ...args2);
|
|
10572
10793
|
if (languageServicePluginOptions.quickinfo) {
|
|
10573
10794
|
const program = languageService.getProgram();
|
|
10574
10795
|
if (program) {
|
|
@@ -10588,13 +10809,13 @@ var init = (modules) => {
|
|
|
10588
10809
|
}
|
|
10589
10810
|
return applicableQuickInfo;
|
|
10590
10811
|
};
|
|
10591
|
-
proxy.getCompletionsAtPosition = (fileName, position, options, formattingSettings, ...
|
|
10812
|
+
proxy.getCompletionsAtPosition = (fileName, position, options, formattingSettings, ...args2) => {
|
|
10592
10813
|
const applicableCompletions = languageService.getCompletionsAtPosition(
|
|
10593
10814
|
fileName,
|
|
10594
10815
|
position,
|
|
10595
10816
|
options,
|
|
10596
10817
|
formattingSettings,
|
|
10597
|
-
...
|
|
10818
|
+
...args2
|
|
10598
10819
|
);
|
|
10599
10820
|
if (languageServicePluginOptions.completions) {
|
|
10600
10821
|
const program = languageService.getProgram();
|
|
@@ -10633,7 +10854,7 @@ var init = (modules) => {
|
|
|
10633
10854
|
}
|
|
10634
10855
|
return applicableCompletions;
|
|
10635
10856
|
};
|
|
10636
|
-
proxy.getCompletionEntryDetails = (fileName, position, entryName, formatOptions, source, preferences, _data, ...
|
|
10857
|
+
proxy.getCompletionEntryDetails = (fileName, position, entryName, formatOptions, source, preferences, _data, ...args2) => {
|
|
10637
10858
|
const applicableCompletionEntryDetails = languageService.getCompletionEntryDetails(
|
|
10638
10859
|
fileName,
|
|
10639
10860
|
position,
|
|
@@ -10642,7 +10863,7 @@ var init = (modules) => {
|
|
|
10642
10863
|
source,
|
|
10643
10864
|
preferences,
|
|
10644
10865
|
_data,
|
|
10645
|
-
...
|
|
10866
|
+
...args2
|
|
10646
10867
|
);
|
|
10647
10868
|
if (languageServicePluginOptions.completions) {
|
|
10648
10869
|
const program = languageService.getProgram();
|
|
@@ -10666,8 +10887,8 @@ var init = (modules) => {
|
|
|
10666
10887
|
}
|
|
10667
10888
|
return applicableCompletionEntryDetails;
|
|
10668
10889
|
};
|
|
10669
|
-
proxy.getDefinitionAndBoundSpan = (fileName, position, ...
|
|
10670
|
-
const applicableDefinition = languageService.getDefinitionAndBoundSpan(fileName, position, ...
|
|
10890
|
+
proxy.getDefinitionAndBoundSpan = (fileName, position, ...args2) => {
|
|
10891
|
+
const applicableDefinition = languageService.getDefinitionAndBoundSpan(fileName, position, ...args2);
|
|
10671
10892
|
if (languageServicePluginOptions.goto) {
|
|
10672
10893
|
const program = languageService.getProgram();
|
|
10673
10894
|
if (program) {
|