mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Checks date for any RA
This commit is contained in:
parent
ec7451cc8d
commit
b05def0f4c
2 changed files with 22 additions and 20 deletions
|
@ -154,21 +154,16 @@ function orderFromPath(
|
||||||
raVersionResolver: (path: string) => string | undefined,
|
raVersionResolver: (path: string) => string | undefined,
|
||||||
): string {
|
): string {
|
||||||
const capture = path.match(/^.*\/toolchains\/(.*)\/bin\/rust-analyzer$/);
|
const capture = path.match(/^.*\/toolchains\/(.*)\/bin\/rust-analyzer$/);
|
||||||
|
|
||||||
if (capture?.length === 2) {
|
if (capture?.length === 2) {
|
||||||
const toolchain = capture[1]!;
|
const toolchain = capture[1]!;
|
||||||
if (toolchain.startsWith("stable-")) {
|
// It is a semver, so we must resolve Rust Analyzer's version.
|
||||||
return "1";
|
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 {
|
} else {
|
||||||
// It is a semver, so we must resolve Rust Analyzer's version.
|
return "2";
|
||||||
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";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return "2";
|
return "2";
|
||||||
|
|
|
@ -52,11 +52,15 @@ export async function getTests(ctx: Context) {
|
||||||
assert.deepStrictEqual(
|
assert.deepStrictEqual(
|
||||||
_private.orderFromPath(
|
_private.orderFromPath(
|
||||||
"/Users/myuser/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rust-analyzer",
|
"/Users/myuser/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rust-analyzer",
|
||||||
function () {
|
function (path: string) {
|
||||||
assert.fail("Shouldn't get here.");
|
assert.deepStrictEqual(
|
||||||
|
path,
|
||||||
|
"/Users/myuser/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rust-analyzer",
|
||||||
|
);
|
||||||
|
return "rust-analyzer 1.79.0 (129f3b99 2024-06-10)";
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
"1",
|
"0-2024-06-10/1",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -75,11 +79,14 @@ export async function getTests(ctx: Context) {
|
||||||
"/Users/myuser/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rust-analyzer",
|
"/Users/myuser/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rust-analyzer",
|
||||||
"/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer",
|
"/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer",
|
||||||
function (path: string) {
|
function (path: string) {
|
||||||
assert.deepStrictEqual(
|
if (
|
||||||
path,
|
path ===
|
||||||
"/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer",
|
"/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer"
|
||||||
);
|
) {
|
||||||
return "rust-analyzer 1.67.0-nightly (b7bc90fe 2022-11-21)";
|
return "rust-analyzer 1.67.0-nightly (b7bc90fe 2022-11-21)";
|
||||||
|
} else {
|
||||||
|
return "rust-analyzer 1.79.0 (129f3b99 2024-06-10)";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
"/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer",
|
"/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue