@effect/language-service 0.55.3 → 0.55.5
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 +12 -8
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +12 -8
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +30 -11
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +12 -8
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -2722,6 +2722,7 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2722
2722
|
const getSourceFilesDeclaringSymbolModule = (packageName) => cachedBy(
|
|
2723
2723
|
fn("TypeParser.getSourceFilesDeclaringSymbolModule")(function* (symbol3) {
|
|
2724
2724
|
const result = [];
|
|
2725
|
+
if (!symbol3) return result;
|
|
2725
2726
|
if (!symbol3.declarations) return yield* typeParserIssue("Symbol has no declarations", void 0, void 0);
|
|
2726
2727
|
for (const sourceFile of symbol3.declarations) {
|
|
2727
2728
|
if (!ts.isSourceFile(sourceFile)) continue;
|
|
@@ -2759,6 +2760,7 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2759
2760
|
const getSourceFilesDeclaringSymbolExportedUnderPackageModule = (packageName, memberName) => cachedBy(
|
|
2760
2761
|
fn("TypeParser.getSourceFilesDeclaringSymbolUnderPackageExportedMember")(function* (symbol3) {
|
|
2761
2762
|
const result = [];
|
|
2763
|
+
if (!symbol3) return result;
|
|
2762
2764
|
if (!symbol3.declarations) return yield* typeParserIssue("Symbol has no declarations", void 0, void 0);
|
|
2763
2765
|
for (const declaration of symbol3.declarations) {
|
|
2764
2766
|
const sourceFile = tsUtils.getSourceFileOfNode(declaration);
|
|
@@ -2980,14 +2982,14 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2980
2982
|
);
|
|
2981
2983
|
const importedContextModule = cachedBy(
|
|
2982
2984
|
fn("TypeParser.importedContextModule")(function* (node) {
|
|
2985
|
+
if (!ts.isIdentifier(node)) {
|
|
2986
|
+
return yield* typeParserIssue("Node is not an identifier", void 0, node);
|
|
2987
|
+
}
|
|
2983
2988
|
const type = typeChecker.getTypeAtLocation(node);
|
|
2984
2989
|
const propertySymbol = typeChecker.getPropertyOfType(type, "Tag");
|
|
2985
2990
|
if (!propertySymbol) {
|
|
2986
2991
|
return yield* typeParserIssue("Type has no 'Tag' property", type, node);
|
|
2987
2992
|
}
|
|
2988
|
-
if (!ts.isIdentifier(node)) {
|
|
2989
|
-
return yield* typeParserIssue("Node is not an identifier", type, node);
|
|
2990
|
-
}
|
|
2991
2993
|
const sourceFile = tsUtils.getSourceFileOfNode(node);
|
|
2992
2994
|
if (!sourceFile) {
|
|
2993
2995
|
return yield* typeParserIssue("Node is not in a source file", void 0, node);
|
|
@@ -3014,14 +3016,14 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3014
3016
|
);
|
|
3015
3017
|
const importedDataModule = cachedBy(
|
|
3016
3018
|
fn("TypeParser.importedDataModule")(function* (node) {
|
|
3019
|
+
if (!ts.isIdentifier(node)) {
|
|
3020
|
+
return yield* typeParserIssue("Node is not an expression", void 0, node);
|
|
3021
|
+
}
|
|
3017
3022
|
const type = typeChecker.getTypeAtLocation(node);
|
|
3018
3023
|
const propertySymbol = typeChecker.getPropertyOfType(type, "TaggedError");
|
|
3019
3024
|
if (!propertySymbol) {
|
|
3020
3025
|
return yield* typeParserIssue("Type has no 'TaggedError' property", type, node);
|
|
3021
3026
|
}
|
|
3022
|
-
if (!ts.isIdentifier(node)) {
|
|
3023
|
-
return yield* typeParserIssue("Node is not an expression", type, node);
|
|
3024
|
-
}
|
|
3025
3027
|
const sourceFile = tsUtils.getSourceFileOfNode(node);
|
|
3026
3028
|
if (!sourceFile) {
|
|
3027
3029
|
return yield* typeParserIssue("Node is not in a source file", void 0, node);
|
|
@@ -6342,6 +6344,19 @@ var removeEdgeInternal = (mutable, edgeIndex) => {
|
|
|
6342
6344
|
mutable.edges.delete(edgeIndex);
|
|
6343
6345
|
return true;
|
|
6344
6346
|
};
|
|
6347
|
+
var hasEdge = (graph, source, target) => {
|
|
6348
|
+
const adjacencyList = graph.adjacency.get(source);
|
|
6349
|
+
if (adjacencyList === void 0) {
|
|
6350
|
+
return false;
|
|
6351
|
+
}
|
|
6352
|
+
for (const edgeIndex of adjacencyList) {
|
|
6353
|
+
const edge = graph.edges.get(edgeIndex);
|
|
6354
|
+
if (edge !== void 0 && edge.target === target) {
|
|
6355
|
+
return true;
|
|
6356
|
+
}
|
|
6357
|
+
}
|
|
6358
|
+
return false;
|
|
6359
|
+
};
|
|
6345
6360
|
var neighborsDirected = (graph, nodeIndex, direction) => {
|
|
6346
6361
|
const adjacencyMap = direction === "incoming" ? graph.reverseAdjacency : graph.adjacency;
|
|
6347
6362
|
const adjacencyList = adjacencyMap.get(nodeIndex);
|
|
@@ -7216,9 +7231,10 @@ var leakingRequirements = createDiagnostic({
|
|
|
7216
7231
|
(type) => {
|
|
7217
7232
|
let symbol3 = type.symbol;
|
|
7218
7233
|
if (symbol3 && symbol3.flags & ts.SymbolFlags.Alias) {
|
|
7219
|
-
symbol3 = typeChecker.getAliasedSymbol(symbol3);
|
|
7234
|
+
symbol3 = typeChecker.getAliasedSymbol(symbol3) || symbol3;
|
|
7220
7235
|
}
|
|
7221
|
-
|
|
7236
|
+
if (!symbol3) return false;
|
|
7237
|
+
return !(symbol3?.declarations || []).some((declaration) => {
|
|
7222
7238
|
const declarationSource = tsUtils.getSourceFileOfNode(declaration);
|
|
7223
7239
|
if (!declarationSource) return false;
|
|
7224
7240
|
return declarationSource.text.substring(declaration.pos, declaration.end).toLowerCase().indexOf(
|
|
@@ -8481,6 +8497,7 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
8481
8497
|
for (const nodeToCheck of nodes2) {
|
|
8482
8498
|
if (!nodeToCheck) continue;
|
|
8483
8499
|
if (!conditionChecks.has(nodeToCheck.parent)) continue;
|
|
8500
|
+
if (!ts.isExpression(nodeToCheck)) continue;
|
|
8484
8501
|
const nodeType = typeChecker.getTypeAtLocation(nodeToCheck);
|
|
8485
8502
|
const constrainedType = typeChecker.getBaseConstraintOfType(nodeType);
|
|
8486
8503
|
let typesToCheck = [constrainedType || nodeType];
|
|
@@ -14393,7 +14410,7 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
|
|
|
14393
14410
|
}
|
|
14394
14411
|
}
|
|
14395
14412
|
}
|
|
14396
|
-
} else {
|
|
14413
|
+
} else if (ts.isExpression(node2)) {
|
|
14397
14414
|
layerType = typeChecker.getTypeAtLocation(node2);
|
|
14398
14415
|
}
|
|
14399
14416
|
if (layerType) {
|
|
@@ -14505,7 +14522,7 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
|
|
|
14505
14522
|
let symbol3 = typeChecker.getSymbolAtLocation(node2);
|
|
14506
14523
|
if (symbol3) {
|
|
14507
14524
|
if (symbol3.flags & ts.SymbolFlags.Alias) {
|
|
14508
|
-
symbol3 = typeChecker.getAliasedSymbol(symbol3);
|
|
14525
|
+
symbol3 = typeChecker.getAliasedSymbol(symbol3) || symbol3;
|
|
14509
14526
|
}
|
|
14510
14527
|
if (symbol3.declarations && symbol3.declarations.length === 1) {
|
|
14511
14528
|
const declarationNode = getAdjustedNode2(symbol3.declarations[0]);
|
|
@@ -14668,7 +14685,9 @@ var extractOutlineGraph = fn("extractOutlineGraph")(function* (layerGraph) {
|
|
|
14668
14685
|
for (const [providedType, providerNodeIndexes] of providers.entries()) {
|
|
14669
14686
|
if (requiredType === providedType || typeChecker.isTypeAssignableTo(requiredType, providedType)) {
|
|
14670
14687
|
for (const providerNodeIndex of providerNodeIndexes) {
|
|
14671
|
-
|
|
14688
|
+
if (!hasEdge(mutableGraph, nodeIndex, providerNodeIndex)) {
|
|
14689
|
+
addEdge(mutableGraph, nodeIndex, providerNodeIndex, {});
|
|
14690
|
+
}
|
|
14672
14691
|
}
|
|
14673
14692
|
}
|
|
14674
14693
|
}
|