@effect/language-service 0.33.0 → 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/index.js CHANGED
@@ -5954,31 +5954,15 @@ var middlewareGenLike = fn("middlewareGenLike")(function* (sourceFile, _span, pr
5954
5954
  const tsUtils = yield* service(TypeScriptUtils);
5955
5955
  const ts = yield* service(TypeScriptApi);
5956
5956
  const typeParser = yield* service(TypeParser);
5957
- const typeChecker = yield* service(TypeCheckerApi);
5958
5957
  const result = [];
5959
5958
  const parseType = (node) => {
5960
5959
  return pipe(
5961
- map3(typeParser.effectGen(node), (_) => {
5962
- const type = typeChecker.getTypeAtLocation(_.node);
5963
- const typeString = typeChecker.typeToString(type, _.generatorFunction, ts.TypeFormatFlags.NoTruncation);
5964
- return { ..._, typeString };
5965
- }),
5966
- orElse2(
5967
- () => map3(pipe(typeParser.effectFnGen(node), orElse2(() => typeParser.effectFnUntracedGen(node))), (_) => {
5968
- const fnType = typeChecker.getTypeAtLocation(_.node);
5969
- const types = [];
5970
- for (const callSig of fnType.getCallSignatures()) {
5971
- types.push(
5972
- typeChecker.typeToString(callSig.getReturnType(), _.generatorFunction, ts.TypeFormatFlags.NoTruncation)
5973
- );
5974
- }
5975
- return { ..._, typeString: types.join(" | ") };
5976
- })
5977
- )
5960
+ typeParser.effectGen(node),
5961
+ orElse2(() => pipe(typeParser.effectFnGen(node), orElse2(() => typeParser.effectFnUntracedGen(node))))
5978
5962
  );
5979
5963
  };
5980
5964
  for (const inlayHint of inlayHints) {
5981
- let modifiedInlayHint = inlayHint;
5965
+ let shouldOmit = false;
5982
5966
  if (inlayHint.kind === ts.InlayHintKind.Type) {
5983
5967
  const node = tsUtils.findNodeAtPositionIncludingTrivia(sourceFile, inlayHint.position - 1);
5984
5968
  if (node && node.parent) {
@@ -5988,18 +5972,14 @@ var middlewareGenLike = fn("middlewareGenLike")(function* (sourceFile, _span, pr
5988
5972
  map3((_) => {
5989
5973
  const argsCloseParen = ts.findChildOfKind(_.generatorFunction, ts.SyntaxKind.CloseParenToken, sourceFile);
5990
5974
  if (argsCloseParen && _.body && inlayHint.position >= argsCloseParen.getEnd() && inlayHint.position <= _.body.getStart(sourceFile)) {
5991
- const { displayParts: _displayParts, text: _text, ...toKeep } = inlayHint;
5992
- modifiedInlayHint = {
5993
- ...toKeep,
5994
- text: ": " + _.typeString
5995
- };
5975
+ shouldOmit = true;
5996
5976
  }
5997
5977
  }),
5998
5978
  ignore
5999
5979
  );
6000
5980
  }
6001
5981
  }
6002
- result.push(modifiedInlayHint);
5982
+ if (!shouldOmit) result.push(inlayHint);
6003
5983
  }
6004
5984
  return result;
6005
5985
  });