@effect/language-service 0.17.0 → 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/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.12.5/node_modules/effect/dist/esm/Function.js
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.12.5/node_modules/effect/dist/esm/Either.js
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.12.5/node_modules/effect/dist/esm/Equivalence.js
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,22 +161,22 @@ var array = (item) => make((self, that) => {
158
161
  return true;
159
162
  });
160
163
 
161
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/doNotation.js
162
- var let_ = (map4) => dual(3, (self, name, f) => map4(self, (a) => Object.assign({}, a, {
164
+ // node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/internal/doNotation.js
165
+ var let_ = (map5) => dual(3, (self, name, f) => map5(self, (a) => Object.assign({}, a, {
163
166
  [name]: f(a)
164
167
  })));
165
- var bindTo = (map4) => dual(2, (self, name) => map4(self, (a) => ({
168
+ var bindTo = (map5) => dual(2, (self, name) => map5(self, (a) => ({
166
169
  [name]: a
167
170
  })));
168
- var bind = (map4, flatMap4) => dual(3, (self, name, f) => flatMap4(self, (a) => map4(f(a), (b) => Object.assign({}, a, {
171
+ var bind = (map5, flatMap4) => dual(3, (self, name, f) => flatMap4(self, (a) => map5(f(a), (b) => Object.assign({}, a, {
169
172
  [name]: b
170
173
  }))));
171
174
 
172
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/version.js
173
- var moduleVersion = "3.12.5";
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.12.5/node_modules/effect/dist/esm/GlobalValue.js
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.12.5/node_modules/effect/dist/esm/Predicate.js
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.12.5/node_modules/effect/dist/esm/internal/errors.js
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.12.5/node_modules/effect/dist/esm/Utils.js
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.12.5/node_modules/effect/dist/esm/Hash.js
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.12.5/node_modules/effect/dist/esm/Equal.js
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.12.5/node_modules/effect/dist/esm/Inspectable.js
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.12.5/node_modules/effect/dist/esm/Pipeable.js
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.12.5/node_modules/effect/dist/esm/internal/opCodes/effect.js
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.12.5/node_modules/effect/dist/esm/internal/effectable.js
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.12.5/node_modules/effect/dist/esm/internal/option.js
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.12.5/node_modules/effect/dist/esm/internal/either.js
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.12.5/node_modules/effect/dist/esm/Either.js
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
- if (state.done) {
858
- return right2(state.value);
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
- while (!state.done) {
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.12.5/node_modules/effect/dist/esm/internal/array.js
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.12.5/node_modules/effect/dist/esm/Order.js
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.12.5/node_modules/effect/dist/esm/Option.js
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;
@@ -907,22 +917,23 @@ var getOrElse2 = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNon
907
917
  var orElse2 = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
908
918
  var fromNullable2 = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
909
919
  var getOrUndefined2 = /* @__PURE__ */ getOrElse2(constUndefined);
920
+ var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
910
921
 
911
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Array.js
922
+ // node_modules/.pnpm/effect@3.16.3/node_modules/effect/dist/esm/Array.js
912
923
  var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
913
924
  var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
914
925
  var isArray = Array.isArray;
915
926
  var isEmptyArray = (self) => self.length === 0;
916
927
  var isEmptyReadonlyArray = isEmptyArray;
917
928
  var isNonEmptyReadonlyArray = isNonEmptyArray;
918
- var isOutOfBound = (i, as) => i < 0 || i >= as.length;
929
+ var isOutOfBounds = (i, as) => i < 0 || i >= as.length;
919
930
  var get = /* @__PURE__ */ dual(2, (self, index) => {
920
931
  const i = Math.floor(index);
921
- return isOutOfBound(i, self) ? none2() : some2(self[i]);
932
+ return isOutOfBounds(i, self) ? none2() : some2(self[i]);
922
933
  });
923
934
  var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
924
935
  const i = Math.floor(index);
925
- if (isOutOfBound(i, self)) {
936
+ if (isOutOfBounds(i, self)) {
926
937
  throw new Error(`Index ${i} out of bounds`);
927
938
  }
928
939
  return self[i];
@@ -936,7 +947,7 @@ var sort = /* @__PURE__ */ dual(2, (self, O) => {
936
947
  return out;
937
948
  });
938
949
  var empty = () => [];
939
- var map2 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
950
+ var map3 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
940
951
  var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => {
941
952
  if (isEmptyReadonlyArray(self)) {
942
953
  return [];
@@ -1052,7 +1063,7 @@ var flatMap3 = dual(2, (fa, f) => make3((ctx) => {
1052
1063
  if (result._tag !== "Right") return result;
1053
1064
  return f(result.value).run(ctx);
1054
1065
  }));
1055
- var map3 = dual(2, (fa, f) => make3((ctx) => {
1066
+ var map4 = dual(2, (fa, f) => make3((ctx) => {
1056
1067
  const result = fa.run(ctx);
1057
1068
  if (result._tag !== "Right") return result;
1058
1069
  return makeInternalSuccess(f(result.value));
@@ -1413,7 +1424,10 @@ var parseDataForExtendsClassCompletion = fn(
1413
1424
  "AST.parseDataForExtendsClassCompletion"
1414
1425
  )(function* (sourceFile, position) {
1415
1426
  const ts = yield* service(TypeScriptApi);
1416
- const { accessedObject, outerNode, replacementSpan } = yield* parseAccessedExpressionForCompletion(sourceFile, position);
1427
+ const { accessedObject, outerNode, replacementSpan } = yield* parseAccessedExpressionForCompletion(
1428
+ sourceFile,
1429
+ position
1430
+ );
1417
1431
  if (!ts.isIdentifier(accessedObject)) return yield* fail(new NodeNotFoundError());
1418
1432
  let classDeclaration = outerNode.parent;
1419
1433
  while (ts.isExpressionWithTypeArguments(classDeclaration) || ts.isHeritageClause(classDeclaration)) {
@@ -1481,31 +1495,22 @@ function createRefactor(definition) {
1481
1495
  function createDiagnostic(definition) {
1482
1496
  return definition;
1483
1497
  }
1484
- function parsePluginOptions(config) {
1485
- return {
1486
- diagnostics: config && "diagnostics" in config && typeof config.diagnostics === "boolean" ? config.diagnostics : true,
1487
- quickinfo: config && "quickinfo" in config && typeof config.quickinfo === "boolean" ? config.quickinfo : true,
1488
- completions: config && "completions" in config && typeof config.completions === "boolean" ? config.completions : true,
1489
- multipleEffectCheck: config && "multipleEffectCheck" in config && typeof config.multipleEffectCheck === "boolean" ? config.multipleEffectCheck : true
1490
- };
1491
- }
1492
1498
  function createCompletion(definition) {
1493
1499
  return definition;
1494
1500
  }
1495
- var PluginOptions = Tag("PluginOptions");
1496
1501
  var getSemanticDiagnosticsWithCodeFixes = fn(
1497
1502
  "LSP.getSemanticDiagnosticsWithCodeFixes"
1498
1503
  )(function* (rules, sourceFile) {
1499
- const effectDiagnostics = [];
1500
- const effectCodeFixes = [];
1504
+ let effectDiagnostics = [];
1505
+ let effectCodeFixes = [];
1501
1506
  const executor = yield* createDiagnosticExecutor(sourceFile);
1502
1507
  for (const rule of rules) {
1503
1508
  const result = yield* option(executor.execute(rule));
1504
1509
  if (isSome2(result)) {
1505
- effectDiagnostics.push(
1506
- ...pipe(
1510
+ effectDiagnostics = effectDiagnostics.concat(
1511
+ pipe(
1507
1512
  result.value,
1508
- map2((_) => ({
1513
+ map3((_) => ({
1509
1514
  file: sourceFile,
1510
1515
  start: _.node.getStart(sourceFile),
1511
1516
  length: _.node.getEnd() - _.node.getStart(sourceFile),
@@ -1516,11 +1521,11 @@ var getSemanticDiagnosticsWithCodeFixes = fn(
1516
1521
  }))
1517
1522
  )
1518
1523
  );
1519
- effectCodeFixes.push(
1520
- ...pipe(
1524
+ effectCodeFixes = effectCodeFixes.concat(
1525
+ pipe(
1521
1526
  result.value,
1522
- map2(
1523
- (_) => map2(
1527
+ map3(
1528
+ (_) => map3(
1524
1529
  _.fixes,
1525
1530
  (fix) => ({
1526
1531
  ...fix,
@@ -1540,6 +1545,9 @@ var getSemanticDiagnosticsWithCodeFixes = fn(
1540
1545
  codeFixes: effectCodeFixes
1541
1546
  };
1542
1547
  });
1548
+ function refactorNameToFullyQualifiedName(name) {
1549
+ return `@effect/language-service/refactors/${name}`;
1550
+ }
1543
1551
  var getApplicableRefactors = fn("LSP.getApplicableRefactors")(function* (refactors2, sourceFile, positionOrRange) {
1544
1552
  const textRange = typeof positionOrRange === "number" ? { pos: positionOrRange, end: positionOrRange } : positionOrRange;
1545
1553
  const effectRefactors = [];
@@ -1547,10 +1555,10 @@ var getApplicableRefactors = fn("LSP.getApplicableRefactors")(function* (refacto
1547
1555
  const result = yield* option(refactor.apply(sourceFile, textRange));
1548
1556
  if (isSome2(result)) {
1549
1557
  effectRefactors.push({
1550
- name: refactor.name,
1558
+ name: refactorNameToFullyQualifiedName(refactor.name),
1551
1559
  description: refactor.description,
1552
1560
  actions: [{
1553
- name: refactor.name,
1561
+ name: refactorNameToFullyQualifiedName(refactor.name),
1554
1562
  description: result.value.description,
1555
1563
  kind: result.value.kind
1556
1564
  }]
@@ -1560,7 +1568,7 @@ var getApplicableRefactors = fn("LSP.getApplicableRefactors")(function* (refacto
1560
1568
  return effectRefactors;
1561
1569
  });
1562
1570
  var getEditsForRefactor = fn("LSP.getEditsForRefactor")(function* (refactors2, sourceFile, positionOrRange, refactorName) {
1563
- const refactor = refactors2.find((refactor2) => refactor2.name === refactorName);
1571
+ const refactor = refactors2.find((refactor2) => refactorNameToFullyQualifiedName(refactor2.name) === refactorName);
1564
1572
  if (!refactor) {
1565
1573
  return yield* fail(new RefactorNotApplicableError());
1566
1574
  }
@@ -1568,11 +1576,11 @@ var getEditsForRefactor = fn("LSP.getEditsForRefactor")(function* (refactors2, s
1568
1576
  return yield* refactor.apply(sourceFile, textRange);
1569
1577
  });
1570
1578
  var getCompletionsAtPosition = fn("LSP.getCompletionsAtPosition")(function* (completions2, sourceFile, position, options, formatCodeSettings) {
1571
- const effectCompletions = [];
1579
+ let effectCompletions = [];
1572
1580
  for (const completion of completions2) {
1573
1581
  const result = yield* completion.apply(sourceFile, position, options, formatCodeSettings);
1574
- effectCompletions.push(
1575
- ...result.map((_) => ({ sortText: "11", ..._ }))
1582
+ effectCompletions = effectCompletions.concat(
1583
+ result.map((_) => ({ sortText: "11", ..._ }))
1576
1584
  );
1577
1585
  }
1578
1586
  return effectCompletions;
@@ -1580,27 +1588,74 @@ var getCompletionsAtPosition = fn("LSP.getCompletionsAtPosition")(function* (com
1580
1588
  var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
1581
1589
  function* (sourceFile) {
1582
1590
  const ts = yield* service(TypeScriptApi);
1583
- const ruleOverrides = {};
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 = {};
1584
1626
  const skippedRules = [];
1585
- 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;
1586
1628
  let match3;
1587
1629
  while ((match3 = regex.exec(sourceFile.text)) !== null) {
1588
- const rulesCaptureGroup = match3[1];
1630
+ const nextLineCaptureGroup = match3[1];
1631
+ const rulesCaptureGroup = match3[2];
1589
1632
  if (rulesCaptureGroup) {
1590
1633
  const trimmedRuleString = rulesCaptureGroup.trim();
1591
1634
  if (trimmedRuleString) {
1592
1635
  const individualRules = trimmedRuleString.split(/\s+/);
1593
1636
  for (const rulePair of individualRules) {
1594
- const [ruleName, ruleLevel] = rulePair.toLowerCase().split(":");
1637
+ const [rawRuleName, ruleLevel] = rulePair.toLowerCase().split(":");
1638
+ const ruleName = rawRuleName.startsWith("effect/") ? rawRuleName.substring("effect/".length) : rawRuleName;
1595
1639
  if (ruleName && ruleLevel) {
1596
1640
  if (ruleLevel === "skip-file") skippedRules.push(ruleName);
1597
- ruleOverrides[ruleName] = ruleOverrides[ruleName] || [];
1598
- const newLength = ruleOverrides[ruleName].push({
1599
- start: match3.index,
1600
- end: Number.MAX_SAFE_INTEGER,
1601
- level: ruleLevel
1602
- });
1603
- if (newLength > 1) ruleOverrides[ruleName][newLength - 2].end = match3.index;
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
+ }
1604
1659
  }
1605
1660
  }
1606
1661
  }
@@ -1616,22 +1671,46 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
1616
1671
  const ruleNameLowered = rule.name.toLowerCase();
1617
1672
  if (skippedRules.indexOf(ruleNameLowered) > -1) return [];
1618
1673
  let modifiedDiagnostics = yield* rule.apply(sourceFile);
1619
- for (const override of ruleOverrides[ruleNameLowered] || []) {
1620
- if (override.level === "off") {
1621
- modifiedDiagnostics = modifiedDiagnostics.filter(
1622
- (_) => !(_.node.getStart(sourceFile) >= override.start && _.node.getEnd() <= override.end)
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)
1623
1685
  );
1686
+ if (sectionOverride) newLevel = sectionOverride.level;
1687
+ }
1688
+ if (newLevel === "off") {
1689
+ modifiedDiagnostics = modifiedDiagnostics.filter((_) => _ !== emitted);
1624
1690
  } else {
1625
- for (const message of modifiedDiagnostics.filter(
1626
- (_) => _.node.getStart(sourceFile) >= override.start && _.node.getEnd() <= override.end
1627
- )) {
1628
- message.category = override.level in levelToDiagnosticCategory ? levelToDiagnosticCategory[override.level] : message.category;
1629
- }
1691
+ emitted.category = newLevel && newLevel in levelToDiagnosticCategory ? levelToDiagnosticCategory[newLevel] : emitted.category;
1630
1692
  }
1631
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
+ });
1632
1711
  const fixByDisableEntireFile = {
1633
1712
  fixName: rule.name + "_skipFile",
1634
- description: "Disable " + rule.name + " for this file",
1713
+ description: "Disable " + rule.name + " for this entire file",
1635
1714
  apply: flatMap3(
1636
1715
  service(ChangeTracker),
1637
1716
  (changeTracker) => sync(
@@ -1646,7 +1725,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
1646
1725
  };
1647
1726
  const rulesWithDisableFix = modifiedDiagnostics.map((diagnostic) => ({
1648
1727
  ...diagnostic,
1649
- fixes: diagnostic.fixes.concat([fixByDisableEntireFile])
1728
+ fixes: diagnostic.fixes.concat([fixByDisableNextLine(diagnostic), fixByDisableEntireFile])
1650
1729
  }));
1651
1730
  return rulesWithDisableFix;
1652
1731
  });
@@ -1656,7 +1735,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
1656
1735
 
1657
1736
  // src/completions/contextSelfInClasses.ts
1658
1737
  var contextSelfInClasses = createCompletion({
1659
- name: "effect/contextSelfInClasses",
1738
+ name: "contextSelfInClasses",
1660
1739
  apply: fn("contextSelfInClasses")(function* (sourceFile, position) {
1661
1740
  const ts = yield* service(TypeScriptApi);
1662
1741
  const maybeInfos = yield* option(
@@ -1689,7 +1768,7 @@ var contextSelfInClasses = createCompletion({
1689
1768
 
1690
1769
  // src/completions/effectDataClasses.ts
1691
1770
  var effectDataClasses = createCompletion({
1692
- name: "effect/effectDataClasses",
1771
+ name: "effectDataClasses",
1693
1772
  apply: fn("effectDataClasses")(function* (sourceFile, position) {
1694
1773
  const ts = yield* service(TypeScriptApi);
1695
1774
  const maybeInfos = yield* option(
@@ -1728,7 +1807,7 @@ var effectDataClasses = createCompletion({
1728
1807
 
1729
1808
  // src/completions/effectSchemaSelfInClasses.ts
1730
1809
  var effectSchemaSelfInClasses = createCompletion({
1731
- name: "effect/effectSchemaSelfInClasses",
1810
+ name: "effectSchemaSelfInClasses",
1732
1811
  apply: fn("effectSchemaSelfInClasses")(function* (sourceFile, position) {
1733
1812
  const ts = yield* service(TypeScriptApi);
1734
1813
  const maybeInfos = yield* option(
@@ -1779,7 +1858,7 @@ var effectSchemaSelfInClasses = createCompletion({
1779
1858
 
1780
1859
  // src/completions/effectSelfInClasses.ts
1781
1860
  var effectSelfInClasses = createCompletion({
1782
- name: "effect/effectSelfInClasses",
1861
+ name: "effectSelfInClasses",
1783
1862
  apply: fn("effectSelfInClasses")(function* (sourceFile, position) {
1784
1863
  const ts = yield* service(TypeScriptApi);
1785
1864
  const maybeInfos = yield* option(
@@ -1834,12 +1913,12 @@ var getMissingTypeEntriesInTargetType = fn(
1834
1913
  function* (realType, expectedType) {
1835
1914
  const typeChecker = yield* service(TypeCheckerApi);
1836
1915
  const result = [];
1837
- const toTest = [realType];
1916
+ let toTest = [realType];
1838
1917
  while (toTest.length > 0) {
1839
1918
  const type = toTest.pop();
1840
1919
  if (!type) return result;
1841
1920
  if (type.isUnion()) {
1842
- toTest.push(...type.types);
1921
+ toTest = toTest.concat(type.types);
1843
1922
  } else {
1844
1923
  const assignable = typeChecker.isTypeAssignableTo(type, expectedType);
1845
1924
  if (!assignable) {
@@ -2016,45 +2095,6 @@ var expectedAndRealType = fn("TypeCheckerApi.expectedAndRealType")(function* (so
2016
2095
  return result;
2017
2096
  });
2018
2097
 
2019
- // src/completions/genFunctionStar.ts
2020
- var genFunctionStar = createCompletion({
2021
- name: "effect/genFunctionStar",
2022
- apply: fn("genFunctionStar")(function* (sourceFile, position) {
2023
- const ts = yield* service(TypeScriptApi);
2024
- const typeChecker = yield* service(TypeCheckerApi);
2025
- const maybeInfos = yield* option(
2026
- parseAccessedExpressionForCompletion(sourceFile, position)
2027
- );
2028
- if (isNone2(maybeInfos)) return [];
2029
- const { accessedObject } = maybeInfos.value;
2030
- const type = typeChecker.getTypeAtLocation(accessedObject);
2031
- const genMemberSymbol = type.getProperty("gen");
2032
- if (!genMemberSymbol) return [];
2033
- const genType = typeChecker.getTypeOfSymbolAtLocation(genMemberSymbol, accessedObject);
2034
- if (genType.getCallSignatures().length === 0) return [];
2035
- const span = ts.createTextSpan(
2036
- accessedObject.end + 1,
2037
- Math.max(0, position - accessedObject.end - 1)
2038
- );
2039
- return [{
2040
- name: `gen(function*(){})`,
2041
- kind: ts.ScriptElementKind.constElement,
2042
- insertText: `gen(function*(){${"${0}"}})`,
2043
- replacementSpan: span,
2044
- isSnippet: true
2045
- }];
2046
- })
2047
- });
2048
-
2049
- // src/completions.ts
2050
- var completions = [
2051
- effectSchemaSelfInClasses,
2052
- effectSelfInClasses,
2053
- contextSelfInClasses,
2054
- genFunctionStar,
2055
- effectDataClasses
2056
- ];
2057
-
2058
2098
  // src/utils/TypeParser.ts
2059
2099
  var TypeParserIssue = class {
2060
2100
  constructor(type, node, message) {
@@ -2159,9 +2199,10 @@ var fiberType = fn("TypeParser.fiberType")(function* (type, atLocation) {
2159
2199
  var effectSubtype = fn("TypeParser.effectSubtype")(function* (type, atLocation) {
2160
2200
  const typeChecker = yield* service(TypeCheckerApi);
2161
2201
  const tagSymbol = typeChecker.getPropertyOfType(type, "_tag");
2162
- if (!tagSymbol) {
2202
+ const getSymbol = typeChecker.getPropertyOfType(type, "get");
2203
+ if (!(tagSymbol || getSymbol)) {
2163
2204
  return yield* typeParserIssue(
2164
- "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",
2165
2206
  type,
2166
2207
  atLocation
2167
2208
  );
@@ -2354,9 +2395,179 @@ var effectSchemaType = fn("TypeParser.effectSchemaType")(function* (type, atLoca
2354
2395
  return yield* typeParserIssue("Type has no schema variance struct", type, atLocation);
2355
2396
  });
2356
2397
 
2398
+ // src/completions/fnFunctionStar.ts
2399
+ var fnFunctionStar = createCompletion({
2400
+ name: "fnFunctionStar",
2401
+ apply: fn("fnFunctionStar")(function* (sourceFile, position) {
2402
+ const ts = yield* service(TypeScriptApi);
2403
+ const maybeInfos = yield* option(
2404
+ parseAccessedExpressionForCompletion(sourceFile, position)
2405
+ );
2406
+ if (isNone2(maybeInfos)) return [];
2407
+ const { accessedObject } = maybeInfos.value;
2408
+ const isEffectModule = yield* option(importedEffectModule(accessedObject));
2409
+ if (isNone2(isEffectModule)) return [];
2410
+ const span = ts.createTextSpan(
2411
+ accessedObject.end + 1,
2412
+ Math.max(0, position - accessedObject.end - 1)
2413
+ );
2414
+ const maybeFnName = pipe(
2415
+ yield* getAncestorNodesInRange(sourceFile, toTextRange(accessedObject.pos)),
2416
+ filter(ts.isVariableDeclaration),
2417
+ map3((_) => _.name && ts.isIdentifier(_.name) ? _.name.text : ""),
2418
+ filter((_) => _.length > 0),
2419
+ head,
2420
+ map2((name) => [
2421
+ {
2422
+ name: `fn("${name}")`,
2423
+ kind: ts.ScriptElementKind.constElement,
2424
+ insertText: `fn("${name}")(function*(${"${1}"}){${"${0}"}})`,
2425
+ replacementSpan: span,
2426
+ isSnippet: true
2427
+ }
2428
+ ]),
2429
+ getOrElse2(() => [])
2430
+ );
2431
+ return maybeFnName.concat([{
2432
+ name: `fn(function*(){})`,
2433
+ kind: ts.ScriptElementKind.constElement,
2434
+ insertText: `fn(function*(${"${1}"}){${"${0}"}})`,
2435
+ replacementSpan: span,
2436
+ isSnippet: true
2437
+ }, {
2438
+ name: `fnUntraced(function*(){})`,
2439
+ kind: ts.ScriptElementKind.constElement,
2440
+ insertText: `fnUntraced(function*(${"${1}"}){${"${0}"}})`,
2441
+ replacementSpan: span,
2442
+ isSnippet: true
2443
+ }]);
2444
+ })
2445
+ });
2446
+
2447
+ // src/completions/genFunctionStar.ts
2448
+ var genFunctionStar = createCompletion({
2449
+ name: "genFunctionStar",
2450
+ apply: fn("genFunctionStar")(function* (sourceFile, position) {
2451
+ const ts = yield* service(TypeScriptApi);
2452
+ const typeChecker = yield* service(TypeCheckerApi);
2453
+ const maybeInfos = yield* option(
2454
+ parseAccessedExpressionForCompletion(sourceFile, position)
2455
+ );
2456
+ if (isNone2(maybeInfos)) return [];
2457
+ const { accessedObject } = maybeInfos.value;
2458
+ const type = typeChecker.getTypeAtLocation(accessedObject);
2459
+ const genMemberSymbol = type.getProperty("gen");
2460
+ if (!genMemberSymbol) return [];
2461
+ const genType = typeChecker.getTypeOfSymbolAtLocation(genMemberSymbol, accessedObject);
2462
+ if (genType.getCallSignatures().length === 0) return [];
2463
+ const span = ts.createTextSpan(
2464
+ accessedObject.end + 1,
2465
+ Math.max(0, position - accessedObject.end - 1)
2466
+ );
2467
+ return [{
2468
+ name: `gen(function*(){})`,
2469
+ kind: ts.ScriptElementKind.constElement,
2470
+ insertText: `gen(function*(){${"${0}"}})`,
2471
+ replacementSpan: span,
2472
+ isSnippet: true
2473
+ }];
2474
+ })
2475
+ });
2476
+
2477
+ // src/completions.ts
2478
+ var completions = [
2479
+ effectSchemaSelfInClasses,
2480
+ effectSelfInClasses,
2481
+ contextSelfInClasses,
2482
+ genFunctionStar,
2483
+ fnFunctionStar,
2484
+ effectDataClasses
2485
+ ];
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
+
2357
2568
  // src/diagnostics/floatingEffect.ts
2358
2569
  var floatingEffect = createDiagnostic({
2359
- name: "effect/floatingEffect",
2570
+ name: "floatingEffect",
2360
2571
  code: 3,
2361
2572
  apply: fn("floatingEffect.apply")(function* (sourceFile) {
2362
2573
  const ts = yield* service(TypeScriptApi);
@@ -2365,7 +2576,7 @@ var floatingEffect = createDiagnostic({
2365
2576
  if (!ts.isExpressionStatement(node)) return false;
2366
2577
  if (!(ts.isBlock(node.parent) || ts.isSourceFile(node.parent))) return false;
2367
2578
  const expression = node.expression;
2368
- 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;
2369
2580
  return true;
2370
2581
  }
2371
2582
  const effectDiagnostics = [];
@@ -2403,7 +2614,7 @@ var floatingEffect = createDiagnostic({
2403
2614
 
2404
2615
  // src/diagnostics/missingEffectContext.ts
2405
2616
  var missingEffectContext = createDiagnostic({
2406
- name: "effect/missingEffectContext",
2617
+ name: "missingEffectContext",
2407
2618
  code: 1,
2408
2619
  apply: fn("missingEffectContext.apply")(function* (sourceFile) {
2409
2620
  const ts = yield* service(TypeScriptApi);
@@ -2455,7 +2666,7 @@ var missingEffectContext = createDiagnostic({
2455
2666
 
2456
2667
  // src/diagnostics/missingEffectError.ts
2457
2668
  var missingEffectError = createDiagnostic({
2458
- name: "effect/missingEffectError",
2669
+ name: "missingEffectError",
2459
2670
  code: 1,
2460
2671
  apply: fn("missingEffectError.apply")(function* (sourceFile) {
2461
2672
  const ts = yield* service(TypeScriptApi);
@@ -2507,7 +2718,7 @@ var missingEffectError = createDiagnostic({
2507
2718
 
2508
2719
  // src/diagnostics/missingStarInYieldEffectGen.ts
2509
2720
  var missingStarInYieldEffectGen = createDiagnostic({
2510
- name: "effect/missingStarInYieldEffectGen",
2721
+ name: "missingStarInYieldEffectGen",
2511
2722
  code: 4,
2512
2723
  apply: fn("missingStarInYieldEffectGen.apply")(function* (sourceFile) {
2513
2724
  const ts = yield* service(TypeScriptApi);
@@ -2526,7 +2737,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
2526
2737
  if (ts.isYieldExpression(node) && node.expression && node.asteriskToken === void 0) {
2527
2738
  const functionStarNode = ts.findAncestor(
2528
2739
  node,
2529
- (_) => (ts.isFunctionExpression(_) || ts.isMethodDeclaration(_)) && _.asteriskToken !== void 0
2740
+ (_) => ts.isFunctionExpression(_) || ts.isFunctionDeclaration(_) || ts.isMethodDeclaration(_)
2530
2741
  );
2531
2742
  if (functionStarNode && functionStarNode.parent) {
2532
2743
  const effectGenNode = functionStarNode.parent;
@@ -2580,51 +2791,9 @@ var missingStarInYieldEffectGen = createDiagnostic({
2580
2791
  })
2581
2792
  });
2582
2793
 
2583
- // src/diagnostics/multipleEffectVersions.ts
2584
- var effectVersionsCache = /* @__PURE__ */ new Map();
2585
- var programResolvedCacheSize = /* @__PURE__ */ new Map();
2586
- var multipleEffectVersions = createDiagnostic({
2587
- name: "effect/multipleEffectVersions",
2588
- code: 6,
2589
- apply: fn("multipleEffectVersions.apply")(function* (sourceFile) {
2590
- const ts = yield* service(TypeScriptApi);
2591
- const program = yield* service(TypeScriptProgram);
2592
- const options = yield* service(PluginOptions);
2593
- const effectDiagnostics = [];
2594
- if (!options.multipleEffectCheck) return [];
2595
- if (sourceFile.statements.length < 1) return [];
2596
- const effectVersions = effectVersionsCache.get(sourceFile.fileName) || {};
2597
- const newResolvedModuleSize = "resolvedModules" in program && typeof program.resolvedModules === "object" && "size" in program.resolvedModules ? program.resolvedModules.size : 0;
2598
- const oldResolvedSize = programResolvedCacheSize.get(sourceFile.fileName) || 0;
2599
- if (newResolvedModuleSize !== oldResolvedSize) {
2600
- if ("forEachResolvedModule" in program && typeof program.forEachResolvedModule === "function") {
2601
- program.forEachResolvedModule((_) => {
2602
- if (_ && _.resolvedModule && _.resolvedModule.packageId && _.resolvedModule.packageId.name === "effect" && !(_.resolvedModule.packageId.version in effectVersions)) {
2603
- effectVersions[_.resolvedModule.packageId.version] = {
2604
- resolvedFileName: _.resolvedModule.resolvedFileName
2605
- };
2606
- }
2607
- });
2608
- }
2609
- effectVersionsCache.set(sourceFile.fileName, effectVersions);
2610
- programResolvedCacheSize.set(sourceFile.fileName, newResolvedModuleSize);
2611
- }
2612
- if (Object.keys(effectVersions).length > 1) {
2613
- const versions = Object.keys(effectVersions).map((version) => `version ${version}`);
2614
- effectDiagnostics.push({
2615
- node: sourceFile.statements[0],
2616
- category: ts.DiagnosticCategory.Warning,
2617
- 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`,
2618
- fixes: []
2619
- });
2620
- }
2621
- return effectDiagnostics;
2622
- })
2623
- });
2624
-
2625
2794
  // src/diagnostics/unnecessaryEffectGen.ts
2626
2795
  var unnecessaryEffectGen = createDiagnostic({
2627
- name: "effect/unnecessaryEffectGen",
2796
+ name: "unnecessaryEffectGen",
2628
2797
  code: 5,
2629
2798
  apply: fn("unnecessaryEffectGen.apply")(function* (sourceFile) {
2630
2799
  const ts = yield* service(TypeScriptApi);
@@ -2671,7 +2840,7 @@ var unnecessaryEffectGen = createDiagnostic({
2671
2840
 
2672
2841
  // src/diagnostics.ts
2673
2842
  var diagnostics = [
2674
- multipleEffectVersions,
2843
+ duplicatePackage,
2675
2844
  missingEffectContext,
2676
2845
  missingEffectError,
2677
2846
  floatingEffect,
@@ -2680,9 +2849,7 @@ var diagnostics = [
2680
2849
  ];
2681
2850
 
2682
2851
  // src/quickinfo.ts
2683
- var SymbolDisplayPartEq = make(
2684
- (fa, fb) => fa.kind === fb.kind && fa.text === fb.text
2685
- );
2852
+ var SymbolDisplayPartEq = make((fa, fb) => fa.kind === fb.kind && fa.text === fb.text);
2686
2853
  var JSDocTagInfoEq = make(
2687
2854
  (fa, fb) => fa.name === fb.name && typeof fa.text === typeof fb.text && (typeof fa.text !== "undefined" ? array(SymbolDisplayPartEq)(fa.text, fb.text) : true)
2688
2855
  );
@@ -2757,7 +2924,7 @@ function prependEffectTypeArguments(sourceFile, position, quickInfo) {
2757
2924
 
2758
2925
  // src/refactors/asyncAwaitToGen.ts
2759
2926
  var asyncAwaitToGen = createRefactor({
2760
- name: "effect/asyncAwaitToGen",
2927
+ name: "asyncAwaitToGen",
2761
2928
  description: "Convert to Effect.gen",
2762
2929
  apply: fn("asyncAwaitToGen.apply")(function* (sourceFile, textRange) {
2763
2930
  const ts = yield* service(TypeScriptApi);
@@ -2768,9 +2935,7 @@ var asyncAwaitToGen = createRefactor({
2768
2935
  (node2) => ts.isFunctionDeclaration(node2) || ts.isArrowFunction(node2) || ts.isFunctionExpression(node2)
2769
2936
  ),
2770
2937
  filter((node2) => !!node2.body),
2771
- filter(
2772
- (node2) => !!(ts.getCombinedModifierFlags(node2) & ts.ModifierFlags.Async)
2773
- ),
2938
+ filter((node2) => !!(ts.getCombinedModifierFlags(node2) & ts.ModifierFlags.Async)),
2774
2939
  head
2775
2940
  );
2776
2941
  if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
@@ -2788,7 +2953,7 @@ var asyncAwaitToGen = createRefactor({
2788
2953
  (node2) => pipe(
2789
2954
  importedEffectModule(node2),
2790
2955
  option,
2791
- map3(isSome2)
2956
+ map4(isSome2)
2792
2957
  )
2793
2958
  )
2794
2959
  ),
@@ -2829,7 +2994,7 @@ var asyncAwaitToGen = createRefactor({
2829
2994
 
2830
2995
  // src/refactors/asyncAwaitToGenTryPromise.ts
2831
2996
  var asyncAwaitToGenTryPromise = createRefactor({
2832
- name: "effect/asyncAwaitToGenTryPromise",
2997
+ name: "asyncAwaitToGenTryPromise",
2833
2998
  description: "Convert to Effect.gen with failures",
2834
2999
  apply: fn("asyncAwaitToGenTryPromise.apply")(function* (sourceFile, textRange) {
2835
3000
  const ts = yield* service(TypeScriptApi);
@@ -2840,9 +3005,7 @@ var asyncAwaitToGenTryPromise = createRefactor({
2840
3005
  (node2) => ts.isFunctionDeclaration(node2) || ts.isArrowFunction(node2) || ts.isFunctionExpression(node2)
2841
3006
  ),
2842
3007
  filter((node2) => !!node2.body),
2843
- filter(
2844
- (node2) => !!(ts.getCombinedModifierFlags(node2) & ts.ModifierFlags.Async)
2845
- ),
3008
+ filter((node2) => !!(ts.getCombinedModifierFlags(node2) & ts.ModifierFlags.Async)),
2846
3009
  head
2847
3010
  );
2848
3011
  if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
@@ -2860,7 +3023,7 @@ var asyncAwaitToGenTryPromise = createRefactor({
2860
3023
  (node2) => pipe(
2861
3024
  importedEffectModule(node2),
2862
3025
  option,
2863
- map3(isSome2)
3026
+ map4(isSome2)
2864
3027
  )
2865
3028
  )
2866
3029
  ),
@@ -2931,7 +3094,7 @@ var asyncAwaitToGenTryPromise = createRefactor({
2931
3094
 
2932
3095
  // src/refactors/effectGenToFn.ts
2933
3096
  var effectGenToFn = createRefactor({
2934
- name: "effect/effectGenToFn",
3097
+ name: "effectGenToFn",
2935
3098
  description: "Convert to Effect.fn",
2936
3099
  apply: fn("effectGenToFn.apply")(function* (sourceFile, textRange) {
2937
3100
  const ts = yield* service(TypeScriptApi);
@@ -2971,7 +3134,7 @@ var effectGenToFn = createRefactor({
2971
3134
  });
2972
3135
  const maybeNode = yield* pipe(
2973
3136
  yield* getAncestorNodesInRange(sourceFile, textRange),
2974
- map2(parseEffectGenNode),
3137
+ map3(parseEffectGenNode),
2975
3138
  firstSuccessOf,
2976
3139
  option
2977
3140
  );
@@ -3021,7 +3184,7 @@ var effectGenToFn = createRefactor({
3021
3184
 
3022
3185
  // src/refactors/functionToArrow.ts
3023
3186
  var functionToArrow = createRefactor({
3024
- name: "effect/functionToArrow",
3187
+ name: "functionToArrow",
3025
3188
  description: "Convert to arrow",
3026
3189
  apply: fn("functionToArrow.apply")(function* (sourceFile, textRange) {
3027
3190
  const ts = yield* service(TypeScriptApi);
@@ -3106,7 +3269,7 @@ var _findSchemaVariableDeclaration = fn(
3106
3269
  );
3107
3270
  return yield* pipe(
3108
3271
  yield* getAncestorNodesInRange(sourceFile, textRange),
3109
- map2(findSchema),
3272
+ map3(findSchema),
3110
3273
  firstSuccessOf,
3111
3274
  option
3112
3275
  );
@@ -3189,7 +3352,7 @@ var _createOpaqueTypes = fn("_createOpaqueTypes")(function* (effectSchemaName, i
3189
3352
  return { contextType, encodedType, opaqueType };
3190
3353
  });
3191
3354
  var makeSchemaOpaque = createRefactor({
3192
- name: "effect/makeSchemaOpaque",
3355
+ name: "makeSchemaOpaque",
3193
3356
  description: "Make Schema opaque",
3194
3357
  apply: fn("makeSchemaOpaque.apply")(function* (sourceFile, textRange) {
3195
3358
  const ts = yield* service(TypeScriptApi);
@@ -3267,7 +3430,7 @@ var makeSchemaOpaque = createRefactor({
3267
3430
 
3268
3431
  // src/refactors/makeSchemaOpaqueWithNs.ts
3269
3432
  var makeSchemaOpaqueWithNs = createRefactor({
3270
- name: "effect/makeSchemaOpaqueWithNs",
3433
+ name: "makeSchemaOpaqueWithNs",
3271
3434
  description: "Make Schema opaque with namespace",
3272
3435
  apply: fn("makeSchemaOpaqueWithNs.apply")(function* (sourceFile, textRange) {
3273
3436
  const ts = yield* service(TypeScriptApi);
@@ -3361,7 +3524,7 @@ var makeSchemaOpaqueWithNs = createRefactor({
3361
3524
 
3362
3525
  // src/refactors/pipeableToDatafirst.ts
3363
3526
  var pipeableToDatafirst = createRefactor({
3364
- name: "effect/pipeableToDatafirst",
3527
+ name: "pipeableToDatafirst",
3365
3528
  description: "Rewrite to datafirst",
3366
3529
  apply: fn("pipeableToDatafirst.apply")(function* (sourceFile, textRange) {
3367
3530
  const ts = yield* service(TypeScriptApi);
@@ -3399,7 +3562,7 @@ var pipeableToDatafirst = createRefactor({
3399
3562
  filter(
3400
3563
  (node2) => node2.arguments.length > 0
3401
3564
  ),
3402
- map2((node2) => {
3565
+ map3((node2) => {
3403
3566
  let newNode2 = node2.arguments[0];
3404
3567
  let didSomething = false;
3405
3568
  for (let i = 1; i < node2.arguments.length; i++) {
@@ -3426,7 +3589,7 @@ var pipeableToDatafirst = createRefactor({
3426
3589
  return didSomething ? some2([node2, newNode2]) : none2();
3427
3590
  }),
3428
3591
  filter(isSome2),
3429
- map2((_) => _.value),
3592
+ map3((_) => _.value),
3430
3593
  head
3431
3594
  );
3432
3595
  if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
@@ -3444,7 +3607,7 @@ var pipeableToDatafirst = createRefactor({
3444
3607
 
3445
3608
  // src/refactors/removeUnnecessaryEffectGen.ts
3446
3609
  var removeUnnecessaryEffectGen = createRefactor({
3447
- name: "effect/removeUnnecessaryEffectGen",
3610
+ name: "removeUnnecessaryEffectGen",
3448
3611
  description: "Remove unnecessary Effect.gen",
3449
3612
  apply: fn("removeUnnecessaryEffectGen.apply")(function* (sourceFile, textRange) {
3450
3613
  for (const nodeToReplace of yield* getAncestorNodesInRange(sourceFile, textRange)) {
@@ -3470,7 +3633,7 @@ var removeUnnecessaryEffectGen = createRefactor({
3470
3633
 
3471
3634
  // src/refactors/toggleLazyConst.ts
3472
3635
  var toggleLazyConst = createRefactor({
3473
- name: "effect/toggleLazyConst",
3636
+ name: "toggleLazyConst",
3474
3637
  description: "Toggle lazy const",
3475
3638
  apply: fn("toggleLazyConst.apply")(function* (sourceFile, textRange) {
3476
3639
  const ts = yield* service(TypeScriptApi);
@@ -3510,7 +3673,7 @@ var toggleLazyConst = createRefactor({
3510
3673
 
3511
3674
  // src/refactors/toggleReturnTypeAnnotation.ts
3512
3675
  var toggleReturnTypeAnnotation = createRefactor({
3513
- name: "effect/toggleReturnTypeAnnotation",
3676
+ name: "toggleReturnTypeAnnotation",
3514
3677
  description: "Toggle return type annotation",
3515
3678
  apply: fn("toggleReturnTypeAnnotation.apply")(function* (sourceFile, textRange) {
3516
3679
  const ts = yield* service(TypeScriptApi);
@@ -3560,16 +3723,14 @@ var toggleReturnTypeAnnotation = createRefactor({
3560
3723
 
3561
3724
  // src/refactors/toggleTypeAnnotation.ts
3562
3725
  var toggleTypeAnnotation = createRefactor({
3563
- name: "effect/toggleTypeAnnotation",
3726
+ name: "toggleTypeAnnotation",
3564
3727
  description: "Toggle type annotation",
3565
3728
  apply: fn("toggleTypeAnnotation.apply")(function* (sourceFile, textRange) {
3566
3729
  const ts = yield* service(TypeScriptApi);
3567
3730
  const typeChecker = yield* service(TypeCheckerApi);
3568
3731
  const maybeNode = pipe(
3569
3732
  yield* getAncestorNodesInRange(sourceFile, textRange),
3570
- filter(
3571
- (node2) => ts.isVariableDeclaration(node2) || ts.isPropertyDeclaration(node2)
3572
- ),
3733
+ filter((node2) => ts.isVariableDeclaration(node2) || ts.isPropertyDeclaration(node2)),
3573
3734
  filter((node2) => isNodeInRange(textRange)(node2.name)),
3574
3735
  filter((node2) => !!node2.initializer),
3575
3736
  head
@@ -4079,7 +4240,7 @@ var applyAtNode = fn("SchemaGen.applyAtNode")(
4079
4240
 
4080
4241
  // src/refactors/typeToEffectSchema.ts
4081
4242
  var typeToEffectSchema = createRefactor({
4082
- name: "effect/typeToEffectSchema",
4243
+ name: "typeToEffectSchema",
4083
4244
  description: "Refactor to Schema",
4084
4245
  apply: fn("typeToEffectSchema.apply")(function* (sourceFile, textRange) {
4085
4246
  const ts = yield* service(TypeScriptApi);
@@ -4101,7 +4262,7 @@ var typeToEffectSchema = createRefactor({
4101
4262
 
4102
4263
  // src/refactors/typeToEffectSchemaClass.ts
4103
4264
  var typeToEffectSchemaClass = createRefactor({
4104
- name: "effect/typeToEffectSchemaClass",
4265
+ name: "typeToEffectSchemaClass",
4105
4266
  description: "Refactor to Schema.Class",
4106
4267
  apply: fn("typeToEffectSchemaClass.apply")(function* (sourceFile, textRange) {
4107
4268
  const ts = yield* service(TypeScriptApi);
@@ -4123,7 +4284,7 @@ var typeToEffectSchemaClass = createRefactor({
4123
4284
 
4124
4285
  // src/refactors/wrapWithEffectGen.ts
4125
4286
  var wrapWithEffectGen = createRefactor({
4126
- name: "effect/wrapWithEffectGen",
4287
+ name: "wrapWithEffectGen",
4127
4288
  description: "Wrap with Effect.gen",
4128
4289
  apply: fn("wrapWithEffectGen.apply")(function* (sourceFile, textRange) {
4129
4290
  const ts = yield* service(TypeScriptApi);
@@ -4140,7 +4301,7 @@ var wrapWithEffectGen = createRefactor({
4140
4301
  );
4141
4302
  const maybeNode = yield* pipe(
4142
4303
  yield* getAncestorNodesInRange(sourceFile, textRange),
4143
- map2(findEffectToWrap),
4304
+ map3(findEffectToWrap),
4144
4305
  firstSuccessOf,
4145
4306
  option
4146
4307
  );
@@ -4174,7 +4335,7 @@ var getEffectModuleIdentifierName = fn("getEffectModuleIdentifierName")(
4174
4335
  (node) => pipe(
4175
4336
  importedEffectModule(node),
4176
4337
  option,
4177
- map3(isSome2)
4338
+ map4(isSome2)
4178
4339
  )
4179
4340
  )
4180
4341
  ),
@@ -4188,7 +4349,7 @@ var getEffectModuleIdentifierName = fn("getEffectModuleIdentifierName")(
4188
4349
 
4189
4350
  // src/refactors/wrapWithPipe.ts
4190
4351
  var wrapWithPipe = createRefactor({
4191
- name: "effect/wrapWithPipe",
4352
+ name: "wrapWithPipe",
4192
4353
  description: "Wrap with pipe",
4193
4354
  apply: fn("wrapWithPipe.apply")(function* (sourceFile, textRange) {
4194
4355
  if (textRange.end - textRange.pos === 0) {
@@ -4226,10 +4387,12 @@ var refactors = [
4226
4387
  ];
4227
4388
 
4228
4389
  // src/index.ts
4390
+ var LSP_INJECTED_URI = "@effect/language-service/injected";
4229
4391
  var init = (modules) => {
4230
4392
  function create(info) {
4231
4393
  const languageService = info.languageService;
4232
- const pluginOptions = parsePluginOptions(info.config);
4394
+ if (languageService[LSP_INJECTED_URI]) return languageService;
4395
+ const languageServicePluginOptions = parse(info.config);
4233
4396
  const diagnosticsErrorCodes = diagnostics.map((diagnostic) => diagnostic.code);
4234
4397
  try {
4235
4398
  ;
@@ -4240,28 +4403,38 @@ var init = (modules) => {
4240
4403
  } catch (_) {
4241
4404
  }
4242
4405
  const proxy = /* @__PURE__ */ Object.create(null);
4406
+ proxy[LSP_INJECTED_URI] = true;
4243
4407
  for (const k of Object.keys(languageService)) {
4244
4408
  proxy[k] = (...args) => languageService[k].apply(languageService, args);
4245
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
+ }
4246
4427
  const effectCodeFixesForFile = /* @__PURE__ */ new Map();
4247
4428
  proxy.getSemanticDiagnostics = (fileName, ...args) => {
4248
4429
  const applicableDiagnostics = languageService.getSemanticDiagnostics(fileName, ...args);
4249
4430
  const program = languageService.getProgram();
4250
- if (pluginOptions.diagnostics && program) {
4431
+ if (languageServicePluginOptions.diagnostics && program) {
4251
4432
  effectCodeFixesForFile.delete(fileName);
4252
4433
  const sourceFile = program.getSourceFile(fileName);
4253
4434
  if (sourceFile) {
4254
4435
  return pipe(
4255
4436
  getSemanticDiagnosticsWithCodeFixes(diagnostics, sourceFile),
4256
- provideService(TypeScriptProgram, program),
4257
- provideService(TypeCheckerApi, program.getTypeChecker()),
4258
- provideService(
4259
- TypeCheckerApiCache,
4260
- makeTypeCheckerApiCache()
4261
- ),
4262
- provideService(TypeScriptApi, modules.typescript),
4263
- provideService(PluginOptions, pluginOptions),
4264
- run,
4437
+ runNano(program),
4265
4438
  Either_exports.map(({ codeFixes, diagnostics: diagnostics2 }) => {
4266
4439
  effectCodeFixesForFile.set(fileName, codeFixes);
4267
4440
  return diagnostics2.concat(applicableDiagnostics);
@@ -4330,14 +4503,7 @@ var init = (modules) => {
4330
4503
  if (sourceFile) {
4331
4504
  return pipe(
4332
4505
  getApplicableRefactors(refactors, sourceFile, positionOrRange),
4333
- provideService(TypeCheckerApi, program.getTypeChecker()),
4334
- provideService(
4335
- TypeCheckerApiCache,
4336
- makeTypeCheckerApiCache()
4337
- ),
4338
- provideService(TypeScriptApi, modules.typescript),
4339
- provideService(PluginOptions, pluginOptions),
4340
- run,
4506
+ runNano(program),
4341
4507
  Either_exports.map((effectRefactors) => applicableRefactors.concat(effectRefactors)),
4342
4508
  Either_exports.getOrElse(() => applicableRefactors)
4343
4509
  );
@@ -4376,14 +4542,7 @@ var init = (modules) => {
4376
4542
  );
4377
4543
  return { edits };
4378
4544
  }),
4379
- provideService(TypeCheckerApi, program.getTypeChecker()),
4380
- provideService(
4381
- TypeCheckerApiCache,
4382
- makeTypeCheckerApiCache()
4383
- ),
4384
- provideService(TypeScriptApi, modules.typescript),
4385
- provideService(PluginOptions, pluginOptions),
4386
- run
4545
+ runNano(program)
4387
4546
  );
4388
4547
  if (Either_exports.isRight(result)) return result.right;
4389
4548
  }
@@ -4400,7 +4559,7 @@ var init = (modules) => {
4400
4559
  };
4401
4560
  proxy.getQuickInfoAtPosition = (fileName, position, ...args) => {
4402
4561
  const quickInfo = languageService.getQuickInfoAtPosition(fileName, position, ...args);
4403
- if (pluginOptions.quickinfo) {
4562
+ if (languageServicePluginOptions.quickinfo) {
4404
4563
  const dedupedTagsQuickInfo = dedupeJsDocTags(quickInfo);
4405
4564
  const program = languageService.getProgram();
4406
4565
  if (program) {
@@ -4412,11 +4571,7 @@ var init = (modules) => {
4412
4571
  position,
4413
4572
  dedupedTagsQuickInfo
4414
4573
  ),
4415
- provideService(TypeScriptProgram, program),
4416
- provideService(TypeCheckerApi, program.getTypeChecker()),
4417
- provideService(TypeScriptApi, modules.typescript),
4418
- provideService(PluginOptions, pluginOptions),
4419
- run,
4574
+ runNano(program),
4420
4575
  Either_exports.getOrElse(() => dedupedTagsQuickInfo)
4421
4576
  );
4422
4577
  }
@@ -4433,7 +4588,7 @@ var init = (modules) => {
4433
4588
  formattingSettings,
4434
4589
  ...args
4435
4590
  );
4436
- if (pluginOptions.completions) {
4591
+ if (languageServicePluginOptions.completions) {
4437
4592
  const program = languageService.getProgram();
4438
4593
  if (program) {
4439
4594
  const sourceFile = program.getSourceFile(fileName);
@@ -4446,15 +4601,7 @@ var init = (modules) => {
4446
4601
  options,
4447
4602
  formattingSettings
4448
4603
  ),
4449
- provideService(TypeScriptProgram, program),
4450
- provideService(TypeCheckerApi, program.getTypeChecker()),
4451
- provideService(
4452
- TypeCheckerApiCache,
4453
- makeTypeCheckerApiCache()
4454
- ),
4455
- provideService(TypeScriptApi, modules.typescript),
4456
- provideService(PluginOptions, pluginOptions),
4457
- run,
4604
+ runNano(program),
4458
4605
  Either_exports.map(
4459
4606
  (effectCompletions) => applicableCompletions ? {
4460
4607
  ...applicableCompletions,