@effect/language-service 0.43.0 → 0.43.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/cli.js +138 -130
- package/cli.js.map +1 -1
- 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
package/index.js
CHANGED
|
@@ -1812,31 +1812,33 @@ var makeKeyBuilder = fn("KeyBuilder")(
|
|
|
1812
1812
|
if (!packageInfo) return;
|
|
1813
1813
|
for (const keyPattern of options.keyPatterns) {
|
|
1814
1814
|
if (keyPattern.target !== kind) continue;
|
|
1815
|
-
if (keyPattern.pattern === "package-identifier") {
|
|
1816
|
-
return packageInfo.name + "/" + classNameText;
|
|
1817
|
-
}
|
|
1818
|
-
const dirPath = getDirectoryPath(ts, sourceFile.fileName);
|
|
1819
|
-
if (!dirPath.startsWith(packageInfo.packageDirectory)) return;
|
|
1820
|
-
let subDirectory = dirPath.slice(packageInfo.packageDirectory.length);
|
|
1821
|
-
if (subDirectory.startsWith("/")) subDirectory = subDirectory.slice(1);
|
|
1822
1815
|
const lastIndex = sourceFile.fileName.lastIndexOf("/");
|
|
1823
|
-
let
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
if (
|
|
1816
|
+
let onlyFileName = lastIndex === -1 ? "" : sourceFile.fileName.slice(lastIndex + 1);
|
|
1817
|
+
const lastExtensionIndex = onlyFileName.lastIndexOf(".");
|
|
1818
|
+
if (lastExtensionIndex !== -1) onlyFileName = onlyFileName.slice(0, lastExtensionIndex);
|
|
1819
|
+
if (onlyFileName.toLowerCase().endsWith("/index")) onlyFileName = onlyFileName.slice(0, -6);
|
|
1820
|
+
if (onlyFileName.startsWith("/")) onlyFileName = onlyFileName.slice(1);
|
|
1821
|
+
let subDirectory = getDirectoryPath(ts, sourceFile.fileName);
|
|
1822
|
+
if (!subDirectory.startsWith(packageInfo.packageDirectory)) continue;
|
|
1823
|
+
subDirectory = subDirectory.slice(packageInfo.packageDirectory.length);
|
|
1824
|
+
if (!subDirectory.endsWith("/")) subDirectory = subDirectory + "/";
|
|
1825
|
+
if (subDirectory.startsWith("/")) subDirectory = subDirectory.slice(1);
|
|
1832
1826
|
for (const prefix of keyPattern.skipLeadingPath) {
|
|
1833
1827
|
if (subDirectory.startsWith(prefix)) {
|
|
1834
1828
|
subDirectory = subDirectory.slice(prefix.length);
|
|
1835
1829
|
break;
|
|
1836
1830
|
}
|
|
1837
1831
|
}
|
|
1838
|
-
|
|
1839
|
-
|
|
1832
|
+
let parts = [packageInfo.name, subDirectory, onlyFileName].concat(
|
|
1833
|
+
onlyFileName.toLowerCase() === classNameText.toLowerCase() ? [] : [classNameText]
|
|
1834
|
+
);
|
|
1835
|
+
if (keyPattern.pattern === "package-identifier") {
|
|
1836
|
+
parts = [packageInfo.name, onlyFileName].concat(
|
|
1837
|
+
onlyFileName.toLowerCase() === classNameText.toLowerCase() ? [] : [classNameText]
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
parts = parts.map((part) => part.startsWith("/") ? part.slice(1) : part).map(
|
|
1841
|
+
(part) => part.endsWith("/") ? part.slice(0, -1) : part
|
|
1840
1842
|
);
|
|
1841
1843
|
return parts.filter((_) => String(_).trim().length > 0).join("/");
|
|
1842
1844
|
}
|