@effect/language-service 0.17.1 → 0.18.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 +1 -1
- package/index.js +321 -225
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +248 -118
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all3) => {
|
|
|
5
5
|
__defProp(target, name, { get: all3[name], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
// node_modules/.pnpm/effect@3.
|
|
8
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Function.js
|
|
9
9
|
var isFunction = (input) => typeof input === "function";
|
|
10
10
|
var dual = function(arity, body) {
|
|
11
11
|
if (typeof arity === "function") {
|
|
@@ -102,7 +102,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
// node_modules/.pnpm/effect@3.
|
|
105
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Either.js
|
|
106
106
|
var Either_exports = {};
|
|
107
107
|
__export(Either_exports, {
|
|
108
108
|
Do: () => Do,
|
|
@@ -139,11 +139,14 @@ __export(Either_exports, {
|
|
|
139
139
|
merge: () => merge,
|
|
140
140
|
orElse: () => orElse,
|
|
141
141
|
right: () => right2,
|
|
142
|
+
transposeMapOption: () => transposeMapOption,
|
|
143
|
+
transposeOption: () => transposeOption,
|
|
142
144
|
try: () => try_,
|
|
145
|
+
void: () => void_,
|
|
143
146
|
zipWith: () => zipWith
|
|
144
147
|
});
|
|
145
148
|
|
|
146
|
-
// node_modules/.pnpm/effect@3.
|
|
149
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Equivalence.js
|
|
147
150
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
148
151
|
var array = (item) => make((self, that) => {
|
|
149
152
|
if (self.length !== that.length) {
|
|
@@ -158,7 +161,7 @@ var array = (item) => make((self, that) => {
|
|
|
158
161
|
return true;
|
|
159
162
|
});
|
|
160
163
|
|
|
161
|
-
// node_modules/.pnpm/effect@3.
|
|
164
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/internal/doNotation.js
|
|
162
165
|
var let_ = (map5) => dual(3, (self, name, f) => map5(self, (a) => Object.assign({}, a, {
|
|
163
166
|
[name]: f(a)
|
|
164
167
|
})));
|
|
@@ -169,11 +172,11 @@ var bind = (map5, flatMap4) => dual(3, (self, name, f) => flatMap4(self, (a) =>
|
|
|
169
172
|
[name]: b
|
|
170
173
|
}))));
|
|
171
174
|
|
|
172
|
-
// node_modules/.pnpm/effect@3.
|
|
173
|
-
var moduleVersion = "3.
|
|
175
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/internal/version.js
|
|
176
|
+
var moduleVersion = "3.16.3";
|
|
174
177
|
var getCurrentVersion = () => moduleVersion;
|
|
175
178
|
|
|
176
|
-
// node_modules/.pnpm/effect@3.
|
|
179
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/GlobalValue.js
|
|
177
180
|
var globalStoreId = `effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`;
|
|
178
181
|
var globalStore;
|
|
179
182
|
var globalValue = (id, compute) => {
|
|
@@ -187,16 +190,19 @@ var globalValue = (id, compute) => {
|
|
|
187
190
|
return globalStore.get(id);
|
|
188
191
|
};
|
|
189
192
|
|
|
190
|
-
// node_modules/.pnpm/effect@3.
|
|
193
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Predicate.js
|
|
194
|
+
var isString = (input) => typeof input === "string";
|
|
195
|
+
var isNumber = (input) => typeof input === "number";
|
|
196
|
+
var isBoolean = (input) => typeof input === "boolean";
|
|
191
197
|
var isFunction2 = isFunction;
|
|
192
198
|
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
193
199
|
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
194
200
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
195
201
|
|
|
196
|
-
// node_modules/.pnpm/effect@3.
|
|
202
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/internal/errors.js
|
|
197
203
|
var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
|
|
198
204
|
|
|
199
|
-
// node_modules/.pnpm/effect@3.
|
|
205
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Utils.js
|
|
200
206
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
201
207
|
var isGenKind = (u) => isObject(u) && GenKindTypeId in u;
|
|
202
208
|
var GenKindImpl = class {
|
|
@@ -314,10 +320,25 @@ var structuralRegionState = /* @__PURE__ */ globalValue("effect/Utils/isStructur
|
|
|
314
320
|
enabled: false,
|
|
315
321
|
tester: void 0
|
|
316
322
|
}));
|
|
323
|
+
var standard = {
|
|
324
|
+
effect_internal_function: (body) => {
|
|
325
|
+
return body();
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
var forced = {
|
|
329
|
+
effect_internal_function: (body) => {
|
|
330
|
+
try {
|
|
331
|
+
return body();
|
|
332
|
+
} finally {
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
var isNotOptimizedAway = /* @__PURE__ */ standard.effect_internal_function(() => new Error().stack)?.includes("effect_internal_function") === true;
|
|
337
|
+
var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forced.effect_internal_function;
|
|
317
338
|
var genConstructor = function* () {
|
|
318
339
|
}.constructor;
|
|
319
340
|
|
|
320
|
-
// node_modules/.pnpm/effect@3.
|
|
341
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Hash.js
|
|
321
342
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
322
343
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
323
344
|
var hash = (self) => {
|
|
@@ -343,6 +364,8 @@ var hash = (self) => {
|
|
|
343
364
|
return string("null");
|
|
344
365
|
} else if (self instanceof Date) {
|
|
345
366
|
return hash(self.toISOString());
|
|
367
|
+
} else if (self instanceof URL) {
|
|
368
|
+
return hash(self.href);
|
|
346
369
|
} else if (isHash(self)) {
|
|
347
370
|
return self[symbol]();
|
|
348
371
|
} else {
|
|
@@ -414,7 +437,7 @@ var cached = function() {
|
|
|
414
437
|
return hash2;
|
|
415
438
|
};
|
|
416
439
|
|
|
417
|
-
// node_modules/.pnpm/effect@3.
|
|
440
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Equal.js
|
|
418
441
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
419
442
|
function equals() {
|
|
420
443
|
if (arguments.length === 1) {
|
|
@@ -440,6 +463,8 @@ function compareBoth(self, that) {
|
|
|
440
463
|
}
|
|
441
464
|
} else if (self instanceof Date && that instanceof Date) {
|
|
442
465
|
return self.toISOString() === that.toISOString();
|
|
466
|
+
} else if (self instanceof URL && that instanceof URL) {
|
|
467
|
+
return self.href === that.href;
|
|
443
468
|
}
|
|
444
469
|
}
|
|
445
470
|
if (structuralRegionState.enabled) {
|
|
@@ -465,7 +490,7 @@ function compareBoth(self, that) {
|
|
|
465
490
|
}
|
|
466
491
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
467
492
|
|
|
468
|
-
// node_modules/.pnpm/effect@3.
|
|
493
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Inspectable.js
|
|
469
494
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
470
495
|
var toJSON = (x) => {
|
|
471
496
|
try {
|
|
@@ -474,7 +499,7 @@ var toJSON = (x) => {
|
|
|
474
499
|
} else if (Array.isArray(x)) {
|
|
475
500
|
return x.map(toJSON);
|
|
476
501
|
}
|
|
477
|
-
} catch
|
|
502
|
+
} catch {
|
|
478
503
|
return {};
|
|
479
504
|
}
|
|
480
505
|
return redact(x);
|
|
@@ -517,7 +542,7 @@ var redact = (u) => {
|
|
|
517
542
|
return u;
|
|
518
543
|
};
|
|
519
544
|
|
|
520
|
-
// node_modules/.pnpm/effect@3.
|
|
545
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Pipeable.js
|
|
521
546
|
var pipeArguments = (self, args) => {
|
|
522
547
|
switch (args.length) {
|
|
523
548
|
case 0:
|
|
@@ -550,10 +575,10 @@ var pipeArguments = (self, args) => {
|
|
|
550
575
|
}
|
|
551
576
|
};
|
|
552
577
|
|
|
553
|
-
// node_modules/.pnpm/effect@3.
|
|
578
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/internal/opCodes/effect.js
|
|
554
579
|
var OP_COMMIT = "Commit";
|
|
555
580
|
|
|
556
|
-
// node_modules/.pnpm/effect@3.
|
|
581
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/internal/effectable.js
|
|
557
582
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
558
583
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
559
584
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
@@ -640,7 +665,7 @@ var StructuralCommitPrototype = {
|
|
|
640
665
|
...StructuralPrototype
|
|
641
666
|
};
|
|
642
667
|
|
|
643
|
-
// node_modules/.pnpm/effect@3.
|
|
668
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/internal/option.js
|
|
644
669
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
645
670
|
var CommonProto = {
|
|
646
671
|
...EffectPrototype,
|
|
@@ -698,7 +723,7 @@ var some = (value) => {
|
|
|
698
723
|
return a;
|
|
699
724
|
};
|
|
700
725
|
|
|
701
|
-
// node_modules/.pnpm/effect@3.
|
|
726
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/internal/either.js
|
|
702
727
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
703
728
|
var CommonProto2 = {
|
|
704
729
|
...EffectPrototype,
|
|
@@ -763,9 +788,10 @@ var getLeft = (self) => isRight(self) ? none : some(self.left);
|
|
|
763
788
|
var getRight = (self) => isLeft(self) ? none : some(self.right);
|
|
764
789
|
var fromOption = /* @__PURE__ */ dual(2, (self, onNone) => isNone(self) ? left(onNone()) : right(self.value));
|
|
765
790
|
|
|
766
|
-
// node_modules/.pnpm/effect@3.
|
|
791
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Either.js
|
|
767
792
|
var TypeId3 = TypeId2;
|
|
768
793
|
var right2 = right;
|
|
794
|
+
var void_ = /* @__PURE__ */ right2(void 0);
|
|
769
795
|
var left2 = left;
|
|
770
796
|
var fromNullable = /* @__PURE__ */ dual(2, (self, onNullable) => self == null ? left2(onNullable(self)) : right2(self));
|
|
771
797
|
var fromOption2 = fromOption;
|
|
@@ -854,47 +880,31 @@ var gen = (...args) => {
|
|
|
854
880
|
const f = args.length === 1 ? args[0] : args[1].bind(args[0]);
|
|
855
881
|
const iterator = f(adapter2);
|
|
856
882
|
let state = iterator.next();
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
} else {
|
|
860
|
-
let current = state.value;
|
|
861
|
-
if (isGenKind(current)) {
|
|
862
|
-
current = current.value;
|
|
863
|
-
} else {
|
|
864
|
-
current = yieldWrapGet(current);
|
|
865
|
-
}
|
|
883
|
+
while (!state.done) {
|
|
884
|
+
const current = isGenKind(state.value) ? state.value.value : yieldWrapGet(state.value);
|
|
866
885
|
if (isLeft2(current)) {
|
|
867
886
|
return current;
|
|
868
887
|
}
|
|
869
|
-
|
|
870
|
-
state = iterator.next(current.right);
|
|
871
|
-
if (!state.done) {
|
|
872
|
-
current = state.value;
|
|
873
|
-
if (isGenKind(current)) {
|
|
874
|
-
current = current.value;
|
|
875
|
-
} else {
|
|
876
|
-
current = yieldWrapGet(current);
|
|
877
|
-
}
|
|
878
|
-
if (isLeft2(current)) {
|
|
879
|
-
return current;
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
return right2(state.value);
|
|
888
|
+
state = iterator.next(current.right);
|
|
884
889
|
}
|
|
890
|
+
return right2(state.value);
|
|
885
891
|
};
|
|
886
892
|
var Do = /* @__PURE__ */ right2({});
|
|
887
893
|
var bind2 = /* @__PURE__ */ bind(map, flatMap);
|
|
888
894
|
var bindTo2 = /* @__PURE__ */ bindTo(map);
|
|
889
895
|
var let_2 = /* @__PURE__ */ let_(map);
|
|
896
|
+
var transposeOption = (self) => {
|
|
897
|
+
return isNone(self) ? right2(none) : map(self.value, some);
|
|
898
|
+
};
|
|
899
|
+
var transposeMapOption = /* @__PURE__ */ dual(2, (self, f) => isNone(self) ? right2(none) : map(f(self.value), some));
|
|
890
900
|
|
|
891
|
-
// node_modules/.pnpm/effect@3.
|
|
901
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/internal/array.js
|
|
892
902
|
var isNonEmptyArray = (self) => self.length > 0;
|
|
893
903
|
|
|
894
|
-
// node_modules/.pnpm/effect@3.
|
|
904
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Order.js
|
|
895
905
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
896
906
|
|
|
897
|
-
// node_modules/.pnpm/effect@3.
|
|
907
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Option.js
|
|
898
908
|
var none2 = () => none;
|
|
899
909
|
var some2 = some;
|
|
900
910
|
var isNone2 = isNone;
|
|
@@ -909,21 +919,21 @@ var fromNullable2 = (nullableValue) => nullableValue == null ? none2() : some2(n
|
|
|
909
919
|
var getOrUndefined2 = /* @__PURE__ */ getOrElse2(constUndefined);
|
|
910
920
|
var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
|
|
911
921
|
|
|
912
|
-
// node_modules/.pnpm/effect@3.
|
|
922
|
+
// node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Array.js
|
|
913
923
|
var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
914
924
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
915
925
|
var isArray = Array.isArray;
|
|
916
926
|
var isEmptyArray = (self) => self.length === 0;
|
|
917
927
|
var isEmptyReadonlyArray = isEmptyArray;
|
|
918
928
|
var isNonEmptyReadonlyArray = isNonEmptyArray;
|
|
919
|
-
var
|
|
929
|
+
var isOutOfBounds = (i, as) => i < 0 || i >= as.length;
|
|
920
930
|
var get = /* @__PURE__ */ dual(2, (self, index) => {
|
|
921
931
|
const i = Math.floor(index);
|
|
922
|
-
return
|
|
932
|
+
return isOutOfBounds(i, self) ? none2() : some2(self[i]);
|
|
923
933
|
});
|
|
924
934
|
var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
|
|
925
935
|
const i = Math.floor(index);
|
|
926
|
-
if (
|
|
936
|
+
if (isOutOfBounds(i, self)) {
|
|
927
937
|
throw new Error(`Index ${i} out of bounds`);
|
|
928
938
|
}
|
|
929
939
|
return self[i];
|
|
@@ -1414,7 +1424,10 @@ var parseDataForExtendsClassCompletion = fn(
|
|
|
1414
1424
|
"AST.parseDataForExtendsClassCompletion"
|
|
1415
1425
|
)(function* (sourceFile, position) {
|
|
1416
1426
|
const ts = yield* service(TypeScriptApi);
|
|
1417
|
-
const { accessedObject, outerNode, replacementSpan } = yield* parseAccessedExpressionForCompletion(
|
|
1427
|
+
const { accessedObject, outerNode, replacementSpan } = yield* parseAccessedExpressionForCompletion(
|
|
1428
|
+
sourceFile,
|
|
1429
|
+
position
|
|
1430
|
+
);
|
|
1418
1431
|
if (!ts.isIdentifier(accessedObject)) return yield* fail(new NodeNotFoundError());
|
|
1419
1432
|
let classDeclaration = outerNode.parent;
|
|
1420
1433
|
while (ts.isExpressionWithTypeArguments(classDeclaration) || ts.isHeritageClause(classDeclaration)) {
|
|
@@ -1482,29 +1495,20 @@ function createRefactor(definition) {
|
|
|
1482
1495
|
function createDiagnostic(definition) {
|
|
1483
1496
|
return definition;
|
|
1484
1497
|
}
|
|
1485
|
-
function parsePluginOptions(config) {
|
|
1486
|
-
return {
|
|
1487
|
-
diagnostics: config && "diagnostics" in config && typeof config.diagnostics === "boolean" ? config.diagnostics : true,
|
|
1488
|
-
quickinfo: config && "quickinfo" in config && typeof config.quickinfo === "boolean" ? config.quickinfo : true,
|
|
1489
|
-
completions: config && "completions" in config && typeof config.completions === "boolean" ? config.completions : true,
|
|
1490
|
-
multipleEffectCheck: config && "multipleEffectCheck" in config && typeof config.multipleEffectCheck === "boolean" ? config.multipleEffectCheck : true
|
|
1491
|
-
};
|
|
1492
|
-
}
|
|
1493
1498
|
function createCompletion(definition) {
|
|
1494
1499
|
return definition;
|
|
1495
1500
|
}
|
|
1496
|
-
var PluginOptions = Tag("PluginOptions");
|
|
1497
1501
|
var getSemanticDiagnosticsWithCodeFixes = fn(
|
|
1498
1502
|
"LSP.getSemanticDiagnosticsWithCodeFixes"
|
|
1499
1503
|
)(function* (rules, sourceFile) {
|
|
1500
|
-
|
|
1501
|
-
|
|
1504
|
+
let effectDiagnostics = [];
|
|
1505
|
+
let effectCodeFixes = [];
|
|
1502
1506
|
const executor = yield* createDiagnosticExecutor(sourceFile);
|
|
1503
1507
|
for (const rule of rules) {
|
|
1504
1508
|
const result = yield* option(executor.execute(rule));
|
|
1505
1509
|
if (isSome2(result)) {
|
|
1506
|
-
effectDiagnostics.
|
|
1507
|
-
|
|
1510
|
+
effectDiagnostics = effectDiagnostics.concat(
|
|
1511
|
+
pipe(
|
|
1508
1512
|
result.value,
|
|
1509
1513
|
map3((_) => ({
|
|
1510
1514
|
file: sourceFile,
|
|
@@ -1517,8 +1521,8 @@ var getSemanticDiagnosticsWithCodeFixes = fn(
|
|
|
1517
1521
|
}))
|
|
1518
1522
|
)
|
|
1519
1523
|
);
|
|
1520
|
-
effectCodeFixes.
|
|
1521
|
-
|
|
1524
|
+
effectCodeFixes = effectCodeFixes.concat(
|
|
1525
|
+
pipe(
|
|
1522
1526
|
result.value,
|
|
1523
1527
|
map3(
|
|
1524
1528
|
(_) => map3(
|
|
@@ -1541,6 +1545,9 @@ var getSemanticDiagnosticsWithCodeFixes = fn(
|
|
|
1541
1545
|
codeFixes: effectCodeFixes
|
|
1542
1546
|
};
|
|
1543
1547
|
});
|
|
1548
|
+
function refactorNameToFullyQualifiedName(name) {
|
|
1549
|
+
return `@effect/language-service/refactors/${name}`;
|
|
1550
|
+
}
|
|
1544
1551
|
var getApplicableRefactors = fn("LSP.getApplicableRefactors")(function* (refactors2, sourceFile, positionOrRange) {
|
|
1545
1552
|
const textRange = typeof positionOrRange === "number" ? { pos: positionOrRange, end: positionOrRange } : positionOrRange;
|
|
1546
1553
|
const effectRefactors = [];
|
|
@@ -1548,10 +1555,10 @@ var getApplicableRefactors = fn("LSP.getApplicableRefactors")(function* (refacto
|
|
|
1548
1555
|
const result = yield* option(refactor.apply(sourceFile, textRange));
|
|
1549
1556
|
if (isSome2(result)) {
|
|
1550
1557
|
effectRefactors.push({
|
|
1551
|
-
name: refactor.name,
|
|
1558
|
+
name: refactorNameToFullyQualifiedName(refactor.name),
|
|
1552
1559
|
description: refactor.description,
|
|
1553
1560
|
actions: [{
|
|
1554
|
-
name: refactor.name,
|
|
1561
|
+
name: refactorNameToFullyQualifiedName(refactor.name),
|
|
1555
1562
|
description: result.value.description,
|
|
1556
1563
|
kind: result.value.kind
|
|
1557
1564
|
}]
|
|
@@ -1561,7 +1568,7 @@ var getApplicableRefactors = fn("LSP.getApplicableRefactors")(function* (refacto
|
|
|
1561
1568
|
return effectRefactors;
|
|
1562
1569
|
});
|
|
1563
1570
|
var getEditsForRefactor = fn("LSP.getEditsForRefactor")(function* (refactors2, sourceFile, positionOrRange, refactorName) {
|
|
1564
|
-
const refactor = refactors2.find((refactor2) => refactor2.name === refactorName);
|
|
1571
|
+
const refactor = refactors2.find((refactor2) => refactorNameToFullyQualifiedName(refactor2.name) === refactorName);
|
|
1565
1572
|
if (!refactor) {
|
|
1566
1573
|
return yield* fail(new RefactorNotApplicableError());
|
|
1567
1574
|
}
|
|
@@ -1569,11 +1576,11 @@ var getEditsForRefactor = fn("LSP.getEditsForRefactor")(function* (refactors2, s
|
|
|
1569
1576
|
return yield* refactor.apply(sourceFile, textRange);
|
|
1570
1577
|
});
|
|
1571
1578
|
var getCompletionsAtPosition = fn("LSP.getCompletionsAtPosition")(function* (completions2, sourceFile, position, options, formatCodeSettings) {
|
|
1572
|
-
|
|
1579
|
+
let effectCompletions = [];
|
|
1573
1580
|
for (const completion of completions2) {
|
|
1574
1581
|
const result = yield* completion.apply(sourceFile, position, options, formatCodeSettings);
|
|
1575
|
-
effectCompletions.
|
|
1576
|
-
|
|
1582
|
+
effectCompletions = effectCompletions.concat(
|
|
1583
|
+
result.map((_) => ({ sortText: "11", ..._ }))
|
|
1577
1584
|
);
|
|
1578
1585
|
}
|
|
1579
1586
|
return effectCompletions;
|
|
@@ -1581,27 +1588,74 @@ var getCompletionsAtPosition = fn("LSP.getCompletionsAtPosition")(function* (com
|
|
|
1581
1588
|
var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
1582
1589
|
function* (sourceFile) {
|
|
1583
1590
|
const ts = yield* service(TypeScriptApi);
|
|
1584
|
-
|
|
1591
|
+
function findNodeWithLeadingCommentAtPosition(position) {
|
|
1592
|
+
const sourceText = sourceFile.text;
|
|
1593
|
+
let result;
|
|
1594
|
+
function find(node) {
|
|
1595
|
+
const leading = ts.getLeadingCommentRanges(sourceText, node.getFullStart());
|
|
1596
|
+
if (leading) {
|
|
1597
|
+
for (const r of leading) {
|
|
1598
|
+
if (r.pos <= position && position < r.end) {
|
|
1599
|
+
result = node;
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
if (node.getFullStart() <= position && position < node.getEnd()) {
|
|
1605
|
+
node.forEachChild(find);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
find(sourceFile);
|
|
1609
|
+
return result;
|
|
1610
|
+
}
|
|
1611
|
+
function findParentStatementForDisableNextLine(node) {
|
|
1612
|
+
let result;
|
|
1613
|
+
function find(node2) {
|
|
1614
|
+
if (ts.isStatement(node2)) {
|
|
1615
|
+
result = node2;
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
if (result) return;
|
|
1619
|
+
if (node2.parent) find(node2.parent);
|
|
1620
|
+
}
|
|
1621
|
+
find(node);
|
|
1622
|
+
return result || node;
|
|
1623
|
+
}
|
|
1624
|
+
const lineOverrides = {};
|
|
1625
|
+
const sectionOverrides = {};
|
|
1585
1626
|
const skippedRules = [];
|
|
1586
|
-
const regex = /@effect-diagnostics((?:\s[a-zA-Z0-9/]+:(?:off|warning|error|message|suggestion|skip-file))+)?/gm;
|
|
1627
|
+
const regex = /@effect-diagnostics(-next-line)?((?:\s[a-zA-Z0-9/]+:(?:off|warning|error|message|suggestion|skip-file))+)?/gm;
|
|
1587
1628
|
let match3;
|
|
1588
1629
|
while ((match3 = regex.exec(sourceFile.text)) !== null) {
|
|
1589
|
-
const
|
|
1630
|
+
const nextLineCaptureGroup = match3[1];
|
|
1631
|
+
const rulesCaptureGroup = match3[2];
|
|
1590
1632
|
if (rulesCaptureGroup) {
|
|
1591
1633
|
const trimmedRuleString = rulesCaptureGroup.trim();
|
|
1592
1634
|
if (trimmedRuleString) {
|
|
1593
1635
|
const individualRules = trimmedRuleString.split(/\s+/);
|
|
1594
1636
|
for (const rulePair of individualRules) {
|
|
1595
|
-
const [
|
|
1637
|
+
const [rawRuleName, ruleLevel] = rulePair.toLowerCase().split(":");
|
|
1638
|
+
const ruleName = rawRuleName.startsWith("effect/") ? rawRuleName.substring("effect/".length) : rawRuleName;
|
|
1596
1639
|
if (ruleName && ruleLevel) {
|
|
1597
1640
|
if (ruleLevel === "skip-file") skippedRules.push(ruleName);
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1641
|
+
const isOverrideNextLine = nextLineCaptureGroup && nextLineCaptureGroup.trim().toLowerCase() === "-next-line";
|
|
1642
|
+
if (isOverrideNextLine) {
|
|
1643
|
+
const node = findNodeWithLeadingCommentAtPosition(match3.index);
|
|
1644
|
+
if (node) {
|
|
1645
|
+
lineOverrides[ruleName] = lineOverrides[ruleName] || [];
|
|
1646
|
+
lineOverrides[ruleName].unshift({
|
|
1647
|
+
pos: node.getFullStart(),
|
|
1648
|
+
end: node.end,
|
|
1649
|
+
level: ruleLevel
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
} else {
|
|
1653
|
+
sectionOverrides[ruleName] = sectionOverrides[ruleName] || [];
|
|
1654
|
+
sectionOverrides[ruleName].unshift({
|
|
1655
|
+
pos: match3.index,
|
|
1656
|
+
level: ruleLevel
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1605
1659
|
}
|
|
1606
1660
|
}
|
|
1607
1661
|
}
|
|
@@ -1617,22 +1671,46 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1617
1671
|
const ruleNameLowered = rule.name.toLowerCase();
|
|
1618
1672
|
if (skippedRules.indexOf(ruleNameLowered) > -1) return [];
|
|
1619
1673
|
let modifiedDiagnostics = yield* rule.apply(sourceFile);
|
|
1620
|
-
for (const
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1674
|
+
for (const emitted of modifiedDiagnostics.slice(0)) {
|
|
1675
|
+
let newLevel = void 0;
|
|
1676
|
+
if (!(ruleNameLowered in sectionOverrides || ruleNameLowered in lineOverrides)) continue;
|
|
1677
|
+
const lineOverride = (lineOverrides[ruleNameLowered] || []).find(
|
|
1678
|
+
(_) => _.pos < emitted.node.getStart(sourceFile) && _.end >= emitted.node.getEnd()
|
|
1679
|
+
);
|
|
1680
|
+
if (lineOverride) {
|
|
1681
|
+
newLevel = lineOverride.level;
|
|
1682
|
+
} else {
|
|
1683
|
+
const sectionOverride = (sectionOverrides[ruleNameLowered] || []).find(
|
|
1684
|
+
(_) => _.pos < emitted.node.getStart(sourceFile)
|
|
1624
1685
|
);
|
|
1686
|
+
if (sectionOverride) newLevel = sectionOverride.level;
|
|
1687
|
+
}
|
|
1688
|
+
if (newLevel === "off") {
|
|
1689
|
+
modifiedDiagnostics = modifiedDiagnostics.filter((_) => _ !== emitted);
|
|
1625
1690
|
} else {
|
|
1626
|
-
|
|
1627
|
-
(_) => _.node.getStart(sourceFile) >= override.start && _.node.getEnd() <= override.end
|
|
1628
|
-
)) {
|
|
1629
|
-
message.category = override.level in levelToDiagnosticCategory ? levelToDiagnosticCategory[override.level] : message.category;
|
|
1630
|
-
}
|
|
1691
|
+
emitted.category = newLevel && newLevel in levelToDiagnosticCategory ? levelToDiagnosticCategory[newLevel] : emitted.category;
|
|
1631
1692
|
}
|
|
1632
1693
|
}
|
|
1694
|
+
const fixByDisableNextLine = (_) => ({
|
|
1695
|
+
fixName: rule.name + "_skipNextLine",
|
|
1696
|
+
description: "Disable " + rule.name + " for this line",
|
|
1697
|
+
apply: flatMap3(
|
|
1698
|
+
service(ChangeTracker),
|
|
1699
|
+
(changeTracker) => sync(() => {
|
|
1700
|
+
const disableAtNode = findParentStatementForDisableNextLine(_.node);
|
|
1701
|
+
const { line } = ts.getLineAndCharacterOfPosition(sourceFile, disableAtNode.getStart());
|
|
1702
|
+
changeTracker.insertCommentBeforeLine(
|
|
1703
|
+
sourceFile,
|
|
1704
|
+
line,
|
|
1705
|
+
disableAtNode.getStart(),
|
|
1706
|
+
` @effect-diagnostics-next-line ${rule.name}:off`
|
|
1707
|
+
);
|
|
1708
|
+
})
|
|
1709
|
+
)
|
|
1710
|
+
});
|
|
1633
1711
|
const fixByDisableEntireFile = {
|
|
1634
1712
|
fixName: rule.name + "_skipFile",
|
|
1635
|
-
description: "Disable " + rule.name + " for this file",
|
|
1713
|
+
description: "Disable " + rule.name + " for this entire file",
|
|
1636
1714
|
apply: flatMap3(
|
|
1637
1715
|
service(ChangeTracker),
|
|
1638
1716
|
(changeTracker) => sync(
|
|
@@ -1647,7 +1725,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1647
1725
|
};
|
|
1648
1726
|
const rulesWithDisableFix = modifiedDiagnostics.map((diagnostic) => ({
|
|
1649
1727
|
...diagnostic,
|
|
1650
|
-
fixes: diagnostic.fixes.concat([fixByDisableEntireFile])
|
|
1728
|
+
fixes: diagnostic.fixes.concat([fixByDisableNextLine(diagnostic), fixByDisableEntireFile])
|
|
1651
1729
|
}));
|
|
1652
1730
|
return rulesWithDisableFix;
|
|
1653
1731
|
});
|
|
@@ -1657,7 +1735,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1657
1735
|
|
|
1658
1736
|
// src/completions/contextSelfInClasses.ts
|
|
1659
1737
|
var contextSelfInClasses = createCompletion({
|
|
1660
|
-
name: "
|
|
1738
|
+
name: "contextSelfInClasses",
|
|
1661
1739
|
apply: fn("contextSelfInClasses")(function* (sourceFile, position) {
|
|
1662
1740
|
const ts = yield* service(TypeScriptApi);
|
|
1663
1741
|
const maybeInfos = yield* option(
|
|
@@ -1690,7 +1768,7 @@ var contextSelfInClasses = createCompletion({
|
|
|
1690
1768
|
|
|
1691
1769
|
// src/completions/effectDataClasses.ts
|
|
1692
1770
|
var effectDataClasses = createCompletion({
|
|
1693
|
-
name: "
|
|
1771
|
+
name: "effectDataClasses",
|
|
1694
1772
|
apply: fn("effectDataClasses")(function* (sourceFile, position) {
|
|
1695
1773
|
const ts = yield* service(TypeScriptApi);
|
|
1696
1774
|
const maybeInfos = yield* option(
|
|
@@ -1729,7 +1807,7 @@ var effectDataClasses = createCompletion({
|
|
|
1729
1807
|
|
|
1730
1808
|
// src/completions/effectSchemaSelfInClasses.ts
|
|
1731
1809
|
var effectSchemaSelfInClasses = createCompletion({
|
|
1732
|
-
name: "
|
|
1810
|
+
name: "effectSchemaSelfInClasses",
|
|
1733
1811
|
apply: fn("effectSchemaSelfInClasses")(function* (sourceFile, position) {
|
|
1734
1812
|
const ts = yield* service(TypeScriptApi);
|
|
1735
1813
|
const maybeInfos = yield* option(
|
|
@@ -1780,7 +1858,7 @@ var effectSchemaSelfInClasses = createCompletion({
|
|
|
1780
1858
|
|
|
1781
1859
|
// src/completions/effectSelfInClasses.ts
|
|
1782
1860
|
var effectSelfInClasses = createCompletion({
|
|
1783
|
-
name: "
|
|
1861
|
+
name: "effectSelfInClasses",
|
|
1784
1862
|
apply: fn("effectSelfInClasses")(function* (sourceFile, position) {
|
|
1785
1863
|
const ts = yield* service(TypeScriptApi);
|
|
1786
1864
|
const maybeInfos = yield* option(
|
|
@@ -1835,12 +1913,12 @@ var getMissingTypeEntriesInTargetType = fn(
|
|
|
1835
1913
|
function* (realType, expectedType) {
|
|
1836
1914
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
1837
1915
|
const result = [];
|
|
1838
|
-
|
|
1916
|
+
let toTest = [realType];
|
|
1839
1917
|
while (toTest.length > 0) {
|
|
1840
1918
|
const type = toTest.pop();
|
|
1841
1919
|
if (!type) return result;
|
|
1842
1920
|
if (type.isUnion()) {
|
|
1843
|
-
toTest.
|
|
1921
|
+
toTest = toTest.concat(type.types);
|
|
1844
1922
|
} else {
|
|
1845
1923
|
const assignable = typeChecker.isTypeAssignableTo(type, expectedType);
|
|
1846
1924
|
if (!assignable) {
|
|
@@ -2121,9 +2199,10 @@ var fiberType = fn("TypeParser.fiberType")(function* (type, atLocation) {
|
|
|
2121
2199
|
var effectSubtype = fn("TypeParser.effectSubtype")(function* (type, atLocation) {
|
|
2122
2200
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
2123
2201
|
const tagSymbol = typeChecker.getPropertyOfType(type, "_tag");
|
|
2124
|
-
|
|
2202
|
+
const getSymbol = typeChecker.getPropertyOfType(type, "get");
|
|
2203
|
+
if (!(tagSymbol || getSymbol)) {
|
|
2125
2204
|
return yield* typeParserIssue(
|
|
2126
|
-
"Type is not a subtype of effect because it does not have '_tag' property",
|
|
2205
|
+
"Type is not a subtype of effect because it does not have '_tag' or 'get' property",
|
|
2127
2206
|
type,
|
|
2128
2207
|
atLocation
|
|
2129
2208
|
);
|
|
@@ -2318,7 +2397,7 @@ var effectSchemaType = fn("TypeParser.effectSchemaType")(function* (type, atLoca
|
|
|
2318
2397
|
|
|
2319
2398
|
// src/completions/fnFunctionStar.ts
|
|
2320
2399
|
var fnFunctionStar = createCompletion({
|
|
2321
|
-
name: "
|
|
2400
|
+
name: "fnFunctionStar",
|
|
2322
2401
|
apply: fn("fnFunctionStar")(function* (sourceFile, position) {
|
|
2323
2402
|
const ts = yield* service(TypeScriptApi);
|
|
2324
2403
|
const maybeInfos = yield* option(
|
|
@@ -2367,7 +2446,7 @@ var fnFunctionStar = createCompletion({
|
|
|
2367
2446
|
|
|
2368
2447
|
// src/completions/genFunctionStar.ts
|
|
2369
2448
|
var genFunctionStar = createCompletion({
|
|
2370
|
-
name: "
|
|
2449
|
+
name: "genFunctionStar",
|
|
2371
2450
|
apply: fn("genFunctionStar")(function* (sourceFile, position) {
|
|
2372
2451
|
const ts = yield* service(TypeScriptApi);
|
|
2373
2452
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
@@ -2405,9 +2484,90 @@ var completions = [
|
|
|
2405
2484
|
effectDataClasses
|
|
2406
2485
|
];
|
|
2407
2486
|
|
|
2487
|
+
// src/core/LanguageServicePluginOptions.ts
|
|
2488
|
+
var LanguageServicePluginOptions = Tag("PluginOptions");
|
|
2489
|
+
function parse(config) {
|
|
2490
|
+
return {
|
|
2491
|
+
diagnostics: isObject(config) && hasProperty(config, "diagnostics") && isBoolean(config.diagnostics) ? config.diagnostics : true,
|
|
2492
|
+
quickinfo: isObject(config) && hasProperty(config, "quickinfo") && isBoolean(config.quickinfo) ? config.quickinfo : true,
|
|
2493
|
+
completions: isObject(config) && hasProperty(config, "completions") && isBoolean(config.completions) ? config.completions : true,
|
|
2494
|
+
allowedDuplicatedPackages: isObject(config) && hasProperty(config, "allowedDuplicatedPackages") && isArray(config.allowedDuplicatedPackages) && config.allowedDuplicatedPackages.every(isString) ? config.allowedDuplicatedPackages.map((_) => _.toLowerCase()) : []
|
|
2495
|
+
};
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
// src/diagnostics/duplicatePackage.ts
|
|
2499
|
+
var checkedPackagesCache = /* @__PURE__ */ new Map();
|
|
2500
|
+
var programResolvedCacheSize = /* @__PURE__ */ new Map();
|
|
2501
|
+
function parsePackageContentNameAndVersion(v) {
|
|
2502
|
+
if (!isObject(v)) return;
|
|
2503
|
+
if (!hasProperty(v, "packageJsonScope")) return;
|
|
2504
|
+
if (!v.packageJsonScope) return;
|
|
2505
|
+
const packageJsonScope = v.packageJsonScope;
|
|
2506
|
+
if (!hasProperty(packageJsonScope, "contents")) return;
|
|
2507
|
+
if (!hasProperty(packageJsonScope.contents, "packageJsonContent")) return;
|
|
2508
|
+
const packageJsonContent = packageJsonScope.contents.packageJsonContent;
|
|
2509
|
+
if (!hasProperty(packageJsonContent, "name")) return;
|
|
2510
|
+
if (!hasProperty(packageJsonContent, "version")) return;
|
|
2511
|
+
const { name, version } = packageJsonContent;
|
|
2512
|
+
if (!isString(name)) return;
|
|
2513
|
+
if (!isString(version)) return;
|
|
2514
|
+
const hasEffectInPeerDependencies = hasProperty(packageJsonContent, "peerDependencies") && isObject(packageJsonContent.peerDependencies) && hasProperty(packageJsonContent.peerDependencies, "effect");
|
|
2515
|
+
return {
|
|
2516
|
+
name: name.toLowerCase(),
|
|
2517
|
+
version: version.toLowerCase(),
|
|
2518
|
+
hasEffectInPeerDependencies,
|
|
2519
|
+
contents: packageJsonContent
|
|
2520
|
+
};
|
|
2521
|
+
}
|
|
2522
|
+
var duplicatePackage = createDiagnostic({
|
|
2523
|
+
name: "duplicatePackage",
|
|
2524
|
+
code: 6,
|
|
2525
|
+
apply: fn("duplicatePackage.apply")(function* (sourceFile) {
|
|
2526
|
+
const ts = yield* service(TypeScriptApi);
|
|
2527
|
+
const program = yield* service(TypeScriptProgram);
|
|
2528
|
+
const options = yield* service(LanguageServicePluginOptions);
|
|
2529
|
+
const effectDiagnostics = [];
|
|
2530
|
+
if (sourceFile.statements.length < 1) return [];
|
|
2531
|
+
let resolvedPackages = checkedPackagesCache.get(sourceFile.fileName) || {};
|
|
2532
|
+
const newResolvedModuleSize = hasProperty(program, "resolvedModules") && hasProperty(program.resolvedModules, "size") && isNumber(program.resolvedModules.size) ? program.resolvedModules.size : 0;
|
|
2533
|
+
const oldResolvedSize = programResolvedCacheSize.get(sourceFile.fileName) || -1;
|
|
2534
|
+
if (newResolvedModuleSize !== oldResolvedSize) {
|
|
2535
|
+
const seenPackages = /* @__PURE__ */ new Set();
|
|
2536
|
+
resolvedPackages = {};
|
|
2537
|
+
program.getSourceFiles().map((_) => {
|
|
2538
|
+
const packageInfo = parsePackageContentNameAndVersion(_);
|
|
2539
|
+
if (!packageInfo) return;
|
|
2540
|
+
const packageNameAndVersion = packageInfo.name + "@" + packageInfo.version;
|
|
2541
|
+
if (seenPackages.has(packageNameAndVersion)) return;
|
|
2542
|
+
seenPackages.add(packageNameAndVersion);
|
|
2543
|
+
if (!(packageInfo.name === "effect" || packageInfo.hasEffectInPeerDependencies)) return;
|
|
2544
|
+
if (options.allowedDuplicatedPackages.indexOf(packageInfo.name) > -1) return;
|
|
2545
|
+
resolvedPackages[packageInfo.name] = resolvedPackages[packageInfo.name] || {};
|
|
2546
|
+
resolvedPackages[packageInfo.name][packageInfo.version] = packageInfo.contents;
|
|
2547
|
+
});
|
|
2548
|
+
checkedPackagesCache.set(sourceFile.fileName, resolvedPackages);
|
|
2549
|
+
programResolvedCacheSize.set(sourceFile.fileName, newResolvedModuleSize);
|
|
2550
|
+
}
|
|
2551
|
+
for (const packageName of Object.keys(resolvedPackages)) {
|
|
2552
|
+
if (Object.keys(resolvedPackages[packageName]).length > 1) {
|
|
2553
|
+
const versions = Object.keys(resolvedPackages[packageName]);
|
|
2554
|
+
effectDiagnostics.push({
|
|
2555
|
+
node: sourceFile.statements[0],
|
|
2556
|
+
category: ts.DiagnosticCategory.Warning,
|
|
2557
|
+
messageText: `Package ${packageName} is referenced multiple times with different versions (${versions.join(", ")}) and may cause unexpected type errors.
|
|
2558
|
+
Cleanup your dependencies and your package lockfile to avoid multiple instances of this package and reload the project.
|
|
2559
|
+
If this is intended set the LSP config "allowedDuplicatedPackages" to ${JSON.stringify(options.allowedDuplicatedPackages.concat([packageName]))}.`,
|
|
2560
|
+
fixes: []
|
|
2561
|
+
});
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
return effectDiagnostics;
|
|
2565
|
+
})
|
|
2566
|
+
});
|
|
2567
|
+
|
|
2408
2568
|
// src/diagnostics/floatingEffect.ts
|
|
2409
2569
|
var floatingEffect = createDiagnostic({
|
|
2410
|
-
name: "
|
|
2570
|
+
name: "floatingEffect",
|
|
2411
2571
|
code: 3,
|
|
2412
2572
|
apply: fn("floatingEffect.apply")(function* (sourceFile) {
|
|
2413
2573
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -2416,7 +2576,7 @@ var floatingEffect = createDiagnostic({
|
|
|
2416
2576
|
if (!ts.isExpressionStatement(node)) return false;
|
|
2417
2577
|
if (!(ts.isBlock(node.parent) || ts.isSourceFile(node.parent))) return false;
|
|
2418
2578
|
const expression = node.expression;
|
|
2419
|
-
if (ts.isBinaryExpression(expression) && expression.operatorToken && expression.operatorToken.kind === ts.SyntaxKind.EqualsToken) return false;
|
|
2579
|
+
if (ts.isBinaryExpression(expression) && expression.operatorToken && (expression.operatorToken.kind === ts.SyntaxKind.EqualsToken || expression.operatorToken.kind === ts.SyntaxKind.QuestionQuestionEqualsToken || expression.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandEqualsToken || expression.operatorToken.kind === ts.SyntaxKind.BarBarEqualsToken)) return false;
|
|
2420
2580
|
return true;
|
|
2421
2581
|
}
|
|
2422
2582
|
const effectDiagnostics = [];
|
|
@@ -2454,7 +2614,7 @@ var floatingEffect = createDiagnostic({
|
|
|
2454
2614
|
|
|
2455
2615
|
// src/diagnostics/missingEffectContext.ts
|
|
2456
2616
|
var missingEffectContext = createDiagnostic({
|
|
2457
|
-
name: "
|
|
2617
|
+
name: "missingEffectContext",
|
|
2458
2618
|
code: 1,
|
|
2459
2619
|
apply: fn("missingEffectContext.apply")(function* (sourceFile) {
|
|
2460
2620
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -2506,7 +2666,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
2506
2666
|
|
|
2507
2667
|
// src/diagnostics/missingEffectError.ts
|
|
2508
2668
|
var missingEffectError = createDiagnostic({
|
|
2509
|
-
name: "
|
|
2669
|
+
name: "missingEffectError",
|
|
2510
2670
|
code: 1,
|
|
2511
2671
|
apply: fn("missingEffectError.apply")(function* (sourceFile) {
|
|
2512
2672
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -2558,7 +2718,7 @@ var missingEffectError = createDiagnostic({
|
|
|
2558
2718
|
|
|
2559
2719
|
// src/diagnostics/missingStarInYieldEffectGen.ts
|
|
2560
2720
|
var missingStarInYieldEffectGen = createDiagnostic({
|
|
2561
|
-
name: "
|
|
2721
|
+
name: "missingStarInYieldEffectGen",
|
|
2562
2722
|
code: 4,
|
|
2563
2723
|
apply: fn("missingStarInYieldEffectGen.apply")(function* (sourceFile) {
|
|
2564
2724
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -2577,7 +2737,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
2577
2737
|
if (ts.isYieldExpression(node) && node.expression && node.asteriskToken === void 0) {
|
|
2578
2738
|
const functionStarNode = ts.findAncestor(
|
|
2579
2739
|
node,
|
|
2580
|
-
(_) =>
|
|
2740
|
+
(_) => ts.isFunctionExpression(_) || ts.isFunctionDeclaration(_) || ts.isMethodDeclaration(_)
|
|
2581
2741
|
);
|
|
2582
2742
|
if (functionStarNode && functionStarNode.parent) {
|
|
2583
2743
|
const effectGenNode = functionStarNode.parent;
|
|
@@ -2631,51 +2791,9 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
2631
2791
|
})
|
|
2632
2792
|
});
|
|
2633
2793
|
|
|
2634
|
-
// src/diagnostics/multipleEffectVersions.ts
|
|
2635
|
-
var effectVersionsCache = /* @__PURE__ */ new Map();
|
|
2636
|
-
var programResolvedCacheSize = /* @__PURE__ */ new Map();
|
|
2637
|
-
var multipleEffectVersions = createDiagnostic({
|
|
2638
|
-
name: "effect/multipleEffectVersions",
|
|
2639
|
-
code: 6,
|
|
2640
|
-
apply: fn("multipleEffectVersions.apply")(function* (sourceFile) {
|
|
2641
|
-
const ts = yield* service(TypeScriptApi);
|
|
2642
|
-
const program = yield* service(TypeScriptProgram);
|
|
2643
|
-
const options = yield* service(PluginOptions);
|
|
2644
|
-
const effectDiagnostics = [];
|
|
2645
|
-
if (!options.multipleEffectCheck) return [];
|
|
2646
|
-
if (sourceFile.statements.length < 1) return [];
|
|
2647
|
-
const effectVersions = effectVersionsCache.get(sourceFile.fileName) || {};
|
|
2648
|
-
const newResolvedModuleSize = "resolvedModules" in program && typeof program.resolvedModules === "object" && "size" in program.resolvedModules ? program.resolvedModules.size : 0;
|
|
2649
|
-
const oldResolvedSize = programResolvedCacheSize.get(sourceFile.fileName) || 0;
|
|
2650
|
-
if (newResolvedModuleSize !== oldResolvedSize) {
|
|
2651
|
-
if ("forEachResolvedModule" in program && typeof program.forEachResolvedModule === "function") {
|
|
2652
|
-
program.forEachResolvedModule((_) => {
|
|
2653
|
-
if (_ && _.resolvedModule && _.resolvedModule.packageId && _.resolvedModule.packageId.name === "effect" && !(_.resolvedModule.packageId.version in effectVersions)) {
|
|
2654
|
-
effectVersions[_.resolvedModule.packageId.version] = {
|
|
2655
|
-
resolvedFileName: _.resolvedModule.resolvedFileName
|
|
2656
|
-
};
|
|
2657
|
-
}
|
|
2658
|
-
});
|
|
2659
|
-
}
|
|
2660
|
-
effectVersionsCache.set(sourceFile.fileName, effectVersions);
|
|
2661
|
-
programResolvedCacheSize.set(sourceFile.fileName, newResolvedModuleSize);
|
|
2662
|
-
}
|
|
2663
|
-
if (Object.keys(effectVersions).length > 1) {
|
|
2664
|
-
const versions = Object.keys(effectVersions).map((version) => `version ${version}`);
|
|
2665
|
-
effectDiagnostics.push({
|
|
2666
|
-
node: sourceFile.statements[0],
|
|
2667
|
-
category: ts.DiagnosticCategory.Warning,
|
|
2668
|
-
messageText: `Seems like in this project there are multiple effect versions loaded (${versions.join(", ")}). This may cause unexpected type errors and runtime behaviours. If you are ok with that, you can disable this warning by adding "multipleEffectCheck": false to the Effect LSP options inside your tsconfig.json`,
|
|
2669
|
-
fixes: []
|
|
2670
|
-
});
|
|
2671
|
-
}
|
|
2672
|
-
return effectDiagnostics;
|
|
2673
|
-
})
|
|
2674
|
-
});
|
|
2675
|
-
|
|
2676
2794
|
// src/diagnostics/unnecessaryEffectGen.ts
|
|
2677
2795
|
var unnecessaryEffectGen = createDiagnostic({
|
|
2678
|
-
name: "
|
|
2796
|
+
name: "unnecessaryEffectGen",
|
|
2679
2797
|
code: 5,
|
|
2680
2798
|
apply: fn("unnecessaryEffectGen.apply")(function* (sourceFile) {
|
|
2681
2799
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -2722,7 +2840,7 @@ var unnecessaryEffectGen = createDiagnostic({
|
|
|
2722
2840
|
|
|
2723
2841
|
// src/diagnostics.ts
|
|
2724
2842
|
var diagnostics = [
|
|
2725
|
-
|
|
2843
|
+
duplicatePackage,
|
|
2726
2844
|
missingEffectContext,
|
|
2727
2845
|
missingEffectError,
|
|
2728
2846
|
floatingEffect,
|
|
@@ -2731,9 +2849,7 @@ var diagnostics = [
|
|
|
2731
2849
|
];
|
|
2732
2850
|
|
|
2733
2851
|
// src/quickinfo.ts
|
|
2734
|
-
var SymbolDisplayPartEq = make(
|
|
2735
|
-
(fa, fb) => fa.kind === fb.kind && fa.text === fb.text
|
|
2736
|
-
);
|
|
2852
|
+
var SymbolDisplayPartEq = make((fa, fb) => fa.kind === fb.kind && fa.text === fb.text);
|
|
2737
2853
|
var JSDocTagInfoEq = make(
|
|
2738
2854
|
(fa, fb) => fa.name === fb.name && typeof fa.text === typeof fb.text && (typeof fa.text !== "undefined" ? array(SymbolDisplayPartEq)(fa.text, fb.text) : true)
|
|
2739
2855
|
);
|
|
@@ -2808,7 +2924,7 @@ function prependEffectTypeArguments(sourceFile, position, quickInfo) {
|
|
|
2808
2924
|
|
|
2809
2925
|
// src/refactors/asyncAwaitToGen.ts
|
|
2810
2926
|
var asyncAwaitToGen = createRefactor({
|
|
2811
|
-
name: "
|
|
2927
|
+
name: "asyncAwaitToGen",
|
|
2812
2928
|
description: "Convert to Effect.gen",
|
|
2813
2929
|
apply: fn("asyncAwaitToGen.apply")(function* (sourceFile, textRange) {
|
|
2814
2930
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -2819,9 +2935,7 @@ var asyncAwaitToGen = createRefactor({
|
|
|
2819
2935
|
(node2) => ts.isFunctionDeclaration(node2) || ts.isArrowFunction(node2) || ts.isFunctionExpression(node2)
|
|
2820
2936
|
),
|
|
2821
2937
|
filter((node2) => !!node2.body),
|
|
2822
|
-
filter(
|
|
2823
|
-
(node2) => !!(ts.getCombinedModifierFlags(node2) & ts.ModifierFlags.Async)
|
|
2824
|
-
),
|
|
2938
|
+
filter((node2) => !!(ts.getCombinedModifierFlags(node2) & ts.ModifierFlags.Async)),
|
|
2825
2939
|
head
|
|
2826
2940
|
);
|
|
2827
2941
|
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
@@ -2880,7 +2994,7 @@ var asyncAwaitToGen = createRefactor({
|
|
|
2880
2994
|
|
|
2881
2995
|
// src/refactors/asyncAwaitToGenTryPromise.ts
|
|
2882
2996
|
var asyncAwaitToGenTryPromise = createRefactor({
|
|
2883
|
-
name: "
|
|
2997
|
+
name: "asyncAwaitToGenTryPromise",
|
|
2884
2998
|
description: "Convert to Effect.gen with failures",
|
|
2885
2999
|
apply: fn("asyncAwaitToGenTryPromise.apply")(function* (sourceFile, textRange) {
|
|
2886
3000
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -2891,9 +3005,7 @@ var asyncAwaitToGenTryPromise = createRefactor({
|
|
|
2891
3005
|
(node2) => ts.isFunctionDeclaration(node2) || ts.isArrowFunction(node2) || ts.isFunctionExpression(node2)
|
|
2892
3006
|
),
|
|
2893
3007
|
filter((node2) => !!node2.body),
|
|
2894
|
-
filter(
|
|
2895
|
-
(node2) => !!(ts.getCombinedModifierFlags(node2) & ts.ModifierFlags.Async)
|
|
2896
|
-
),
|
|
3008
|
+
filter((node2) => !!(ts.getCombinedModifierFlags(node2) & ts.ModifierFlags.Async)),
|
|
2897
3009
|
head
|
|
2898
3010
|
);
|
|
2899
3011
|
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
@@ -2982,7 +3094,7 @@ var asyncAwaitToGenTryPromise = createRefactor({
|
|
|
2982
3094
|
|
|
2983
3095
|
// src/refactors/effectGenToFn.ts
|
|
2984
3096
|
var effectGenToFn = createRefactor({
|
|
2985
|
-
name: "
|
|
3097
|
+
name: "effectGenToFn",
|
|
2986
3098
|
description: "Convert to Effect.fn",
|
|
2987
3099
|
apply: fn("effectGenToFn.apply")(function* (sourceFile, textRange) {
|
|
2988
3100
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -3072,7 +3184,7 @@ var effectGenToFn = createRefactor({
|
|
|
3072
3184
|
|
|
3073
3185
|
// src/refactors/functionToArrow.ts
|
|
3074
3186
|
var functionToArrow = createRefactor({
|
|
3075
|
-
name: "
|
|
3187
|
+
name: "functionToArrow",
|
|
3076
3188
|
description: "Convert to arrow",
|
|
3077
3189
|
apply: fn("functionToArrow.apply")(function* (sourceFile, textRange) {
|
|
3078
3190
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -3240,7 +3352,7 @@ var _createOpaqueTypes = fn("_createOpaqueTypes")(function* (effectSchemaName, i
|
|
|
3240
3352
|
return { contextType, encodedType, opaqueType };
|
|
3241
3353
|
});
|
|
3242
3354
|
var makeSchemaOpaque = createRefactor({
|
|
3243
|
-
name: "
|
|
3355
|
+
name: "makeSchemaOpaque",
|
|
3244
3356
|
description: "Make Schema opaque",
|
|
3245
3357
|
apply: fn("makeSchemaOpaque.apply")(function* (sourceFile, textRange) {
|
|
3246
3358
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -3318,7 +3430,7 @@ var makeSchemaOpaque = createRefactor({
|
|
|
3318
3430
|
|
|
3319
3431
|
// src/refactors/makeSchemaOpaqueWithNs.ts
|
|
3320
3432
|
var makeSchemaOpaqueWithNs = createRefactor({
|
|
3321
|
-
name: "
|
|
3433
|
+
name: "makeSchemaOpaqueWithNs",
|
|
3322
3434
|
description: "Make Schema opaque with namespace",
|
|
3323
3435
|
apply: fn("makeSchemaOpaqueWithNs.apply")(function* (sourceFile, textRange) {
|
|
3324
3436
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -3412,7 +3524,7 @@ var makeSchemaOpaqueWithNs = createRefactor({
|
|
|
3412
3524
|
|
|
3413
3525
|
// src/refactors/pipeableToDatafirst.ts
|
|
3414
3526
|
var pipeableToDatafirst = createRefactor({
|
|
3415
|
-
name: "
|
|
3527
|
+
name: "pipeableToDatafirst",
|
|
3416
3528
|
description: "Rewrite to datafirst",
|
|
3417
3529
|
apply: fn("pipeableToDatafirst.apply")(function* (sourceFile, textRange) {
|
|
3418
3530
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -3495,7 +3607,7 @@ var pipeableToDatafirst = createRefactor({
|
|
|
3495
3607
|
|
|
3496
3608
|
// src/refactors/removeUnnecessaryEffectGen.ts
|
|
3497
3609
|
var removeUnnecessaryEffectGen = createRefactor({
|
|
3498
|
-
name: "
|
|
3610
|
+
name: "removeUnnecessaryEffectGen",
|
|
3499
3611
|
description: "Remove unnecessary Effect.gen",
|
|
3500
3612
|
apply: fn("removeUnnecessaryEffectGen.apply")(function* (sourceFile, textRange) {
|
|
3501
3613
|
for (const nodeToReplace of yield* getAncestorNodesInRange(sourceFile, textRange)) {
|
|
@@ -3521,7 +3633,7 @@ var removeUnnecessaryEffectGen = createRefactor({
|
|
|
3521
3633
|
|
|
3522
3634
|
// src/refactors/toggleLazyConst.ts
|
|
3523
3635
|
var toggleLazyConst = createRefactor({
|
|
3524
|
-
name: "
|
|
3636
|
+
name: "toggleLazyConst",
|
|
3525
3637
|
description: "Toggle lazy const",
|
|
3526
3638
|
apply: fn("toggleLazyConst.apply")(function* (sourceFile, textRange) {
|
|
3527
3639
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -3561,7 +3673,7 @@ var toggleLazyConst = createRefactor({
|
|
|
3561
3673
|
|
|
3562
3674
|
// src/refactors/toggleReturnTypeAnnotation.ts
|
|
3563
3675
|
var toggleReturnTypeAnnotation = createRefactor({
|
|
3564
|
-
name: "
|
|
3676
|
+
name: "toggleReturnTypeAnnotation",
|
|
3565
3677
|
description: "Toggle return type annotation",
|
|
3566
3678
|
apply: fn("toggleReturnTypeAnnotation.apply")(function* (sourceFile, textRange) {
|
|
3567
3679
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -3611,16 +3723,14 @@ var toggleReturnTypeAnnotation = createRefactor({
|
|
|
3611
3723
|
|
|
3612
3724
|
// src/refactors/toggleTypeAnnotation.ts
|
|
3613
3725
|
var toggleTypeAnnotation = createRefactor({
|
|
3614
|
-
name: "
|
|
3726
|
+
name: "toggleTypeAnnotation",
|
|
3615
3727
|
description: "Toggle type annotation",
|
|
3616
3728
|
apply: fn("toggleTypeAnnotation.apply")(function* (sourceFile, textRange) {
|
|
3617
3729
|
const ts = yield* service(TypeScriptApi);
|
|
3618
3730
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
3619
3731
|
const maybeNode = pipe(
|
|
3620
3732
|
yield* getAncestorNodesInRange(sourceFile, textRange),
|
|
3621
|
-
filter(
|
|
3622
|
-
(node2) => ts.isVariableDeclaration(node2) || ts.isPropertyDeclaration(node2)
|
|
3623
|
-
),
|
|
3733
|
+
filter((node2) => ts.isVariableDeclaration(node2) || ts.isPropertyDeclaration(node2)),
|
|
3624
3734
|
filter((node2) => isNodeInRange(textRange)(node2.name)),
|
|
3625
3735
|
filter((node2) => !!node2.initializer),
|
|
3626
3736
|
head
|
|
@@ -4130,7 +4240,7 @@ var applyAtNode = fn("SchemaGen.applyAtNode")(
|
|
|
4130
4240
|
|
|
4131
4241
|
// src/refactors/typeToEffectSchema.ts
|
|
4132
4242
|
var typeToEffectSchema = createRefactor({
|
|
4133
|
-
name: "
|
|
4243
|
+
name: "typeToEffectSchema",
|
|
4134
4244
|
description: "Refactor to Schema",
|
|
4135
4245
|
apply: fn("typeToEffectSchema.apply")(function* (sourceFile, textRange) {
|
|
4136
4246
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -4152,7 +4262,7 @@ var typeToEffectSchema = createRefactor({
|
|
|
4152
4262
|
|
|
4153
4263
|
// src/refactors/typeToEffectSchemaClass.ts
|
|
4154
4264
|
var typeToEffectSchemaClass = createRefactor({
|
|
4155
|
-
name: "
|
|
4265
|
+
name: "typeToEffectSchemaClass",
|
|
4156
4266
|
description: "Refactor to Schema.Class",
|
|
4157
4267
|
apply: fn("typeToEffectSchemaClass.apply")(function* (sourceFile, textRange) {
|
|
4158
4268
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -4174,7 +4284,7 @@ var typeToEffectSchemaClass = createRefactor({
|
|
|
4174
4284
|
|
|
4175
4285
|
// src/refactors/wrapWithEffectGen.ts
|
|
4176
4286
|
var wrapWithEffectGen = createRefactor({
|
|
4177
|
-
name: "
|
|
4287
|
+
name: "wrapWithEffectGen",
|
|
4178
4288
|
description: "Wrap with Effect.gen",
|
|
4179
4289
|
apply: fn("wrapWithEffectGen.apply")(function* (sourceFile, textRange) {
|
|
4180
4290
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -4239,7 +4349,7 @@ var getEffectModuleIdentifierName = fn("getEffectModuleIdentifierName")(
|
|
|
4239
4349
|
|
|
4240
4350
|
// src/refactors/wrapWithPipe.ts
|
|
4241
4351
|
var wrapWithPipe = createRefactor({
|
|
4242
|
-
name: "
|
|
4352
|
+
name: "wrapWithPipe",
|
|
4243
4353
|
description: "Wrap with pipe",
|
|
4244
4354
|
apply: fn("wrapWithPipe.apply")(function* (sourceFile, textRange) {
|
|
4245
4355
|
if (textRange.end - textRange.pos === 0) {
|
|
@@ -4277,10 +4387,12 @@ var refactors = [
|
|
|
4277
4387
|
];
|
|
4278
4388
|
|
|
4279
4389
|
// src/index.ts
|
|
4390
|
+
var LSP_INJECTED_URI = "@effect/language-service/injected";
|
|
4280
4391
|
var init = (modules) => {
|
|
4281
4392
|
function create(info) {
|
|
4282
4393
|
const languageService = info.languageService;
|
|
4283
|
-
|
|
4394
|
+
if (languageService[LSP_INJECTED_URI]) return languageService;
|
|
4395
|
+
const languageServicePluginOptions = parse(info.config);
|
|
4284
4396
|
const diagnosticsErrorCodes = diagnostics.map((diagnostic) => diagnostic.code);
|
|
4285
4397
|
try {
|
|
4286
4398
|
;
|
|
@@ -4291,28 +4403,38 @@ var init = (modules) => {
|
|
|
4291
4403
|
} catch (_) {
|
|
4292
4404
|
}
|
|
4293
4405
|
const proxy = /* @__PURE__ */ Object.create(null);
|
|
4406
|
+
proxy[LSP_INJECTED_URI] = true;
|
|
4294
4407
|
for (const k of Object.keys(languageService)) {
|
|
4295
4408
|
proxy[k] = (...args) => languageService[k].apply(languageService, args);
|
|
4296
4409
|
}
|
|
4410
|
+
function runNano(program) {
|
|
4411
|
+
return (fa) => pipe(
|
|
4412
|
+
fa,
|
|
4413
|
+
provideService(TypeScriptProgram, program),
|
|
4414
|
+
provideService(TypeCheckerApi, program.getTypeChecker()),
|
|
4415
|
+
provideService(
|
|
4416
|
+
TypeCheckerApiCache,
|
|
4417
|
+
makeTypeCheckerApiCache()
|
|
4418
|
+
),
|
|
4419
|
+
provideService(TypeScriptApi, modules.typescript),
|
|
4420
|
+
provideService(
|
|
4421
|
+
LanguageServicePluginOptions,
|
|
4422
|
+
languageServicePluginOptions
|
|
4423
|
+
),
|
|
4424
|
+
run
|
|
4425
|
+
);
|
|
4426
|
+
}
|
|
4297
4427
|
const effectCodeFixesForFile = /* @__PURE__ */ new Map();
|
|
4298
4428
|
proxy.getSemanticDiagnostics = (fileName, ...args) => {
|
|
4299
4429
|
const applicableDiagnostics = languageService.getSemanticDiagnostics(fileName, ...args);
|
|
4300
4430
|
const program = languageService.getProgram();
|
|
4301
|
-
if (
|
|
4431
|
+
if (languageServicePluginOptions.diagnostics && program) {
|
|
4302
4432
|
effectCodeFixesForFile.delete(fileName);
|
|
4303
4433
|
const sourceFile = program.getSourceFile(fileName);
|
|
4304
4434
|
if (sourceFile) {
|
|
4305
4435
|
return pipe(
|
|
4306
4436
|
getSemanticDiagnosticsWithCodeFixes(diagnostics, sourceFile),
|
|
4307
|
-
|
|
4308
|
-
provideService(TypeCheckerApi, program.getTypeChecker()),
|
|
4309
|
-
provideService(
|
|
4310
|
-
TypeCheckerApiCache,
|
|
4311
|
-
makeTypeCheckerApiCache()
|
|
4312
|
-
),
|
|
4313
|
-
provideService(TypeScriptApi, modules.typescript),
|
|
4314
|
-
provideService(PluginOptions, pluginOptions),
|
|
4315
|
-
run,
|
|
4437
|
+
runNano(program),
|
|
4316
4438
|
Either_exports.map(({ codeFixes, diagnostics: diagnostics2 }) => {
|
|
4317
4439
|
effectCodeFixesForFile.set(fileName, codeFixes);
|
|
4318
4440
|
return diagnostics2.concat(applicableDiagnostics);
|
|
@@ -4381,14 +4503,7 @@ var init = (modules) => {
|
|
|
4381
4503
|
if (sourceFile) {
|
|
4382
4504
|
return pipe(
|
|
4383
4505
|
getApplicableRefactors(refactors, sourceFile, positionOrRange),
|
|
4384
|
-
|
|
4385
|
-
provideService(
|
|
4386
|
-
TypeCheckerApiCache,
|
|
4387
|
-
makeTypeCheckerApiCache()
|
|
4388
|
-
),
|
|
4389
|
-
provideService(TypeScriptApi, modules.typescript),
|
|
4390
|
-
provideService(PluginOptions, pluginOptions),
|
|
4391
|
-
run,
|
|
4506
|
+
runNano(program),
|
|
4392
4507
|
Either_exports.map((effectRefactors) => applicableRefactors.concat(effectRefactors)),
|
|
4393
4508
|
Either_exports.getOrElse(() => applicableRefactors)
|
|
4394
4509
|
);
|
|
@@ -4427,14 +4542,7 @@ var init = (modules) => {
|
|
|
4427
4542
|
);
|
|
4428
4543
|
return { edits };
|
|
4429
4544
|
}),
|
|
4430
|
-
|
|
4431
|
-
provideService(
|
|
4432
|
-
TypeCheckerApiCache,
|
|
4433
|
-
makeTypeCheckerApiCache()
|
|
4434
|
-
),
|
|
4435
|
-
provideService(TypeScriptApi, modules.typescript),
|
|
4436
|
-
provideService(PluginOptions, pluginOptions),
|
|
4437
|
-
run
|
|
4545
|
+
runNano(program)
|
|
4438
4546
|
);
|
|
4439
4547
|
if (Either_exports.isRight(result)) return result.right;
|
|
4440
4548
|
}
|
|
@@ -4451,7 +4559,7 @@ var init = (modules) => {
|
|
|
4451
4559
|
};
|
|
4452
4560
|
proxy.getQuickInfoAtPosition = (fileName, position, ...args) => {
|
|
4453
4561
|
const quickInfo = languageService.getQuickInfoAtPosition(fileName, position, ...args);
|
|
4454
|
-
if (
|
|
4562
|
+
if (languageServicePluginOptions.quickinfo) {
|
|
4455
4563
|
const dedupedTagsQuickInfo = dedupeJsDocTags(quickInfo);
|
|
4456
4564
|
const program = languageService.getProgram();
|
|
4457
4565
|
if (program) {
|
|
@@ -4463,11 +4571,7 @@ var init = (modules) => {
|
|
|
4463
4571
|
position,
|
|
4464
4572
|
dedupedTagsQuickInfo
|
|
4465
4573
|
),
|
|
4466
|
-
|
|
4467
|
-
provideService(TypeCheckerApi, program.getTypeChecker()),
|
|
4468
|
-
provideService(TypeScriptApi, modules.typescript),
|
|
4469
|
-
provideService(PluginOptions, pluginOptions),
|
|
4470
|
-
run,
|
|
4574
|
+
runNano(program),
|
|
4471
4575
|
Either_exports.getOrElse(() => dedupedTagsQuickInfo)
|
|
4472
4576
|
);
|
|
4473
4577
|
}
|
|
@@ -4484,7 +4588,7 @@ var init = (modules) => {
|
|
|
4484
4588
|
formattingSettings,
|
|
4485
4589
|
...args
|
|
4486
4590
|
);
|
|
4487
|
-
if (
|
|
4591
|
+
if (languageServicePluginOptions.completions) {
|
|
4488
4592
|
const program = languageService.getProgram();
|
|
4489
4593
|
if (program) {
|
|
4490
4594
|
const sourceFile = program.getSourceFile(fileName);
|
|
@@ -4497,15 +4601,7 @@ var init = (modules) => {
|
|
|
4497
4601
|
options,
|
|
4498
4602
|
formattingSettings
|
|
4499
4603
|
),
|
|
4500
|
-
|
|
4501
|
-
provideService(TypeCheckerApi, program.getTypeChecker()),
|
|
4502
|
-
provideService(
|
|
4503
|
-
TypeCheckerApiCache,
|
|
4504
|
-
makeTypeCheckerApiCache()
|
|
4505
|
-
),
|
|
4506
|
-
provideService(TypeScriptApi, modules.typescript),
|
|
4507
|
-
provideService(PluginOptions, pluginOptions),
|
|
4508
|
-
run,
|
|
4604
|
+
runNano(program),
|
|
4509
4605
|
Either_exports.map(
|
|
4510
4606
|
(effectCompletions) => applicableCompletions ? {
|
|
4511
4607
|
...applicableCompletions,
|