@effect/language-service 0.31.2 → 0.33.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/README.md CHANGED
@@ -90,16 +90,20 @@ Few options can be provided alongside the initialization of the Language Service
90
90
  "plugins": [
91
91
  {
92
92
  "name": "@effect/language-service",
93
+ "refactors": true, // controls Effect refactors (default: true)
93
94
  "diagnostics": true, // controls Effect diagnostics (default: true)
94
95
  "diagnosticSeverity": { // allows to change per-rule default severity of the diagnostic in the whole project
95
96
  "floatingEffect": "warning" // example for a rule, allowed values are off,error,warning,message,suggestion
96
97
  },
97
- "quickinfo": true, // controls quickinfo over Effect (default: true)
98
+ "quickinfo": true, // controls Effect quickinfo (default: true)
99
+ "quickinfoEffectParameters": "whenTruncated", // (default: "whenTruncated") controls when to display effect type parameters always,never,whenTruncated
98
100
  "completions": true, // controls Effect completions (default: true)
99
101
  "goto": true, // controls Effect goto references (default: true)
102
+ "inlays": true, // controls Effect provided inlayHints (default: true)
100
103
  "allowedDuplicatedPackages": [], // list of package names that have effect in peer dependencies and are allowed to be duplicated (default: [])
101
104
  "barrelImportPackages": [], // package names that should be preferred as imported from the top level barrel file (default: [])
102
- "namespaceImportPackages": [] // package names that should be preferred as imported with namespace imports e.g. ["effect", "@effect/*"] (default: [])
105
+ "namespaceImportPackages": [], // package names that should be preferred as imported with namespace imports e.g. ["effect", "@effect/*"] (default: [])
106
+ "topLevelNamedReexports": "ignore" // for namespaceImportPackages, how should top level named re-exports (e.g. {pipe} from "effect") be treated? "ignore" will leave them as is, "follow" will rewrite them to the re-exported module (e.g. {pipe} from "effect/Function")
103
107
  }
104
108
  ]
105
109
  }
package/cli.js CHANGED
@@ -28777,16 +28777,34 @@ function parseDiagnosticSeverity(config2) {
28777
28777
  )
28778
28778
  );
28779
28779
  }
28780
+ var defaults = {
28781
+ refactors: true,
28782
+ diagnostics: true,
28783
+ diagnosticSeverity: {},
28784
+ quickinfo: true,
28785
+ quickinfoEffectParameters: "whentruncated",
28786
+ completions: true,
28787
+ goto: true,
28788
+ inlays: true,
28789
+ allowedDuplicatedPackages: [],
28790
+ namespaceImportPackages: [],
28791
+ barrelImportPackages: [],
28792
+ topLevelNamedReexports: "ignore"
28793
+ };
28780
28794
  function parse4(config2) {
28781
28795
  return {
28782
- diagnostics: isObject(config2) && hasProperty(config2, "diagnostics") && isBoolean(config2.diagnostics) ? config2.diagnostics : true,
28783
- diagnosticSeverity: isObject(config2) && hasProperty(config2, "diagnosticSeverity") && isRecord(config2.diagnosticSeverity) ? parseDiagnosticSeverity(config2.diagnosticSeverity) : {},
28784
- quickinfo: isObject(config2) && hasProperty(config2, "quickinfo") && isBoolean(config2.quickinfo) ? config2.quickinfo : true,
28785
- completions: isObject(config2) && hasProperty(config2, "completions") && isBoolean(config2.completions) ? config2.completions : true,
28786
- goto: isObject(config2) && hasProperty(config2, "goto") && isBoolean(config2.goto) ? config2.goto : true,
28787
- allowedDuplicatedPackages: isObject(config2) && hasProperty(config2, "allowedDuplicatedPackages") && isArray(config2.allowedDuplicatedPackages) && config2.allowedDuplicatedPackages.every(isString) ? config2.allowedDuplicatedPackages.map((_) => _.toLowerCase()) : [],
28788
- namespaceImportPackages: isObject(config2) && hasProperty(config2, "namespaceImportPackages") && isArray(config2.namespaceImportPackages) && config2.namespaceImportPackages.every(isString) ? config2.namespaceImportPackages.map((_) => _.toLowerCase()) : [],
28789
- barrelImportPackages: isObject(config2) && hasProperty(config2, "barrelImportPackages") && isArray(config2.barrelImportPackages) && config2.barrelImportPackages.every(isString) ? config2.barrelImportPackages.map((_) => _.toLowerCase()) : []
28796
+ refactors: isObject(config2) && hasProperty(config2, "refactors") && isBoolean(config2.refactors) ? config2.refactors : defaults.refactors,
28797
+ diagnostics: isObject(config2) && hasProperty(config2, "diagnostics") && isBoolean(config2.diagnostics) ? config2.diagnostics : defaults.diagnostics,
28798
+ diagnosticSeverity: isObject(config2) && hasProperty(config2, "diagnosticSeverity") && isRecord(config2.diagnosticSeverity) ? parseDiagnosticSeverity(config2.diagnosticSeverity) : defaults.diagnosticSeverity,
28799
+ quickinfo: isObject(config2) && hasProperty(config2, "quickinfo") && isBoolean(config2.quickinfo) ? config2.quickinfo : defaults.quickinfo,
28800
+ quickinfoEffectParameters: isObject(config2) && hasProperty(config2, "quickinfoEffectParameters") && isString(config2.quickinfoEffectParameters) && ["always", "never", "whentruncated"].includes(config2.quickinfoEffectParameters.toLowerCase()) ? config2.quickinfoEffectParameters.toLowerCase() : defaults.quickinfoEffectParameters,
28801
+ completions: isObject(config2) && hasProperty(config2, "completions") && isBoolean(config2.completions) ? config2.completions : defaults.completions,
28802
+ goto: isObject(config2) && hasProperty(config2, "goto") && isBoolean(config2.goto) ? config2.goto : defaults.goto,
28803
+ inlays: isObject(config2) && hasProperty(config2, "inlays") && isBoolean(config2.inlays) ? config2.inlays : defaults.inlays,
28804
+ allowedDuplicatedPackages: isObject(config2) && hasProperty(config2, "allowedDuplicatedPackages") && isArray(config2.allowedDuplicatedPackages) && config2.allowedDuplicatedPackages.every(isString) ? config2.allowedDuplicatedPackages.map((_) => _.toLowerCase()) : defaults.allowedDuplicatedPackages,
28805
+ namespaceImportPackages: isObject(config2) && hasProperty(config2, "namespaceImportPackages") && isArray(config2.namespaceImportPackages) && config2.namespaceImportPackages.every(isString) ? config2.namespaceImportPackages.map((_) => _.toLowerCase()) : defaults.namespaceImportPackages,
28806
+ barrelImportPackages: isObject(config2) && hasProperty(config2, "barrelImportPackages") && isArray(config2.barrelImportPackages) && config2.barrelImportPackages.every(isString) ? config2.barrelImportPackages.map((_) => _.toLowerCase()) : defaults.barrelImportPackages,
28807
+ topLevelNamedReexports: isObject(config2) && hasProperty(config2, "topLevelNamedReexports") && isString(config2.topLevelNamedReexports) && ["ignore", "follow"].includes(config2.topLevelNamedReexports.toLowerCase()) ? config2.topLevelNamedReexports.toLowerCase() : defaults.topLevelNamedReexports
28790
28808
  };
28791
28809
  }
28792
28810
 
@@ -30817,9 +30835,11 @@ var floatingEffect = createDiagnostic({
30817
30835
  option4
30818
30836
  );
30819
30837
  if (isNone2(allowedFloatingEffects)) {
30838
+ const isStrictEffect = yield* option4(typeParser.strictEffectType(type2, node.expression));
30839
+ const name = isSome2(isStrictEffect) ? "Effect" : "Effect-able " + typeChecker.typeToString(type2);
30820
30840
  report({
30821
30841
  location: node,
30822
- messageText: `Effect must be yielded or assigned to a variable.`,
30842
+ messageText: `${name} must be yielded or assigned to a variable.`,
30823
30843
  fixes: []
30824
30844
  });
30825
30845
  }
@@ -31446,7 +31466,7 @@ var missingReturnYieldStar = createDiagnostic({
31446
31466
  }] : [];
31447
31467
  report({
31448
31468
  location: node,
31449
- messageText: `Yielded Effect never succeeds, so it is best to use a 'return yield*' instead.`,
31469
+ messageText: `It is recommended to use return yield* for Effects that never succeed to signal a definitive exit point for type narrowing and tooling support.`,
31450
31470
  fixes: fix
31451
31471
  });
31452
31472
  }