@effect/language-service 0.74.0 → 0.75.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 +1 -1
- package/cli.js +1 -1
- package/cli.js.map +1 -1
- package/index.js +69 -24
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12306,23 +12306,38 @@ var effectSchemaSelfInClasses = createCompletion({
|
|
|
12306
12306
|
});
|
|
12307
12307
|
}
|
|
12308
12308
|
}
|
|
12309
|
-
if (typeParser.supportedEffect() === "
|
|
12310
|
-
const
|
|
12309
|
+
if (typeParser.supportedEffect() === "v4") {
|
|
12310
|
+
const hasTaggedErrorCompletion = isFullyQualified || isSome2(
|
|
12311
12311
|
yield* pipe(
|
|
12312
|
-
typeParser.isNodeReferenceToEffectSchemaModuleApi("
|
|
12312
|
+
typeParser.isNodeReferenceToEffectSchemaModuleApi("TaggedErrorClass")(accessedObject),
|
|
12313
12313
|
option
|
|
12314
12314
|
)
|
|
12315
12315
|
);
|
|
12316
|
-
if (
|
|
12316
|
+
if (hasTaggedErrorCompletion) {
|
|
12317
12317
|
completions2.push({
|
|
12318
|
-
name: `
|
|
12318
|
+
name: `TaggedError<${name}>`,
|
|
12319
12319
|
kind: ts.ScriptElementKind.constElement,
|
|
12320
|
-
insertText: isFullyQualified ? `${schemaIdentifier}.
|
|
12320
|
+
insertText: isFullyQualified ? `${schemaIdentifier}.TaggedErrorClass<${name}>()("${errorTagKey}", {${"${0}"}}){}` : `TaggedErrorClass<${name}>()("${errorTagKey}", {${"${0}"}}){}`,
|
|
12321
12321
|
replacementSpan,
|
|
12322
12322
|
isSnippet: true
|
|
12323
12323
|
});
|
|
12324
12324
|
}
|
|
12325
12325
|
}
|
|
12326
|
+
const hasTaggedClassCompletion = isFullyQualified || isSome2(
|
|
12327
|
+
yield* pipe(
|
|
12328
|
+
typeParser.isNodeReferenceToEffectSchemaModuleApi("TaggedClass")(accessedObject),
|
|
12329
|
+
option
|
|
12330
|
+
)
|
|
12331
|
+
);
|
|
12332
|
+
if (hasTaggedClassCompletion) {
|
|
12333
|
+
completions2.push({
|
|
12334
|
+
name: `TaggedClass<${name}>`,
|
|
12335
|
+
kind: ts.ScriptElementKind.constElement,
|
|
12336
|
+
insertText: isFullyQualified ? `${schemaIdentifier}.TaggedClass<${name}>()("${name}", {${"${0}"}}){}` : `TaggedClass<${name}>()("${name}", {${"${0}"}}){}`,
|
|
12337
|
+
replacementSpan,
|
|
12338
|
+
isSnippet: true
|
|
12339
|
+
});
|
|
12340
|
+
}
|
|
12326
12341
|
if (typeParser.supportedEffect() === "v3") {
|
|
12327
12342
|
const hasTaggedRequestCompletion = isFullyQualified || isSome2(
|
|
12328
12343
|
yield* pipe(
|
|
@@ -12351,24 +12366,7 @@ var effectSchemaSelfInClasses = createCompletion({
|
|
|
12351
12366
|
completions2.push({
|
|
12352
12367
|
name: `ErrorClass<${name}>`,
|
|
12353
12368
|
kind: ts.ScriptElementKind.constElement,
|
|
12354
|
-
insertText: isFullyQualified ? `${schemaIdentifier}.ErrorClass<${name}>()({${"${0}"}}){}` : `ErrorClass<${name}>()({${"${0}"}}){}`,
|
|
12355
|
-
replacementSpan,
|
|
12356
|
-
isSnippet: true
|
|
12357
|
-
});
|
|
12358
|
-
}
|
|
12359
|
-
}
|
|
12360
|
-
if (typeParser.supportedEffect() === "v4") {
|
|
12361
|
-
const hasRequestClassCompletion = isFullyQualified || isSome2(
|
|
12362
|
-
yield* pipe(
|
|
12363
|
-
typeParser.isNodeReferenceToEffectSchemaModuleApi("RequestClass")(accessedObject),
|
|
12364
|
-
option
|
|
12365
|
-
)
|
|
12366
|
-
);
|
|
12367
|
-
if (hasRequestClassCompletion) {
|
|
12368
|
-
completions2.push({
|
|
12369
|
-
name: `RequestClass<${name}>`,
|
|
12370
|
-
kind: ts.ScriptElementKind.constElement,
|
|
12371
|
-
insertText: isFullyQualified ? `${schemaIdentifier}.RequestClass<${name}>("${name}")({${"${0}"}}){}` : `RequestClass<${name}>("${name}")({${"${0}"}}){}`,
|
|
12369
|
+
insertText: isFullyQualified ? `${schemaIdentifier}.ErrorClass<${name}>("${name}")({${"${0}"}}){}` : `ErrorClass<${name}>()({${"${0}"}}){}`,
|
|
12372
12370
|
replacementSpan,
|
|
12373
12371
|
isSnippet: true
|
|
12374
12372
|
});
|
|
@@ -12623,8 +12621,55 @@ var schemaBrand = createCompletion({
|
|
|
12623
12621
|
})
|
|
12624
12622
|
});
|
|
12625
12623
|
|
|
12624
|
+
// src/completions/serviceMapSelfInClasses.ts
|
|
12625
|
+
var serviceMapSelfInClasses = createCompletion({
|
|
12626
|
+
name: "serviceMapSelfInClasses",
|
|
12627
|
+
apply: fn("serviceMapSelfInClasses")(function* (sourceFile, position) {
|
|
12628
|
+
const ts = yield* service(TypeScriptApi);
|
|
12629
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
12630
|
+
const typeParser = yield* service(TypeParser);
|
|
12631
|
+
if (typeParser.supportedEffect() === "v3") return [];
|
|
12632
|
+
const maybeInfos = tsUtils.parseDataForExtendsClassCompletion(sourceFile, position);
|
|
12633
|
+
if (!maybeInfos) return [];
|
|
12634
|
+
const { accessedObject, className, replacementSpan } = maybeInfos;
|
|
12635
|
+
const serviceMapIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
|
|
12636
|
+
sourceFile,
|
|
12637
|
+
"effect",
|
|
12638
|
+
"ServiceMap"
|
|
12639
|
+
) || "ServiceMap";
|
|
12640
|
+
const isFullyQualified = serviceMapIdentifier === ts.idText(accessedObject);
|
|
12641
|
+
const name = ts.idText(className);
|
|
12642
|
+
const tagKey = (yield* createString(sourceFile, name, "service")) || name;
|
|
12643
|
+
const completions2 = [];
|
|
12644
|
+
const hasServiceCompletion = isFullyQualified || isSome2(
|
|
12645
|
+
yield* pipe(
|
|
12646
|
+
typeParser.isNodeReferenceToServiceMapModuleApi("Service")(accessedObject),
|
|
12647
|
+
option
|
|
12648
|
+
)
|
|
12649
|
+
);
|
|
12650
|
+
if (hasServiceCompletion) {
|
|
12651
|
+
completions2.push({
|
|
12652
|
+
name: `Service<${name}, {}>`,
|
|
12653
|
+
kind: ts.ScriptElementKind.constElement,
|
|
12654
|
+
insertText: isFullyQualified ? `${serviceMapIdentifier}.Service<${name}, {${"${0}"}}>()("${tagKey}"){}` : `Service<${name}, {${"${0}"}}>()("${tagKey}"){}`,
|
|
12655
|
+
replacementSpan,
|
|
12656
|
+
isSnippet: true
|
|
12657
|
+
});
|
|
12658
|
+
completions2.push({
|
|
12659
|
+
name: `Service<${name}>({ make })`,
|
|
12660
|
+
kind: ts.ScriptElementKind.constElement,
|
|
12661
|
+
insertText: isFullyQualified ? `${serviceMapIdentifier}.Service<${name}>()("${tagKey}", { make: ${"${0}"} }){}` : `Service<${name}>()("${tagKey}", { make: ${"${0}"} }){}`,
|
|
12662
|
+
replacementSpan,
|
|
12663
|
+
isSnippet: true
|
|
12664
|
+
});
|
|
12665
|
+
}
|
|
12666
|
+
return completions2;
|
|
12667
|
+
})
|
|
12668
|
+
});
|
|
12669
|
+
|
|
12626
12670
|
// src/completions.ts
|
|
12627
12671
|
var completions = [
|
|
12672
|
+
serviceMapSelfInClasses,
|
|
12628
12673
|
effectSqlModelSelfInClasses,
|
|
12629
12674
|
effectSchemaSelfInClasses,
|
|
12630
12675
|
effectSelfInClasses,
|