@effect/language-service 0.44.1 → 0.45.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/README.md +21 -0
- package/cli.js +613 -558
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +141 -28
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +172 -33
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +141 -28
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/effect@3.
|
|
3
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Function.js
|
|
4
4
|
var isFunction = (input) => typeof input === "function";
|
|
5
5
|
var dual = function(arity, body) {
|
|
6
6
|
if (typeof arity === "function") {
|
|
@@ -96,7 +96,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
// node_modules/.pnpm/effect@3.
|
|
99
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Equivalence.js
|
|
100
100
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
101
101
|
var array = (item) => make((self, that) => {
|
|
102
102
|
if (self.length !== that.length) {
|
|
@@ -111,7 +111,7 @@ var array = (item) => make((self, that) => {
|
|
|
111
111
|
return true;
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
// node_modules/.pnpm/effect@3.
|
|
114
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/GlobalValue.js
|
|
115
115
|
var globalStoreId = `effect/GlobalValue`;
|
|
116
116
|
var globalStore;
|
|
117
117
|
var globalValue = (id, compute) => {
|
|
@@ -125,7 +125,7 @@ var globalValue = (id, compute) => {
|
|
|
125
125
|
return globalStore.get(id);
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
// node_modules/.pnpm/effect@3.
|
|
128
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Predicate.js
|
|
129
129
|
var isString = (input) => typeof input === "string";
|
|
130
130
|
var isNumber = (input) => typeof input === "number";
|
|
131
131
|
var isBoolean = (input) => typeof input === "boolean";
|
|
@@ -135,7 +135,7 @@ var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
|
135
135
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
136
136
|
var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
|
|
137
137
|
|
|
138
|
-
// node_modules/.pnpm/effect@3.
|
|
138
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Utils.js
|
|
139
139
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
140
140
|
var GenKindImpl = class {
|
|
141
141
|
value;
|
|
@@ -257,7 +257,7 @@ var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forc
|
|
|
257
257
|
var genConstructor = function* () {
|
|
258
258
|
}.constructor;
|
|
259
259
|
|
|
260
|
-
// node_modules/.pnpm/effect@3.
|
|
260
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Hash.js
|
|
261
261
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
262
262
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
263
263
|
var hash = (self) => {
|
|
@@ -356,7 +356,7 @@ var cached = function() {
|
|
|
356
356
|
return hash2;
|
|
357
357
|
};
|
|
358
358
|
|
|
359
|
-
// node_modules/.pnpm/effect@3.
|
|
359
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Equal.js
|
|
360
360
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
361
361
|
function equals() {
|
|
362
362
|
if (arguments.length === 1) {
|
|
@@ -410,7 +410,7 @@ function compareBoth(self, that) {
|
|
|
410
410
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
411
411
|
var equivalence = () => equals;
|
|
412
412
|
|
|
413
|
-
// node_modules/.pnpm/effect@3.
|
|
413
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Inspectable.js
|
|
414
414
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
415
415
|
var toJSON = (x) => {
|
|
416
416
|
try {
|
|
@@ -462,7 +462,7 @@ var redact = (u) => {
|
|
|
462
462
|
return u;
|
|
463
463
|
};
|
|
464
464
|
|
|
465
|
-
// node_modules/.pnpm/effect@3.
|
|
465
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Pipeable.js
|
|
466
466
|
var pipeArguments = (self, args2) => {
|
|
467
467
|
switch (args2.length) {
|
|
468
468
|
case 0:
|
|
@@ -495,14 +495,14 @@ var pipeArguments = (self, args2) => {
|
|
|
495
495
|
}
|
|
496
496
|
};
|
|
497
497
|
|
|
498
|
-
// node_modules/.pnpm/effect@3.
|
|
498
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/opCodes/effect.js
|
|
499
499
|
var OP_COMMIT = "Commit";
|
|
500
500
|
|
|
501
|
-
// node_modules/.pnpm/effect@3.
|
|
502
|
-
var moduleVersion = "3.
|
|
501
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/version.js
|
|
502
|
+
var moduleVersion = "3.18.4";
|
|
503
503
|
var getCurrentVersion = () => moduleVersion;
|
|
504
504
|
|
|
505
|
-
// node_modules/.pnpm/effect@3.
|
|
505
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/effectable.js
|
|
506
506
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
507
507
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
508
508
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
@@ -589,7 +589,7 @@ var StructuralCommitPrototype = {
|
|
|
589
589
|
...StructuralPrototype
|
|
590
590
|
};
|
|
591
591
|
|
|
592
|
-
// node_modules/.pnpm/effect@3.
|
|
592
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/option.js
|
|
593
593
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
594
594
|
var CommonProto = {
|
|
595
595
|
...EffectPrototype,
|
|
@@ -647,7 +647,7 @@ var some = (value) => {
|
|
|
647
647
|
return a;
|
|
648
648
|
};
|
|
649
649
|
|
|
650
|
-
// node_modules/.pnpm/effect@3.
|
|
650
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/either.js
|
|
651
651
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
652
652
|
var CommonProto2 = {
|
|
653
653
|
...EffectPrototype,
|
|
@@ -709,7 +709,7 @@ var right = (right3) => {
|
|
|
709
709
|
return a;
|
|
710
710
|
};
|
|
711
711
|
|
|
712
|
-
// node_modules/.pnpm/effect@3.
|
|
712
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Either.js
|
|
713
713
|
var right2 = right;
|
|
714
714
|
var left2 = left;
|
|
715
715
|
var isLeft2 = isLeft;
|
|
@@ -717,14 +717,14 @@ var isRight2 = isRight;
|
|
|
717
717
|
var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
|
|
718
718
|
var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
|
|
719
719
|
|
|
720
|
-
// node_modules/.pnpm/effect@3.
|
|
720
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/array.js
|
|
721
721
|
var isNonEmptyArray = (self) => self.length > 0;
|
|
722
722
|
|
|
723
|
-
// node_modules/.pnpm/effect@3.
|
|
723
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Order.js
|
|
724
724
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
725
725
|
var string2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
726
726
|
|
|
727
|
-
// node_modules/.pnpm/effect@3.
|
|
727
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Option.js
|
|
728
728
|
var none2 = () => none;
|
|
729
729
|
var some2 = some;
|
|
730
730
|
var isNone2 = isNone;
|
|
@@ -735,7 +735,7 @@ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nu
|
|
|
735
735
|
var getOrUndefined = /* @__PURE__ */ getOrElse2(constUndefined);
|
|
736
736
|
var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
|
|
737
737
|
|
|
738
|
-
// node_modules/.pnpm/effect@3.
|
|
738
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Record.js
|
|
739
739
|
var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
740
740
|
const out = {
|
|
741
741
|
...self
|
|
@@ -747,7 +747,7 @@ var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
747
747
|
});
|
|
748
748
|
var keys = (self) => Object.keys(self);
|
|
749
749
|
|
|
750
|
-
// node_modules/.pnpm/effect@3.
|
|
750
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Array.js
|
|
751
751
|
var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
752
752
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
753
753
|
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
|
|
@@ -1210,14 +1210,19 @@ var defaults = {
|
|
|
1210
1210
|
target: "service",
|
|
1211
1211
|
pattern: "default",
|
|
1212
1212
|
skipLeadingPath: ["src/"]
|
|
1213
|
-
}
|
|
1213
|
+
}, {
|
|
1214
|
+
target: "custom",
|
|
1215
|
+
pattern: "default",
|
|
1216
|
+
skipLeadingPath: ["src/"]
|
|
1217
|
+
}],
|
|
1218
|
+
extendedKeyDetection: false
|
|
1214
1219
|
};
|
|
1215
1220
|
function parseKeyPatterns(patterns) {
|
|
1216
1221
|
const result = [];
|
|
1217
1222
|
for (const entry of patterns) {
|
|
1218
1223
|
if (!isObject(entry)) continue;
|
|
1219
1224
|
result.push({
|
|
1220
|
-
target: hasProperty(entry, "target") && isString(entry.target) && ["service", "error"].includes(entry.target.toLowerCase()) ? entry.target.toLowerCase() : "service",
|
|
1225
|
+
target: hasProperty(entry, "target") && isString(entry.target) && ["service", "error", "custom"].includes(entry.target.toLowerCase()) ? entry.target.toLowerCase() : "service",
|
|
1221
1226
|
pattern: hasProperty(entry, "pattern") && isString(entry.pattern) && ["package-identifier", "default"].includes(entry.pattern.toLowerCase()) ? entry.pattern.toLowerCase() : "default",
|
|
1222
1227
|
skipLeadingPath: hasProperty(entry, "skipLeadingPath") && isArray(entry.skipLeadingPath) && entry.skipLeadingPath.every(isString) ? entry.skipLeadingPath : ["src/"]
|
|
1223
1228
|
});
|
|
@@ -1243,7 +1248,8 @@ function parse(config) {
|
|
|
1243
1248
|
topLevelNamedReexports: isObject(config) && hasProperty(config, "topLevelNamedReexports") && isString(config.topLevelNamedReexports) && ["ignore", "follow"].includes(config.topLevelNamedReexports.toLowerCase()) ? config.topLevelNamedReexports.toLowerCase() : defaults.topLevelNamedReexports,
|
|
1244
1249
|
renames: isObject(config) && hasProperty(config, "renames") && isBoolean(config.renames) ? config.renames : defaults.renames,
|
|
1245
1250
|
noExternal: isObject(config) && hasProperty(config, "noExternal") && isBoolean(config.noExternal) ? config.noExternal : defaults.noExternal,
|
|
1246
|
-
keyPatterns: isObject(config) && hasProperty(config, "keyPatterns") && isArray(config.keyPatterns) ? parseKeyPatterns(config.keyPatterns) : defaults.keyPatterns
|
|
1251
|
+
keyPatterns: isObject(config) && hasProperty(config, "keyPatterns") && isArray(config.keyPatterns) ? parseKeyPatterns(config.keyPatterns) : defaults.keyPatterns,
|
|
1252
|
+
extendedKeyDetection: isObject(config) && hasProperty(config, "extendedKeyDetection") && isBoolean(config.extendedKeyDetection) ? config.extendedKeyDetection : defaults.extendedKeyDetection
|
|
1247
1253
|
};
|
|
1248
1254
|
}
|
|
1249
1255
|
|
|
@@ -3945,10 +3951,10 @@ var effectDataClasses = createCompletion({
|
|
|
3945
3951
|
})
|
|
3946
3952
|
});
|
|
3947
3953
|
|
|
3948
|
-
// node_modules/.pnpm/effect@3.
|
|
3954
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/encoding/common.js
|
|
3949
3955
|
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
3950
3956
|
|
|
3951
|
-
// node_modules/.pnpm/effect@3.
|
|
3957
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/encoding/base64.js
|
|
3952
3958
|
var encode = (bytes) => {
|
|
3953
3959
|
const length = bytes.length;
|
|
3954
3960
|
let result = "";
|
|
@@ -3974,10 +3980,10 @@ var encode = (bytes) => {
|
|
|
3974
3980
|
};
|
|
3975
3981
|
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
3976
3982
|
|
|
3977
|
-
// node_modules/.pnpm/effect@3.
|
|
3983
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
3978
3984
|
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
3979
3985
|
|
|
3980
|
-
// node_modules/.pnpm/effect@3.
|
|
3986
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Encoding.js
|
|
3981
3987
|
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
3982
3988
|
|
|
3983
3989
|
// src/diagnostics/classSelfMismatch.ts
|
|
@@ -4052,6 +4058,62 @@ var deterministicKeys = createDiagnostic({
|
|
|
4052
4058
|
apply: fn("deterministicKeys.apply")(function* (sourceFile, report) {
|
|
4053
4059
|
const ts = yield* service(TypeScriptApi);
|
|
4054
4060
|
const typeParser = yield* service(TypeParser);
|
|
4061
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
4062
|
+
const typeScriptUtils = yield* service(TypeScriptUtils);
|
|
4063
|
+
const options = yield* service(LanguageServicePluginOptions);
|
|
4064
|
+
const parseExtendsCustom = cachedBy(
|
|
4065
|
+
fn("parseExtendsCustom")(function* (classDeclaration) {
|
|
4066
|
+
if (!options.extendedKeyDetection) {
|
|
4067
|
+
return yield* typeParserIssue("Extended key detection is disabled", void 0, classDeclaration);
|
|
4068
|
+
}
|
|
4069
|
+
if (!classDeclaration.name) {
|
|
4070
|
+
return yield* typeParserIssue("Class has no name", void 0, classDeclaration);
|
|
4071
|
+
}
|
|
4072
|
+
if (!ts.isIdentifier(classDeclaration.name)) {
|
|
4073
|
+
return yield* typeParserIssue("Class name is not an identifier", void 0, classDeclaration);
|
|
4074
|
+
}
|
|
4075
|
+
const heritageClauses = classDeclaration.heritageClauses;
|
|
4076
|
+
if (!heritageClauses) {
|
|
4077
|
+
return yield* typeParserIssue("Class has no heritage clauses", void 0, classDeclaration);
|
|
4078
|
+
}
|
|
4079
|
+
const nodeToVisit2 = [...classDeclaration.heritageClauses];
|
|
4080
|
+
const appendNodeToVisit2 = (node) => {
|
|
4081
|
+
nodeToVisit2.push(node);
|
|
4082
|
+
return void 0;
|
|
4083
|
+
};
|
|
4084
|
+
while (nodeToVisit2.length > 0) {
|
|
4085
|
+
const node = nodeToVisit2.shift();
|
|
4086
|
+
if (ts.isCallExpression(node)) {
|
|
4087
|
+
for (let i = 0; i < node.arguments.length; i++) {
|
|
4088
|
+
const arg = node.arguments[i];
|
|
4089
|
+
if (!ts.isStringLiteral(arg)) continue;
|
|
4090
|
+
const resolvedSignature = typeChecker.getResolvedSignature(node);
|
|
4091
|
+
if (resolvedSignature) {
|
|
4092
|
+
const parameter = resolvedSignature.parameters[i];
|
|
4093
|
+
if (!parameter) continue;
|
|
4094
|
+
if (parameter.declarations) {
|
|
4095
|
+
for (const declaration of parameter.declarations) {
|
|
4096
|
+
const parameterSourceFile = typeScriptUtils.getSourceFileOfNode(declaration);
|
|
4097
|
+
const paramText = parameterSourceFile.text.substring(declaration.pos, declaration.end);
|
|
4098
|
+
if (paramText.toLowerCase().includes("@effect-identifier")) {
|
|
4099
|
+
return { className: classDeclaration.name, keyStringLiteral: arg, target: "custom" };
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
ts.forEachChild(node, appendNodeToVisit2);
|
|
4107
|
+
}
|
|
4108
|
+
return yield* typeParserIssue(
|
|
4109
|
+
"Class does not extend any custom pattern",
|
|
4110
|
+
void 0,
|
|
4111
|
+
classDeclaration
|
|
4112
|
+
);
|
|
4113
|
+
}),
|
|
4114
|
+
"deterministicKeys.parseExtendsCustom",
|
|
4115
|
+
(classDeclaration) => classDeclaration
|
|
4116
|
+
);
|
|
4055
4117
|
const nodeToVisit = [];
|
|
4056
4118
|
const appendNodeToVisit = (node) => {
|
|
4057
4119
|
nodeToVisit.push(node);
|
|
@@ -4075,12 +4137,13 @@ var deterministicKeys = createDiagnostic({
|
|
|
4075
4137
|
map5(({ className, keyStringLiteral }) => ({ keyStringLiteral, className, target: "error" }))
|
|
4076
4138
|
)
|
|
4077
4139
|
),
|
|
4140
|
+
orElse2(() => parseExtendsCustom(node)),
|
|
4078
4141
|
orElse2(() => void_)
|
|
4079
4142
|
);
|
|
4080
4143
|
if (result && result.keyStringLiteral) {
|
|
4081
|
-
const { className, keyStringLiteral } = result;
|
|
4144
|
+
const { className, keyStringLiteral, target } = result;
|
|
4082
4145
|
const classNameText = ts.idText(className);
|
|
4083
|
-
const expectedKey = yield* createString(sourceFile, classNameText,
|
|
4146
|
+
const expectedKey = yield* createString(sourceFile, classNameText, target);
|
|
4084
4147
|
if (!expectedKey) continue;
|
|
4085
4148
|
const actualIdentifier = keyStringLiteral.text;
|
|
4086
4149
|
if (actualIdentifier !== expectedKey) {
|
|
@@ -5284,17 +5347,67 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
5284
5347
|
const members = node.members;
|
|
5285
5348
|
for (const member of members) {
|
|
5286
5349
|
if (ts.isConstructorDeclaration(member)) {
|
|
5350
|
+
const fixAsStaticNew = {
|
|
5351
|
+
fixName: "overriddenSchemaConstructor_static",
|
|
5352
|
+
description: "Rewrite using the static 'new' pattern",
|
|
5353
|
+
apply: gen(function* () {
|
|
5354
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
5355
|
+
const visitor = (node2) => {
|
|
5356
|
+
if (ts.isExpressionStatement(node2) && ts.isCallExpression(node2.expression) && ts.isToken(node2.expression.expression) && node2.expression.expression.kind === ts.SyntaxKind.SuperKeyword) {
|
|
5357
|
+
const constructThis = ts.factory.createNewExpression(
|
|
5358
|
+
ts.factory.createIdentifier("this"),
|
|
5359
|
+
void 0,
|
|
5360
|
+
node2.expression.arguments
|
|
5361
|
+
);
|
|
5362
|
+
return ts.factory.createVariableStatement(
|
|
5363
|
+
void 0,
|
|
5364
|
+
ts.factory.createVariableDeclarationList(
|
|
5365
|
+
[ts.factory.createVariableDeclaration(
|
|
5366
|
+
"_this",
|
|
5367
|
+
void 0,
|
|
5368
|
+
void 0,
|
|
5369
|
+
constructThis
|
|
5370
|
+
)],
|
|
5371
|
+
ts.NodeFlags.Const
|
|
5372
|
+
)
|
|
5373
|
+
);
|
|
5374
|
+
}
|
|
5375
|
+
if (ts.isToken(node2) && node2.kind === ts.SyntaxKind.ThisKeyword) {
|
|
5376
|
+
return ts.factory.createIdentifier("_this");
|
|
5377
|
+
}
|
|
5378
|
+
return ts.visitEachChild(node2, visitor, ts.nullTransformationContext);
|
|
5379
|
+
};
|
|
5380
|
+
const newBody = visitor(member.body);
|
|
5381
|
+
const bodyWithReturn = ts.factory.updateBlock(
|
|
5382
|
+
newBody,
|
|
5383
|
+
newBody.statements.concat([
|
|
5384
|
+
ts.factory.createReturnStatement(ts.factory.createIdentifier("_this"))
|
|
5385
|
+
])
|
|
5386
|
+
);
|
|
5387
|
+
const newMethod = ts.factory.createMethodDeclaration(
|
|
5388
|
+
ts.factory.createModifiersFromModifierFlags(ts.ModifierFlags.Public | ts.ModifierFlags.Static),
|
|
5389
|
+
void 0,
|
|
5390
|
+
"new",
|
|
5391
|
+
void 0,
|
|
5392
|
+
member.typeParameters,
|
|
5393
|
+
member.parameters,
|
|
5394
|
+
member.type,
|
|
5395
|
+
bodyWithReturn
|
|
5396
|
+
);
|
|
5397
|
+
changeTracker.replaceNode(sourceFile, member, newMethod);
|
|
5398
|
+
})
|
|
5399
|
+
};
|
|
5287
5400
|
report({
|
|
5288
5401
|
location: member,
|
|
5289
|
-
messageText: "Classes extending Schema must not override the constructor",
|
|
5290
|
-
fixes: [{
|
|
5402
|
+
messageText: "Classes extending Schema must not override the constructor; this is because it silently breaks the schema decoding behaviour. If that's needed, we recommend instead to use a static 'new' method that constructs the instance.",
|
|
5403
|
+
fixes: (member.body ? [fixAsStaticNew] : []).concat([{
|
|
5291
5404
|
fixName: "overriddenSchemaConstructor_fix",
|
|
5292
5405
|
description: "Remove the constructor override",
|
|
5293
5406
|
apply: gen(function* () {
|
|
5294
5407
|
const changeTracker = yield* service(ChangeTracker);
|
|
5295
5408
|
changeTracker.delete(sourceFile, member);
|
|
5296
5409
|
})
|
|
5297
|
-
}]
|
|
5410
|
+
}])
|
|
5298
5411
|
});
|
|
5299
5412
|
break;
|
|
5300
5413
|
}
|
|
@@ -5857,6 +5970,31 @@ var effectDiagnosticsComment = createCompletion({
|
|
|
5857
5970
|
})
|
|
5858
5971
|
});
|
|
5859
5972
|
|
|
5973
|
+
// src/completions/effectJsdocComment.ts
|
|
5974
|
+
var effectJsdocComment = createCompletion({
|
|
5975
|
+
name: "effectJsdocComment",
|
|
5976
|
+
apply: fn("effectJsdocComment")(function* (sourceFile, position) {
|
|
5977
|
+
const ts = yield* service(TypeScriptApi);
|
|
5978
|
+
const sourceText = sourceFile.text;
|
|
5979
|
+
const match2 = /(\/\/|\/\*(?:\*?))\s*(@)\s*$/id.exec(sourceText.substring(0, position));
|
|
5980
|
+
if (match2 && match2.indices) {
|
|
5981
|
+
const lastIndex = match2.indices[2][0];
|
|
5982
|
+
const replacementSpan = {
|
|
5983
|
+
start: lastIndex,
|
|
5984
|
+
length: Math.max(0, position - lastIndex)
|
|
5985
|
+
};
|
|
5986
|
+
return [{
|
|
5987
|
+
name: `@effect-identifier`,
|
|
5988
|
+
kind: ts.ScriptElementKind.string,
|
|
5989
|
+
insertText: "@effect-identifier",
|
|
5990
|
+
isSnippet: true,
|
|
5991
|
+
replacementSpan
|
|
5992
|
+
}];
|
|
5993
|
+
}
|
|
5994
|
+
return [];
|
|
5995
|
+
})
|
|
5996
|
+
});
|
|
5997
|
+
|
|
5860
5998
|
// src/completions/effectSchemaSelfInClasses.ts
|
|
5861
5999
|
var effectSchemaSelfInClasses = createCompletion({
|
|
5862
6000
|
name: "effectSchemaSelfInClasses",
|
|
@@ -6090,6 +6228,7 @@ var completions = [
|
|
|
6090
6228
|
effectDataClasses,
|
|
6091
6229
|
effectDiagnosticsComment,
|
|
6092
6230
|
effectCodegensComment,
|
|
6231
|
+
effectJsdocComment,
|
|
6093
6232
|
durationInput,
|
|
6094
6233
|
schemaBrand
|
|
6095
6234
|
];
|