@effect/language-service 0.22.0 → 0.22.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/language-service",
3
- "version": "0.22.0",
3
+ "version": "0.22.2",
4
4
  "description": "A Language-Service Plugin to Refactor and Diagnostic effect-ts projects",
5
5
  "main": "index.cjs",
6
6
  "repository": {
package/transform.js CHANGED
@@ -787,29 +787,11 @@ var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
787
787
  });
788
788
 
789
789
  // src/core/Nano.ts
790
- var NanoInternalSuccessProto = {
791
- _tag: "Right"
792
- };
793
790
  function makeInternalSuccess(value) {
794
- const result = Object.create(NanoInternalSuccessProto);
795
- result.value = value;
796
- return result;
791
+ return { _tag: "Right", value };
797
792
  }
798
- var NanoInternalFailureProto = {
799
- _tag: "Left"
800
- };
801
- function makeInternalFailure(value) {
802
- const result = Object.create(NanoInternalFailureProto);
803
- result.value = value;
804
- return result;
805
- }
806
- var NanoInternalDefectProto = {
807
- _tag: "Defect"
808
- };
809
793
  function makeInternalDefect(value) {
810
- const result = Object.create(NanoInternalDefectProto);
811
- result.value = value;
812
- return result;
794
+ return { _tag: "Defect", value };
813
795
  }
814
796
  var NanoDefectException = class {
815
797
  constructor(message) {
@@ -824,17 +806,14 @@ var NanoTag = class {
824
806
  };
825
807
  var Tag = (identifier) => new NanoTag(identifier);
826
808
  var contextEmpty = { value: {} };
827
- var Proto = {
828
- run: () => {
829
- },
830
- [Symbol.iterator]() {
831
- return new SingleShotGen(new YieldWrap(this));
832
- }
833
- };
834
809
  function make2(run2) {
835
- const result = Object.create(Proto);
836
- result.run = run2;
837
- return result;
810
+ const nano = {
811
+ run: run2,
812
+ [Symbol.iterator]() {
813
+ return new SingleShotGen(new YieldWrap(this));
814
+ }
815
+ };
816
+ return nano;
838
817
  }
839
818
  var unsafeRun = (fa) => {
840
819
  const program = provideService(internalNanoCache, {})(fa);
@@ -855,9 +834,33 @@ var run = (fa) => {
855
834
  return left2(new NanoDefectException(e));
856
835
  }
857
836
  };
858
- var succeed = (value) => make2(() => makeInternalSuccess(value));
859
- var fail = (value) => make2(() => makeInternalFailure(value));
860
- var sync = (value) => make2(() => makeInternalSuccess(value()));
837
+ var succeed = (value) => {
838
+ const nano = {
839
+ run: () => ({ _tag: "Right", value }),
840
+ [Symbol.iterator]() {
841
+ return new SingleShotGen(new YieldWrap(this));
842
+ }
843
+ };
844
+ return nano;
845
+ };
846
+ var fail = (value) => {
847
+ const nano = {
848
+ run: () => ({ _tag: "Left", value }),
849
+ [Symbol.iterator]() {
850
+ return new SingleShotGen(new YieldWrap(this));
851
+ }
852
+ };
853
+ return nano;
854
+ };
855
+ var sync = (value) => {
856
+ const nano = {
857
+ run: () => ({ _tag: "Right", value: value() }),
858
+ [Symbol.iterator]() {
859
+ return new SingleShotGen(new YieldWrap(this));
860
+ }
861
+ };
862
+ return nano;
863
+ };
861
864
  var flatMap = dual(2, (fa, f) => make2((ctx) => {
862
865
  const result = fa.run(ctx);
863
866
  if (result._tag !== "Right") return result;
@@ -949,8 +952,9 @@ function cachedBy(fa, key, lookupKey) {
949
952
  cacheObj[key] = cache;
950
953
  }
951
954
  const lookup = lookupKey(...args);
952
- if (cache.has(lookup)) {
953
- return cache.get(lookup);
955
+ const cached2 = cache.get(lookup);
956
+ if (cached2 !== void 0) {
957
+ return cached2;
954
958
  }
955
959
  const result = fa(...args).run(ctx);
956
960
  cache.set(lookup, result);
@@ -2727,22 +2731,24 @@ var missingEffectContext = createDiagnostic({
2727
2731
  const sortTypes = sort(typeOrder);
2728
2732
  const entries = yield* expectedAndRealType(sourceFile);
2729
2733
  for (const [node, expectedType, valueNode, realType] of entries) {
2730
- const missingContext = yield* pipe(
2731
- checkForMissingContextTypes(
2732
- node,
2733
- expectedType,
2734
- valueNode,
2735
- realType
2736
- ),
2737
- orElse2(() => succeed([]))
2738
- );
2739
- if (missingContext.length > 0) {
2740
- report(
2741
- {
2734
+ if (expectedType !== realType) {
2735
+ yield* pipe(
2736
+ checkForMissingContextTypes(
2742
2737
  node,
2743
- messageText: `Missing '${sortTypes(missingContext).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Effect context.`,
2744
- fixes: []
2745
- }
2738
+ expectedType,
2739
+ valueNode,
2740
+ realType
2741
+ ),
2742
+ map3(
2743
+ (missingTypes) => missingTypes.length > 0 ? report(
2744
+ {
2745
+ node,
2746
+ messageText: `Missing '${sortTypes(missingTypes).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Effect context.`,
2747
+ fixes: []
2748
+ }
2749
+ ) : void 0
2750
+ ),
2751
+ ignore
2746
2752
  );
2747
2753
  }
2748
2754
  }
@@ -2773,22 +2779,24 @@ var missingEffectError = createDiagnostic({
2773
2779
  const sortTypes = sort(typeOrder);
2774
2780
  const entries = yield* expectedAndRealType(sourceFile);
2775
2781
  for (const [node, expectedType, valueNode, realType] of entries) {
2776
- const missingContext = yield* pipe(
2777
- checkForMissingErrorTypes(
2778
- node,
2779
- expectedType,
2780
- valueNode,
2781
- realType
2782
- ),
2783
- orElse2(() => succeed([]))
2784
- );
2785
- if (missingContext.length > 0) {
2786
- report(
2787
- {
2782
+ if (expectedType !== realType) {
2783
+ yield* pipe(
2784
+ checkForMissingErrorTypes(
2788
2785
  node,
2789
- messageText: `Missing '${sortTypes(missingContext).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Effect errors.`,
2790
- fixes: []
2791
- }
2786
+ expectedType,
2787
+ valueNode,
2788
+ realType
2789
+ ),
2790
+ map3(
2791
+ (missingTypes) => missingTypes.length > 0 ? report(
2792
+ {
2793
+ node,
2794
+ messageText: `Missing '${sortTypes(missingTypes).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Effect errors.`,
2795
+ fixes: []
2796
+ }
2797
+ ) : void 0
2798
+ ),
2799
+ ignore
2792
2800
  );
2793
2801
  }
2794
2802
  }