@effect/language-service 0.16.0 → 0.16.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.16.0",
3
+ "version": "0.16.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
@@ -718,10 +718,6 @@ var none2 = () => none;
718
718
  var some2 = some;
719
719
  var isNone2 = isNone;
720
720
  var isSome2 = isSome;
721
- var match = /* @__PURE__ */ dual(2, (self, {
722
- onNone,
723
- onSome
724
- }) => isNone2(self) ? onNone() : onSome(self.value));
725
721
 
726
722
  // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Array.js
727
723
  var isArray = Array.isArray;
@@ -749,6 +745,30 @@ var flatMap = /* @__PURE__ */ dual(2, (self, f) => {
749
745
  var flatten = /* @__PURE__ */ flatMap(identity);
750
746
 
751
747
  // src/core/Nano.ts
748
+ var NanoInternalSuccessProto = {
749
+ _tag: "Right"
750
+ };
751
+ function makeInternalSuccess(value) {
752
+ const result = Object.create(NanoInternalSuccessProto);
753
+ result.value = value;
754
+ return result;
755
+ }
756
+ var NanoInternalFailureProto = {
757
+ _tag: "Left"
758
+ };
759
+ function makeInternalFailure(value) {
760
+ const result = Object.create(NanoInternalFailureProto);
761
+ result.value = value;
762
+ return result;
763
+ }
764
+ var NanoInternalDefectProto = {
765
+ _tag: "Defect"
766
+ };
767
+ function makeInternalDefect(value) {
768
+ const result = Object.create(NanoInternalDefectProto);
769
+ result.value = value;
770
+ return result;
771
+ }
752
772
  var NanoDefectException = class {
753
773
  constructor(message) {
754
774
  this.message = message;
@@ -762,19 +782,6 @@ var NanoTag = class {
762
782
  };
763
783
  var Tag = (identifier) => new NanoTag(identifier);
764
784
  var contextEmpty = { value: {} };
765
- var contextAdd = (context, tag, value) => ({
766
- ...context,
767
- value: {
768
- ...context.value,
769
- [tag.key]: value
770
- }
771
- });
772
- var contextGet = (context, tag) => {
773
- if (tag.key in context.value) {
774
- return some2(context.value[tag.key]);
775
- }
776
- return none2();
777
- };
778
785
  var Proto = {
779
786
  run: () => {
780
787
  },
@@ -805,9 +812,9 @@ var run = (fa) => {
805
812
  return left2(new NanoDefectException(e));
806
813
  }
807
814
  };
808
- var succeed = (value) => make2(() => ({ _tag: "Right", value }));
809
- var fail = (value) => make2(() => ({ _tag: "Left", value }));
810
- var sync = (value) => make2(() => ({ _tag: "Right", value: value() }));
815
+ var succeed = (value) => make2(() => makeInternalSuccess(value));
816
+ var fail = (value) => make2(() => makeInternalFailure(value));
817
+ var sync = (value) => make2(() => makeInternalSuccess(value()));
811
818
  var flatMap2 = dual(2, (fa, f) => make2((ctx) => {
812
819
  const result = fa.run(ctx);
813
820
  if (result._tag !== "Right") return result;
@@ -816,7 +823,7 @@ var flatMap2 = dual(2, (fa, f) => make2((ctx) => {
816
823
  var map3 = dual(2, (fa, f) => make2((ctx) => {
817
824
  const result = fa.run(ctx);
818
825
  if (result._tag !== "Right") return result;
819
- return { _tag: "Right", value: f(result.value) };
826
+ return makeInternalSuccess(f(result.value));
820
827
  }));
821
828
  var orElse = (f) => (fa) => make2((ctx) => {
822
829
  const result = fa.run(ctx);
@@ -824,13 +831,16 @@ var orElse = (f) => (fa) => make2((ctx) => {
824
831
  return result;
825
832
  });
826
833
  var service = (tag) => make2(
827
- (ctx) => contextGet(ctx, tag).pipe(match({
828
- onNone: () => ({ _tag: "Defect", value: `Cannot find service ${tag.key}` }),
829
- onSome: (value) => ({ _tag: "Right", value })
830
- }))
834
+ (ctx) => tag.key in ctx.value ? makeInternalSuccess(ctx.value[tag.key]) : makeInternalDefect(`Cannot find service ${tag.key}`)
831
835
  );
832
836
  var provideService = (tag, value) => (fa) => make2((ctx) => {
833
- return fa.run(contextAdd(ctx, tag, value));
837
+ return fa.run({
838
+ ...ctx,
839
+ value: {
840
+ ...ctx.value,
841
+ [tag.key]: value
842
+ }
843
+ });
834
844
  });
835
845
  var gen = (...args) => make2((ctx) => {
836
846
  const iterator = args[0]();
@@ -843,7 +853,7 @@ var gen = (...args) => make2((ctx) => {
843
853
  }
844
854
  state = iterator.next(result.value);
845
855
  }
846
- return { _tag: "Right", value: state.value };
856
+ return makeInternalSuccess(state.value);
847
857
  });
848
858
  var fn = (_) => (body) => (...args) => make2((ctx) => {
849
859
  const iterator = body(...args);
@@ -856,15 +866,15 @@ var fn = (_) => (body) => (...args) => make2((ctx) => {
856
866
  }
857
867
  state = iterator.next(result.value);
858
868
  }
859
- return { _tag: "Right", value: state.value };
869
+ return makeInternalSuccess(state.value);
860
870
  });
861
871
  var option = (fa) => make2((ctx) => {
862
872
  const result = fa.run(ctx);
863
873
  switch (result._tag) {
864
874
  case "Right":
865
- return { _tag: "Right", value: some2(result.value) };
875
+ return makeInternalSuccess(some2(result.value));
866
876
  case "Left":
867
- return { _tag: "Right", value: none2() };
877
+ return makeInternalSuccess(none2());
868
878
  case "Defect":
869
879
  return result;
870
880
  }
@@ -891,7 +901,9 @@ function parsePluginOptions(config) {
891
901
  };
892
902
  }
893
903
  var PluginOptions = Tag("PluginOptions");
894
- var getSemanticDiagnosticsWithCodeFixes = fn("LSP.getSemanticDiagnostics")(function* (rules, sourceFile) {
904
+ var getSemanticDiagnosticsWithCodeFixes = fn(
905
+ "LSP.getSemanticDiagnosticsWithCodeFixes"
906
+ )(function* (rules, sourceFile) {
895
907
  const effectDiagnostics = [];
896
908
  const effectCodeFixes = [];
897
909
  const executor = yield* createDiagnosticExecutor(sourceFile);
@@ -979,9 +991,9 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
979
991
  const ruleOverrides = {};
980
992
  const skippedRules = [];
981
993
  const regex = /@effect-diagnostics((?:\s[a-zA-Z0-9/]+:(?:off|warning|error|message|suggestion|skip-file))+)?/gm;
982
- let match2;
983
- while ((match2 = regex.exec(sourceFile.text)) !== null) {
984
- const rulesCaptureGroup = match2[1];
994
+ let match;
995
+ while ((match = regex.exec(sourceFile.text)) !== null) {
996
+ const rulesCaptureGroup = match[1];
985
997
  if (rulesCaptureGroup) {
986
998
  const trimmedRuleString = rulesCaptureGroup.trim();
987
999
  if (trimmedRuleString) {
@@ -992,11 +1004,11 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
992
1004
  if (ruleLevel === "skip-file") skippedRules.push(ruleName);
993
1005
  ruleOverrides[ruleName] = ruleOverrides[ruleName] || [];
994
1006
  const newLength = ruleOverrides[ruleName].push({
995
- start: match2.index,
1007
+ start: match.index,
996
1008
  end: Number.MAX_SAFE_INTEGER,
997
1009
  level: ruleLevel
998
1010
  });
999
- if (newLength > 1) ruleOverrides[ruleName][newLength - 2].end = match2.index;
1011
+ if (newLength > 1) ruleOverrides[ruleName][newLength - 2].end = match.index;
1000
1012
  }
1001
1013
  }
1002
1014
  }
@@ -1837,9 +1849,7 @@ var unnecessaryEffectGen = createDiagnostic({
1837
1849
  option
1838
1850
  );
1839
1851
  if (isSome2(maybeNode)) {
1840
- if (isSome2(maybeNode)) {
1841
- unnecessaryGenerators.set(node, maybeNode.value);
1842
- }
1852
+ unnecessaryGenerators.set(node, maybeNode.value);
1843
1853
  }
1844
1854
  }
1845
1855
  unnecessaryGenerators.forEach(