mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Further simplifications
This commit is contained in:
parent
b05def0f4c
commit
26691a1165
2 changed files with 10 additions and 16 deletions
|
@ -153,18 +153,12 @@ function orderFromPath(
|
|||
path: string,
|
||||
raVersionResolver: (path: string) => string | undefined,
|
||||
): string {
|
||||
const capture = path.match(/^.*\/toolchains\/(.*)\/bin\/rust-analyzer$/);
|
||||
if (capture?.length === 2) {
|
||||
const toolchain = capture[1]!;
|
||||
// It is a semver, so we must resolve Rust Analyzer's version.
|
||||
const raVersion = raVersionResolver(path);
|
||||
const raDate = raVersion?.match(/^rust-analyzer .*\(.* (\d{4}-\d{2}-\d{2})\)$/);
|
||||
if (raDate?.length === 2) {
|
||||
const precedence = toolchain.startsWith("nightly-") ? "/0" : "/1";
|
||||
return "0-" + raDate[1] + precedence;
|
||||
} else {
|
||||
return "2";
|
||||
}
|
||||
// It is a semver, so we must resolve Rust Analyzer's version.
|
||||
const raVersion = raVersionResolver(path);
|
||||
const raDate = raVersion?.match(/^rust-analyzer .*\(.* (\d{4}-\d{2}-\d{2})\)$/);
|
||||
if (raDate?.length === 2) {
|
||||
const precedence = path.includes("nightly-") ? "0" : "1";
|
||||
return precedence + "-" + raDate[1];
|
||||
} else {
|
||||
return "2";
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ export async function getTests(ctx: Context) {
|
|||
return "rust-analyzer 1.67.0-nightly (b7bc90fe 2022-11-21)";
|
||||
},
|
||||
),
|
||||
"0-2022-11-21/0",
|
||||
"0-2022-11-21",
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -32,7 +32,7 @@ export async function getTests(ctx: Context) {
|
|||
return "rust-analyzer 1.72.1 (d5c2e9c3 2023-09-13)";
|
||||
},
|
||||
),
|
||||
"0-2023-09-13/1",
|
||||
"1-2023-09-13",
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -60,14 +60,14 @@ export async function getTests(ctx: Context) {
|
|||
return "rust-analyzer 1.79.0 (129f3b99 2024-06-10)";
|
||||
},
|
||||
),
|
||||
"0-2024-06-10/1",
|
||||
"1-2024-06-10",
|
||||
);
|
||||
});
|
||||
|
||||
suite.addTest("Order with invalid path to RA", async () => {
|
||||
assert.deepStrictEqual(
|
||||
_private.orderFromPath("some-weird-path", function () {
|
||||
assert.fail("Shouldn't get here.");
|
||||
return undefined;
|
||||
}),
|
||||
"2",
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue