@effect/language-service 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,6 +23,7 @@ This package implements a TypeScript language service plugin that allows additio
23
23
 
24
24
  - In VSCode you can do this by pressing "F1" and typing "TypeScript: Select TypeScript version". Then select "Use workspace version".
25
25
  - In JetBrains you may have to disable the Vue language service, and chose the workspace version of TypeScript in the settings from the dropdown.
26
+ - In NVim with nvim-vtsls you should refer to [how to enable TypeScript plugins in vstls](https://github.com/yioneko/vtsls?tab=readme-ov-file#typescript-plugin-not-activated)
26
27
 
27
28
  And you're done! You'll now be able to use a set of refactor and diagnostics that targets Effect!
28
29
 
package/index.js CHANGED
@@ -961,7 +961,6 @@ var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
961
961
  }
962
962
  return out;
963
963
  });
964
- var reduce = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable(self).reduce((b2, a, i) => f(b2, a, i), b));
965
964
  var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
966
965
  const input = fromIterable(self);
967
966
  if (isNonEmptyReadonlyArray(input)) {
@@ -978,6 +977,30 @@ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
978
977
  });
979
978
 
980
979
  // src/core/Nano.ts
980
+ var NanoInternalSuccessProto = {
981
+ _tag: "Right"
982
+ };
983
+ function makeInternalSuccess(value) {
984
+ const result = Object.create(NanoInternalSuccessProto);
985
+ result.value = value;
986
+ return result;
987
+ }
988
+ var NanoInternalFailureProto = {
989
+ _tag: "Left"
990
+ };
991
+ function makeInternalFailure(value) {
992
+ const result = Object.create(NanoInternalFailureProto);
993
+ result.value = value;
994
+ return result;
995
+ }
996
+ var NanoInternalDefectProto = {
997
+ _tag: "Defect"
998
+ };
999
+ function makeInternalDefect(value) {
1000
+ const result = Object.create(NanoInternalDefectProto);
1001
+ result.value = value;
1002
+ return result;
1003
+ }
981
1004
  var NanoDefectException = class {
982
1005
  constructor(message) {
983
1006
  this.message = message;
@@ -991,19 +1014,6 @@ var NanoTag = class {
991
1014
  };
992
1015
  var Tag = (identifier) => new NanoTag(identifier);
993
1016
  var contextEmpty = { value: {} };
994
- var contextAdd = (context, tag, value) => ({
995
- ...context,
996
- value: {
997
- ...context.value,
998
- [tag.key]: value
999
- }
1000
- });
1001
- var contextGet = (context, tag) => {
1002
- if (tag.key in context.value) {
1003
- return some2(context.value[tag.key]);
1004
- }
1005
- return none2();
1006
- };
1007
1017
  var Proto = {
1008
1018
  run: () => {
1009
1019
  },
@@ -1034,9 +1044,9 @@ var run = (fa) => {
1034
1044
  return left2(new NanoDefectException(e));
1035
1045
  }
1036
1046
  };
1037
- var succeed = (value) => make3(() => ({ _tag: "Right", value }));
1038
- var fail = (value) => make3(() => ({ _tag: "Left", value }));
1039
- var sync = (value) => make3(() => ({ _tag: "Right", value: value() }));
1047
+ var succeed = (value) => make3(() => makeInternalSuccess(value));
1048
+ var fail = (value) => make3(() => makeInternalFailure(value));
1049
+ var sync = (value) => make3(() => makeInternalSuccess(value()));
1040
1050
  var flatMap3 = dual(2, (fa, f) => make3((ctx) => {
1041
1051
  const result = fa.run(ctx);
1042
1052
  if (result._tag !== "Right") return result;
@@ -1045,22 +1055,25 @@ var flatMap3 = dual(2, (fa, f) => make3((ctx) => {
1045
1055
  var map3 = dual(2, (fa, f) => make3((ctx) => {
1046
1056
  const result = fa.run(ctx);
1047
1057
  if (result._tag !== "Right") return result;
1048
- return { _tag: "Right", value: f(result.value) };
1058
+ return makeInternalSuccess(f(result.value));
1049
1059
  }));
1050
1060
  var orElse3 = (f) => (fa) => make3((ctx) => {
1051
1061
  const result = fa.run(ctx);
1052
1062
  if (result._tag === "Left") return f(result.value).run(ctx);
1053
1063
  return result;
1054
1064
  });
1055
- var firstSuccessOf = (arr) => reduce(arr.slice(1), arr[0], (arr2, fa) => orElse3(() => fa)(arr2));
1065
+ var firstSuccessOf = (arr) => arr.slice(1).reduce((arr2, fa) => orElse3(() => fa)(arr2), arr[0]);
1056
1066
  var service = (tag) => make3(
1057
- (ctx) => contextGet(ctx, tag).pipe(match2({
1058
- onNone: () => ({ _tag: "Defect", value: `Cannot find service ${tag.key}` }),
1059
- onSome: (value) => ({ _tag: "Right", value })
1060
- }))
1067
+ (ctx) => tag.key in ctx.value ? makeInternalSuccess(ctx.value[tag.key]) : makeInternalDefect(`Cannot find service ${tag.key}`)
1061
1068
  );
1062
1069
  var provideService = (tag, value) => (fa) => make3((ctx) => {
1063
- return fa.run(contextAdd(ctx, tag, value));
1070
+ return fa.run({
1071
+ ...ctx,
1072
+ value: {
1073
+ ...ctx.value,
1074
+ [tag.key]: value
1075
+ }
1076
+ });
1064
1077
  });
1065
1078
  var gen2 = (...args) => make3((ctx) => {
1066
1079
  const iterator = args[0]();
@@ -1073,7 +1086,7 @@ var gen2 = (...args) => make3((ctx) => {
1073
1086
  }
1074
1087
  state = iterator.next(result.value);
1075
1088
  }
1076
- return { _tag: "Right", value: state.value };
1089
+ return makeInternalSuccess(state.value);
1077
1090
  });
1078
1091
  var fn = (_) => (body) => (...args) => make3((ctx) => {
1079
1092
  const iterator = body(...args);
@@ -1086,15 +1099,15 @@ var fn = (_) => (body) => (...args) => make3((ctx) => {
1086
1099
  }
1087
1100
  state = iterator.next(result.value);
1088
1101
  }
1089
- return { _tag: "Right", value: state.value };
1102
+ return makeInternalSuccess(state.value);
1090
1103
  });
1091
1104
  var option = (fa) => make3((ctx) => {
1092
1105
  const result = fa.run(ctx);
1093
1106
  switch (result._tag) {
1094
1107
  case "Right":
1095
- return { _tag: "Right", value: some2(result.value) };
1108
+ return makeInternalSuccess(some2(result.value));
1096
1109
  case "Left":
1097
- return { _tag: "Right", value: none2() };
1110
+ return makeInternalSuccess(none2());
1098
1111
  case "Defect":
1099
1112
  return result;
1100
1113
  }
@@ -1468,7 +1481,9 @@ function createCompletion(definition) {
1468
1481
  return definition;
1469
1482
  }
1470
1483
  var PluginOptions = Tag("PluginOptions");
1471
- var getSemanticDiagnosticsWithCodeFixes = fn("LSP.getSemanticDiagnostics")(function* (rules, sourceFile) {
1484
+ var getSemanticDiagnosticsWithCodeFixes = fn(
1485
+ "LSP.getSemanticDiagnosticsWithCodeFixes"
1486
+ )(function* (rules, sourceFile) {
1472
1487
  const effectDiagnostics = [];
1473
1488
  const effectCodeFixes = [];
1474
1489
  const executor = yield* createDiagnosticExecutor(sourceFile);
@@ -2570,9 +2585,7 @@ var unnecessaryEffectGen = createDiagnostic({
2570
2585
  option
2571
2586
  );
2572
2587
  if (isSome2(maybeNode)) {
2573
- if (isSome2(maybeNode)) {
2574
- unnecessaryGenerators.set(node, maybeNode.value);
2575
- }
2588
+ unnecessaryGenerators.set(node, maybeNode.value);
2576
2589
  }
2577
2590
  }
2578
2591
  unnecessaryGenerators.forEach(