@effect/language-service 0.50.0 → 0.51.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 +3 -0
- package/cli.js +52 -2
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +53 -2
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +52 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +53 -2
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -7076,7 +7076,12 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
7076
7076
|
"pipe"
|
|
7077
7077
|
),
|
|
7078
7078
|
void 0,
|
|
7079
|
-
|
|
7079
|
+
pipe(
|
|
7080
|
+
parentChain,
|
|
7081
|
+
filter(ts.isCallExpression),
|
|
7082
|
+
map4((call) => call.expression),
|
|
7083
|
+
reverse
|
|
7084
|
+
)
|
|
7080
7085
|
)
|
|
7081
7086
|
);
|
|
7082
7087
|
})
|
|
@@ -8077,6 +8082,50 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
8077
8082
|
})
|
|
8078
8083
|
});
|
|
8079
8084
|
|
|
8085
|
+
// src/diagnostics/strictEffectProvide.ts
|
|
8086
|
+
var strictEffectProvide = createDiagnostic({
|
|
8087
|
+
name: "strictEffectProvide",
|
|
8088
|
+
code: 27,
|
|
8089
|
+
severity: "off",
|
|
8090
|
+
apply: fn("strictEffectProvide.apply")(function* (sourceFile, report) {
|
|
8091
|
+
const ts = yield* service(TypeScriptApi);
|
|
8092
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
8093
|
+
const typeParser = yield* service(TypeParser);
|
|
8094
|
+
const parseEffectProvideWithLayer = (node) => gen(function* () {
|
|
8095
|
+
if (!ts.isCallExpression(node) || !ts.isPropertyAccessExpression(node.expression) || !ts.isIdentifier(node.expression.name) || ts.idText(node.expression.name) !== "provide" || node.arguments.length === 0) {
|
|
8096
|
+
return yield* typeParserIssue("Not an Effect.provide call");
|
|
8097
|
+
}
|
|
8098
|
+
yield* typeParser.importedEffectModule(node.expression.expression);
|
|
8099
|
+
return yield* firstSuccessOf(
|
|
8100
|
+
node.arguments.map((arg) => {
|
|
8101
|
+
const argType = typeChecker.getTypeAtLocation(arg);
|
|
8102
|
+
return typeParser.layerType(argType, arg);
|
|
8103
|
+
})
|
|
8104
|
+
);
|
|
8105
|
+
});
|
|
8106
|
+
const nodeToVisit = [];
|
|
8107
|
+
const appendNodeToVisit = (node) => {
|
|
8108
|
+
nodeToVisit.push(node);
|
|
8109
|
+
return void 0;
|
|
8110
|
+
};
|
|
8111
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
8112
|
+
while (nodeToVisit.length > 0) {
|
|
8113
|
+
const node = nodeToVisit.shift();
|
|
8114
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
8115
|
+
if (ts.isCallExpression(node)) {
|
|
8116
|
+
const layerCheck = yield* pipe(parseEffectProvideWithLayer(node), option);
|
|
8117
|
+
if (isSome2(layerCheck)) {
|
|
8118
|
+
report({
|
|
8119
|
+
location: node,
|
|
8120
|
+
messageText: "Effect.provide with a Layer should only be used at application entry points. If this is an entry point, you can safely disable this diagnostic. Otherwise, using Effect.provide may break scope lifetimes. Compose all layers at your entry point and provide them at once.",
|
|
8121
|
+
fixes: []
|
|
8122
|
+
});
|
|
8123
|
+
}
|
|
8124
|
+
}
|
|
8125
|
+
}
|
|
8126
|
+
})
|
|
8127
|
+
});
|
|
8128
|
+
|
|
8080
8129
|
// src/diagnostics/tryCatchInEffectGen.ts
|
|
8081
8130
|
var tryCatchInEffectGen = createDiagnostic({
|
|
8082
8131
|
name: "tryCatchInEffectGen",
|
|
@@ -8367,7 +8416,8 @@ var diagnostics = [
|
|
|
8367
8416
|
unsupportedServiceAccessors,
|
|
8368
8417
|
nonObjectEffectServiceType,
|
|
8369
8418
|
deterministicKeys,
|
|
8370
|
-
missedPipeableOpportunity
|
|
8419
|
+
missedPipeableOpportunity,
|
|
8420
|
+
strictEffectProvide
|
|
8371
8421
|
];
|
|
8372
8422
|
|
|
8373
8423
|
// src/completions/effectDiagnosticsComment.ts
|