@effect/language-service 0.33.1 → 0.33.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.
package/README.md CHANGED
@@ -137,8 +137,9 @@ Your `tsconfig.json` should look like this:
137
137
  To get diagnostics you need to install `ts-patch` which will make it possible to run `tspc`.
138
138
 
139
139
  Running `tspc` in your project will now also run the plugin and give you the error diagnostics at compile time.
140
- Effect error diagnostics will be shown only after standard TypeScript diagnostics have been satisfied.
141
- Beware that setting noEmit will completely skip the effect diagnostics.
140
+ Effect diagnostics in watch mode with noEmit enabled are not supported by ts-patch unfortunately.
141
+
142
+ If you use incremental builds, after enabling ts-patch, a full rebuild may be necessary to invalidate the previous diagnostics cache.
142
143
 
143
144
  ```ts
144
145
  $ npx tspc
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/language-service",
3
- "version": "0.33.1",
3
+ "version": "0.33.2",
4
4
  "description": "A Language-Service Plugin to Refactor and Diagnostic effect-ts projects",
5
5
  "main": "index.cjs",
6
6
  "bin": {
package/transform.js CHANGED
@@ -4830,32 +4830,43 @@ var diagnostics = [
4830
4830
  ];
4831
4831
 
4832
4832
  // src/transform.ts
4833
+ var programsChecked = /* @__PURE__ */ new WeakMap();
4833
4834
  function transform_default(program, pluginConfig, { addDiagnostic, ts: tsInstance }) {
4834
- return (_) => {
4835
- return (sourceFile) => {
4836
- pipe(
4837
- getSemanticDiagnosticsWithCodeFixes(diagnostics, sourceFile),
4838
- nanoLayer2,
4839
- nanoLayer,
4840
- provideService(TypeCheckerApi, program.getTypeChecker()),
4841
- provideService(TypeScriptProgram, program),
4842
- provideService(TypeScriptApi, tsInstance),
4843
- provideService(
4844
- LanguageServicePluginOptions,
4845
- parse(pluginConfig)
4846
- ),
4847
- run,
4848
- map((_2) => _2.diagnostics),
4849
- map(
4850
- filter(
4851
- (_2) => _2.category === tsInstance.DiagnosticCategory.Error || _2.category === tsInstance.DiagnosticCategory.Warning
4852
- )
4853
- ),
4854
- getOrElse(() => []),
4855
- map2(addDiagnostic)
4856
- );
4857
- return sourceFile;
4858
- };
4835
+ function runDiagnostics(program2, sourceFile) {
4836
+ const checkedFiles = programsChecked.get(program2) ?? /* @__PURE__ */ new Set();
4837
+ programsChecked.set(program2, checkedFiles);
4838
+ if (checkedFiles.has(sourceFile.fileName)) return;
4839
+ checkedFiles.add(sourceFile.fileName);
4840
+ pipe(
4841
+ getSemanticDiagnosticsWithCodeFixes(diagnostics, sourceFile),
4842
+ nanoLayer2,
4843
+ nanoLayer,
4844
+ provideService(TypeCheckerApi, program2.getTypeChecker()),
4845
+ provideService(TypeScriptProgram, program2),
4846
+ provideService(TypeScriptApi, tsInstance),
4847
+ provideService(
4848
+ LanguageServicePluginOptions,
4849
+ parse(pluginConfig)
4850
+ ),
4851
+ run,
4852
+ map((_) => _.diagnostics),
4853
+ map(
4854
+ filter(
4855
+ (_) => _.category === tsInstance.DiagnosticCategory.Error || _.category === tsInstance.DiagnosticCategory.Warning
4856
+ )
4857
+ ),
4858
+ getOrElse(() => []),
4859
+ map2(addDiagnostic)
4860
+ );
4861
+ }
4862
+ const rootFileNames = program.getRootFileNames();
4863
+ const sourceFiles = program.getSourceFiles().filter((_) => rootFileNames.indexOf(_.fileName) > -1);
4864
+ for (const sourceFile of sourceFiles) {
4865
+ runDiagnostics(program, sourceFile);
4866
+ }
4867
+ return (_) => (sourceFile) => {
4868
+ runDiagnostics(program, sourceFile);
4869
+ return sourceFile;
4859
4870
  };
4860
4871
  }
4861
4872
  //# sourceMappingURL=transform.js.map