@effect/language-service 0.12.1 → 0.12.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.
Files changed (3) hide show
  1. package/index.js +20 -25
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -210592,17 +210592,20 @@ var Nano = class {
210592
210592
  return new SingleShotGen(new YieldWrap(this));
210593
210593
  }
210594
210594
  };
210595
+ var unsafeRun = (fa) => {
210596
+ const result = fa.run(contextEmpty);
210597
+ switch (result._tag) {
210598
+ case "Left":
210599
+ return left2(result.left);
210600
+ case "Defect":
210601
+ return left2(new NanoDefectException(result.defect));
210602
+ case "Right":
210603
+ return right2(result.right);
210604
+ }
210605
+ };
210595
210606
  var run = (fa) => {
210596
210607
  try {
210597
- const result = fa.run(contextEmpty);
210598
- switch (result._tag) {
210599
- case "Left":
210600
- return left2(result.left);
210601
- case "Defect":
210602
- return left2(new NanoDefectException(result.defect));
210603
- case "Right":
210604
- return right2(result.right);
210605
- }
210608
+ return unsafeRun(fa);
210606
210609
  } catch (e) {
210607
210610
  return left2(new NanoDefectException(e));
210608
210611
  }
@@ -212072,22 +212075,14 @@ var unnecessaryEffectGen = createDiagnostic({
212072
212075
  while (nodeToVisit.length > 0) {
212073
212076
  const node = nodeToVisit.shift();
212074
212077
  ts2.forEachChild(node, appendNodeToVisit);
212075
- const maybeUnnecessaryYield = yield* option(
212076
- returnYieldEffectBlock(node)
212078
+ const maybeNode = yield* pipe(
212079
+ effectGen(node),
212080
+ flatMap3(({ body }) => returnYieldEffectBlock(body)),
212081
+ option
212077
212082
  );
212078
- if (isSome2(maybeUnnecessaryYield)) {
212079
- const functionStarNode = ts2.findAncestor(
212080
- node,
212081
- (_) => (ts2.isFunctionExpression(_) || ts2.isMethodDeclaration(_)) && _.asteriskToken !== void 0
212082
- );
212083
- if (functionStarNode && functionStarNode.parent) {
212084
- const effectGenNode = functionStarNode.parent;
212085
- const maybeUnnecessaryGen = yield* option(
212086
- effectGen(effectGenNode)
212087
- );
212088
- if (isSome2(maybeUnnecessaryGen)) {
212089
- unnecessaryGenerators.set(maybeUnnecessaryGen.value.node, maybeUnnecessaryYield.value);
212090
- }
212083
+ if (isSome2(maybeNode)) {
212084
+ if (isSome2(maybeNode)) {
212085
+ unnecessaryGenerators.set(node, maybeNode.value);
212091
212086
  }
212092
212087
  }
212093
212088
  }
@@ -212095,7 +212090,7 @@ var unnecessaryEffectGen = createDiagnostic({
212095
212090
  (yieldedResult, effectGenCall) => effectDiagnostics.push({
212096
212091
  node: effectGenCall,
212097
212092
  category: ts2.DiagnosticCategory.Suggestion,
212098
- messageText: `This Effect.gen is useless here because it only contains a single return statement.`,
212093
+ messageText: `This Effect.gen contains a single return statement.`,
212099
212094
  fixes: [{
212100
212095
  fixName: "unnecessaryEffectGen_fix",
212101
212096
  description: "Remove the Effect.gen, and keep the body",