@effect/language-service 0.41.1 → 0.42.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/index.js CHANGED
@@ -1749,6 +1749,7 @@ var defaults = {
1749
1749
  diagnosticSeverity: {},
1750
1750
  quickinfo: true,
1751
1751
  quickinfoEffectParameters: "whentruncated",
1752
+ quickinfoMaximumLength: -1,
1752
1753
  completions: true,
1753
1754
  goto: true,
1754
1755
  inlays: true,
@@ -1767,6 +1768,7 @@ function parse(config) {
1767
1768
  diagnosticSeverity: isObject(config) && hasProperty(config, "diagnosticSeverity") && isRecord(config.diagnosticSeverity) ? parseDiagnosticSeverity(config.diagnosticSeverity) : defaults.diagnosticSeverity,
1768
1769
  quickinfo: isObject(config) && hasProperty(config, "quickinfo") && isBoolean(config.quickinfo) ? config.quickinfo : defaults.quickinfo,
1769
1770
  quickinfoEffectParameters: isObject(config) && hasProperty(config, "quickinfoEffectParameters") && isString(config.quickinfoEffectParameters) && ["always", "never", "whentruncated"].includes(config.quickinfoEffectParameters.toLowerCase()) ? config.quickinfoEffectParameters.toLowerCase() : defaults.quickinfoEffectParameters,
1771
+ quickinfoMaximumLength: isObject(config) && hasProperty(config, "quickinfoMaximumLength") && isNumber(config.quickinfoMaximumLength) ? config.quickinfoMaximumLength : defaults.quickinfoMaximumLength,
1770
1772
  completions: isObject(config) && hasProperty(config, "completions") && isBoolean(config.completions) ? config.completions : defaults.completions,
1771
1773
  goto: isObject(config) && hasProperty(config, "goto") && isBoolean(config.goto) ? config.goto : defaults.goto,
1772
1774
  inlays: isObject(config) && hasProperty(config, "inlays") && isBoolean(config.inlays) ? config.inlays : defaults.inlays,
@@ -6729,11 +6731,22 @@ function effectTypeArgs(sourceFile, position, quickInfo2) {
6729
6731
  const options = yield* service(LanguageServicePluginOptions);
6730
6732
  if (options.quickinfoEffectParameters === "never") return quickInfo2;
6731
6733
  function formatTypeForQuickInfo(channelType, channelName) {
6732
- const stringRepresentation = typeChecker.typeToString(
6733
- channelType,
6734
- void 0,
6735
- ts.TypeFormatFlags.NoTruncation
6736
- );
6734
+ let stringRepresentation = "";
6735
+ if (options.quickinfoMaximumLength > 0) {
6736
+ const typeNode = typeChecker.typeToTypeNode(
6737
+ channelType,
6738
+ void 0,
6739
+ ts.NodeBuilderFlags.None,
6740
+ // @ts-expect-error
6741
+ void 0,
6742
+ void 0,
6743
+ options.quickinfoMaximumLength
6744
+ );
6745
+ const printer = ts.createPrinter({});
6746
+ stringRepresentation = typeNode ? printer.printNode(ts.EmitHint.Unspecified, typeNode, sourceFile) : "";
6747
+ } else {
6748
+ stringRepresentation = typeChecker.typeToString(channelType, void 0, ts.TypeFormatFlags.NoTruncation);
6749
+ }
6737
6750
  return `type ${channelName} = ${stringRepresentation}`;
6738
6751
  }
6739
6752
  function makeSymbolDisplayParts(title, A, E, R) {