@effect/language-service 0.72.1 → 0.73.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/README.md +10 -0
- package/cli.js +20 -8
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +19 -7
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +139 -77
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +19 -7
- package/transform.js.map +1 -1
|
@@ -1967,7 +1967,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1967
1967
|
const lineOverrides = {};
|
|
1968
1968
|
const sectionOverrides = {};
|
|
1969
1969
|
const skippedRules = [];
|
|
1970
|
-
const regex = /@effect-diagnostics(-next-line)?((?:\s[a-zA-Z0-9/]
|
|
1970
|
+
const regex = /@effect-diagnostics(-next-line)?((?:\s(?:[a-zA-Z0-9/]+|\*):(?:off|warning|error|message|suggestion|skip-file))+)?/gm;
|
|
1971
1971
|
let match2;
|
|
1972
1972
|
while ((match2 = regex.exec(sourceFile.text)) !== null) {
|
|
1973
1973
|
const nextLineCaptureGroup = match2[1];
|
|
@@ -2016,8 +2016,10 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
2016
2016
|
const codeFixes = [];
|
|
2017
2017
|
const ruleNameLowered = rule.name.toLowerCase();
|
|
2018
2018
|
const defaultLevel = pluginOptions.diagnosticSeverity[ruleNameLowered] || rule.severity;
|
|
2019
|
-
if (skippedRules.indexOf(ruleNameLowered) > -1
|
|
2020
|
-
|
|
2019
|
+
if (skippedRules.indexOf(ruleNameLowered) > -1 || skippedRules.indexOf("*") > -1) {
|
|
2020
|
+
return { diagnostics: diagnostics2, codeFixes };
|
|
2021
|
+
}
|
|
2022
|
+
if (defaultLevel === "off" && (lineOverrides[ruleNameLowered] || sectionOverrides[ruleNameLowered] || lineOverrides["*"] || sectionOverrides["*"] || []).length === 0) {
|
|
2021
2023
|
return { diagnostics: diagnostics2, codeFixes };
|
|
2022
2024
|
}
|
|
2023
2025
|
const fixByDisableNextLine = (node) => ({
|
|
@@ -2066,14 +2068,22 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
2066
2068
|
const unusedLineOverrides = new Set(lineOverrides[ruleNameLowered] || []);
|
|
2067
2069
|
for (const emitted of applicableDiagnostics.slice(0)) {
|
|
2068
2070
|
let newLevel = defaultLevel;
|
|
2069
|
-
const
|
|
2071
|
+
const specificLineOverride = (lineOverrides[ruleNameLowered] || []).find(
|
|
2070
2072
|
(_) => _.pos < emitted.range.pos && _.end >= emitted.range.end
|
|
2071
2073
|
);
|
|
2074
|
+
const wildcardLineOverride = (lineOverrides["*"] || []).find(
|
|
2075
|
+
(_) => _.pos < emitted.range.pos && _.end >= emitted.range.end
|
|
2076
|
+
);
|
|
2077
|
+
const lineOverride = specificLineOverride && wildcardLineOverride ? specificLineOverride.pos >= wildcardLineOverride.pos ? specificLineOverride : wildcardLineOverride : specificLineOverride || wildcardLineOverride;
|
|
2072
2078
|
if (lineOverride) {
|
|
2073
2079
|
newLevel = lineOverride.level;
|
|
2074
2080
|
unusedLineOverrides.delete(lineOverride);
|
|
2075
2081
|
} else {
|
|
2076
|
-
const
|
|
2082
|
+
const specificSectionOverride = (sectionOverrides[ruleNameLowered] || []).find(
|
|
2083
|
+
(_) => _.pos < emitted.range.pos
|
|
2084
|
+
);
|
|
2085
|
+
const wildcardSectionOverride = (sectionOverrides["*"] || []).find((_) => _.pos < emitted.range.pos);
|
|
2086
|
+
const sectionOverride = specificSectionOverride && wildcardSectionOverride ? specificSectionOverride.pos >= wildcardSectionOverride.pos ? specificSectionOverride : wildcardSectionOverride : specificSectionOverride || wildcardSectionOverride;
|
|
2077
2087
|
if (sectionOverride) newLevel = sectionOverride.level;
|
|
2078
2088
|
}
|
|
2079
2089
|
if (!(newLevel in levelToDiagnosticCategory)) continue;
|
|
@@ -2602,7 +2612,9 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
2602
2612
|
const sourceFile = program.getSourceFile(fileName);
|
|
2603
2613
|
if (!sourceFile) continue;
|
|
2604
2614
|
const resolvedPackages = getEffectRelatedPackages(sourceFile);
|
|
2605
|
-
|
|
2615
|
+
const effectPkgs = resolvedPackages["effect"];
|
|
2616
|
+
if (!effectPkgs) continue;
|
|
2617
|
+
for (const version of Object.keys(effectPkgs)) {
|
|
2606
2618
|
if (String(version).startsWith("4")) return "v4";
|
|
2607
2619
|
if (String(version).startsWith("3")) return "v3";
|
|
2608
2620
|
}
|
|
@@ -3009,7 +3021,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
3009
3021
|
fn("TypeParser.isEffectDataSourceFile")(function* (sourceFile) {
|
|
3010
3022
|
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
3011
3023
|
if (!moduleSymbol) return yield* typeParserIssue("Node has no symbol", void 0, sourceFile);
|
|
3012
|
-
const taggedEnumSymbol = typeChecker.tryGetMemberInModuleExports("TaggedEnum", moduleSymbol);
|
|
3024
|
+
const taggedEnumSymbol = typeChecker.tryGetMemberInModuleExports("TaggedEnum", moduleSymbol) || typeChecker.tryGetMemberInModuleExports("taggedEnum", moduleSymbol);
|
|
3013
3025
|
if (!taggedEnumSymbol) return yield* typeParserIssue("TaggedEnum not found", void 0, sourceFile);
|
|
3014
3026
|
const taggedErrorSymbol = typeChecker.tryGetMemberInModuleExports("TaggedError", moduleSymbol);
|
|
3015
3027
|
if (!taggedErrorSymbol) return yield* typeParserIssue("TaggedError not found", void 0, sourceFile);
|