@effect/language-service 0.53.1 → 0.53.3

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
@@ -117,6 +117,7 @@ Few options can be provided alongside the initialization of the Language Service
117
117
  },
118
118
  "diagnosticsName": true, // controls whether to include the rule name in diagnostic messages (default: true)
119
119
  "missingDiagnosticNextLine": "warning", // controls the severity of warnings for unused @effect-diagnostics-next-line comments (default: "warning", allowed values: off,error,warning,message,suggestion)
120
+ "reportSuggestionsAsWarningsInTsc": false, // when enabled, diagnostics with "suggestion" or "message" severity will be reported as "warning" in TSC with "[suggestion]" prefix (default: false)
120
121
  "quickinfo": true, // controls Effect quickinfo (default: true)
121
122
  "quickinfoEffectParameters": "whenTruncated", // (default: "whenTruncated") controls when to display effect type parameters always,never,whenTruncated
122
123
  "quickinfoMaximumLength": -1, // controls how long can be the types in the quickinfo hover (helps with very long type to improve perfs, defaults to -1 for no truncation, can be any number eg. 1000 and TS will try to fit as much as possible in that budget, higher number means more info.)
package/cli.js CHANGED
@@ -31182,6 +31182,7 @@ var defaults = {
31182
31182
  diagnosticSeverity: {},
31183
31183
  diagnosticsName: true,
31184
31184
  missingDiagnosticNextLine: "warning",
31185
+ reportSuggestionsAsWarningsInTsc: false,
31185
31186
  quickinfo: true,
31186
31187
  quickinfoEffectParameters: "whentruncated",
31187
31188
  quickinfoMaximumLength: -1,
@@ -31227,6 +31228,7 @@ function parse4(config2) {
31227
31228
  diagnosticSeverity: isObject(config2) && hasProperty(config2, "diagnosticSeverity") && isRecord(config2.diagnosticSeverity) ? parseDiagnosticSeverity(config2.diagnosticSeverity) : defaults.diagnosticSeverity,
31228
31229
  diagnosticsName: isObject(config2) && hasProperty(config2, "diagnosticsName") && isBoolean(config2.diagnosticsName) ? config2.diagnosticsName : defaults.diagnosticsName,
31229
31230
  missingDiagnosticNextLine: isObject(config2) && hasProperty(config2, "missingDiagnosticNextLine") && isString(config2.missingDiagnosticNextLine) && isValidSeverityLevel(config2.missingDiagnosticNextLine) ? config2.missingDiagnosticNextLine : defaults.missingDiagnosticNextLine,
31231
+ reportSuggestionsAsWarningsInTsc: isObject(config2) && hasProperty(config2, "reportSuggestionsAsWarningsInTsc") && isBoolean(config2.reportSuggestionsAsWarningsInTsc) ? config2.reportSuggestionsAsWarningsInTsc : defaults.reportSuggestionsAsWarningsInTsc,
31230
31232
  quickinfo: isObject(config2) && hasProperty(config2, "quickinfo") && isBoolean(config2.quickinfo) ? config2.quickinfo : defaults.quickinfo,
31231
31233
  quickinfoEffectParameters: isObject(config2) && hasProperty(config2, "quickinfoEffectParameters") && isString(config2.quickinfoEffectParameters) && ["always", "never", "whentruncated"].includes(config2.quickinfoEffectParameters.toLowerCase()) ? config2.quickinfoEffectParameters.toLowerCase() : defaults.quickinfoEffectParameters,
31232
31234
  quickinfoMaximumLength: isObject(config2) && hasProperty(config2, "quickinfoMaximumLength") && isNumber(config2.quickinfoMaximumLength) ? config2.quickinfoMaximumLength : defaults.quickinfoMaximumLength,
@@ -35594,6 +35596,13 @@ var diagnostics2 = make58(
35594
35596
  }
35595
35597
  const filesToCheckArray = fromIterable(filesToCheck);
35596
35598
  const batches = chunksOf(filesToCheckArray, BATCH_SIZE);
35599
+ let lastLanguageService;
35600
+ const disposeIfLanguageServiceChanged = (languageService) => {
35601
+ if (lastLanguageService !== languageService) {
35602
+ lastLanguageService?.dispose();
35603
+ lastLanguageService = languageService;
35604
+ }
35605
+ };
35597
35606
  for (const batch of batches) {
35598
35607
  const { service: service3 } = (0, import_project_service.createProjectService)({ options: { loadTypeScriptPlugins: false } });
35599
35608
  for (const filePath of batch) {
@@ -35603,6 +35612,7 @@ var diagnostics2 = make58(
35603
35612
  if (!scriptInfo) continue;
35604
35613
  const project4 = scriptInfo.getDefaultProject();
35605
35614
  const languageService = project4.getLanguageService(true);
35615
+ disposeIfLanguageServiceChanged(languageService);
35606
35616
  const program = languageService.getProgram();
35607
35617
  if (!program) continue;
35608
35618
  const sourceFile = program.getSourceFile(filePath);
@@ -35619,7 +35629,7 @@ var diagnostics2 = make58(
35619
35629
  provideService7(TypeScriptApi, tsInstance),
35620
35630
  provideService7(
35621
35631
  LanguageServicePluginOptions,
35622
- parse4(pluginConfig)
35632
+ { ...parse4(pluginConfig), diagnosticsName: false }
35623
35633
  ),
35624
35634
  run9,
35625
35635
  map((_) => _.diagnostics),
@@ -35635,11 +35645,14 @@ var diagnostics2 = make58(
35635
35645
  warningsCount += results.filter((_) => _.category === tsInstance.DiagnosticCategory.Warning).length;
35636
35646
  messagesCount += results.filter((_) => _.category === tsInstance.DiagnosticCategory.Message).length;
35637
35647
  if (results.length > 0) {
35638
- const formattedResults = tsInstance.formatDiagnosticsWithColorAndContext(results, {
35648
+ let formattedResults = tsInstance.formatDiagnosticsWithColorAndContext(results, {
35639
35649
  getCanonicalFileName: (fileName) => path2.resolve(fileName),
35640
35650
  getCurrentDirectory: () => path2.resolve("."),
35641
35651
  getNewLine: () => "\n"
35642
35652
  });
35653
+ Object.values(diagnostics).forEach(
35654
+ (_) => formattedResults = formattedResults.replace(new RegExp(`TS${_.code}:`, "g"), `effect(${_.name}):`)
35655
+ );
35643
35656
  console.log(formattedResults);
35644
35657
  }
35645
35658
  } finally {
@@ -35648,6 +35661,7 @@ var diagnostics2 = make58(
35648
35661
  }
35649
35662
  yield* yieldNow4();
35650
35663
  }
35664
+ disposeIfLanguageServiceChanged(void 0);
35651
35665
  console.log(
35652
35666
  `Checked ${checkedFilesCount} files out of ${filesToCheck.size} files.
35653
35667
  ${errorsCount} errors, ${warningsCount} warnings and ${messagesCount} messages.`