@effect/language-service 0.43.0 → 0.43.1
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/effect-lsp-patch-utils.js +20 -18
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +20 -18
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +20 -18
- package/transform.js.map +1 -1
|
@@ -3492,31 +3492,33 @@ var makeKeyBuilder = fn("KeyBuilder")(
|
|
|
3492
3492
|
if (!packageInfo) return;
|
|
3493
3493
|
for (const keyPattern of options.keyPatterns) {
|
|
3494
3494
|
if (keyPattern.target !== kind) continue;
|
|
3495
|
-
if (keyPattern.pattern === "package-identifier") {
|
|
3496
|
-
return packageInfo.name + "/" + classNameText;
|
|
3497
|
-
}
|
|
3498
|
-
const dirPath = getDirectoryPath(ts, sourceFile.fileName);
|
|
3499
|
-
if (!dirPath.startsWith(packageInfo.packageDirectory)) return;
|
|
3500
|
-
let subDirectory = dirPath.slice(packageInfo.packageDirectory.length);
|
|
3501
|
-
if (subDirectory.startsWith("/")) subDirectory = subDirectory.slice(1);
|
|
3502
3495
|
const lastIndex = sourceFile.fileName.lastIndexOf("/");
|
|
3503
|
-
let
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
if (
|
|
3496
|
+
let onlyFileName = lastIndex === -1 ? "" : sourceFile.fileName.slice(lastIndex + 1);
|
|
3497
|
+
const lastExtensionIndex = onlyFileName.lastIndexOf(".");
|
|
3498
|
+
if (lastExtensionIndex !== -1) onlyFileName = onlyFileName.slice(0, lastExtensionIndex);
|
|
3499
|
+
if (onlyFileName.toLowerCase().endsWith("/index")) onlyFileName = onlyFileName.slice(0, -6);
|
|
3500
|
+
if (onlyFileName.startsWith("/")) onlyFileName = onlyFileName.slice(1);
|
|
3501
|
+
let subDirectory = getDirectoryPath(ts, sourceFile.fileName);
|
|
3502
|
+
if (!subDirectory.startsWith(packageInfo.packageDirectory)) continue;
|
|
3503
|
+
subDirectory = subDirectory.slice(packageInfo.packageDirectory.length);
|
|
3504
|
+
if (!subDirectory.endsWith("/")) subDirectory = subDirectory + "/";
|
|
3505
|
+
if (subDirectory.startsWith("/")) subDirectory = subDirectory.slice(1);
|
|
3512
3506
|
for (const prefix of keyPattern.skipLeadingPath) {
|
|
3513
3507
|
if (subDirectory.startsWith(prefix)) {
|
|
3514
3508
|
subDirectory = subDirectory.slice(prefix.length);
|
|
3515
3509
|
break;
|
|
3516
3510
|
}
|
|
3517
3511
|
}
|
|
3518
|
-
|
|
3519
|
-
|
|
3512
|
+
let parts = [packageInfo.name, subDirectory, onlyFileName].concat(
|
|
3513
|
+
onlyFileName.toLowerCase() === classNameText.toLowerCase() ? [] : [classNameText]
|
|
3514
|
+
);
|
|
3515
|
+
if (keyPattern.pattern === "package-identifier") {
|
|
3516
|
+
parts = [packageInfo.name, onlyFileName].concat(
|
|
3517
|
+
onlyFileName.toLowerCase() === classNameText.toLowerCase() ? [] : [classNameText]
|
|
3518
|
+
);
|
|
3519
|
+
}
|
|
3520
|
+
parts = parts.map((part) => part.startsWith("/") ? part.slice(1) : part).map(
|
|
3521
|
+
(part) => part.endsWith("/") ? part.slice(0, -1) : part
|
|
3520
3522
|
);
|
|
3521
3523
|
return parts.filter((_) => String(_).trim().length > 0).join("/");
|
|
3522
3524
|
}
|