File tree Expand file tree Collapse file tree 2 files changed +22
-20
lines changed
src/tools/rust-analyzer/editors/code Expand file tree Collapse file tree 2 files changed +22
-20
lines changed Original file line number Diff line number Diff line change @@ -154,21 +154,16 @@ function orderFromPath(
154154 raVersionResolver : ( path : string ) => string | undefined ,
155155) : string {
156156 const capture = path . match ( / ^ .* \/ t o o l c h a i n s \/ ( .* ) \/ b i n \/ r u s t - a n a l y z e r $ / ) ;
157-
158157 if ( capture ?. length === 2 ) {
159158 const toolchain = capture [ 1 ] ! ;
160- if ( toolchain . startsWith ( "stable-" ) ) {
161- return "1" ;
159+ // It is a semver, so we must resolve Rust Analyzer's version.
160+ const raVersion = raVersionResolver ( path ) ;
161+ const raDate = raVersion ?. match ( / ^ r u s t - a n a l y z e r .* \( .* ( \d { 4 } - \d { 2 } - \d { 2 } ) \) $ / ) ;
162+ if ( raDate ?. length === 2 ) {
163+ const precedence = toolchain . startsWith ( "nightly-" ) ? "/0" : "/1" ;
164+ return "0-" + raDate [ 1 ] + precedence ;
162165 } else {
163- // It is a semver, so we must resolve Rust Analyzer's version.
164- const raVersion = raVersionResolver ( path ) ;
165- const raDate = raVersion ?. match ( / ^ r u s t - a n a l y z e r .* \( .* ( \d { 4 } - \d { 2 } - \d { 2 } ) \) $ / ) ;
166- if ( raDate ?. length === 2 ) {
167- const precedence = toolchain . startsWith ( "nightly-" ) ? "/0" : "/1" ;
168- return "0-" + raDate [ 1 ] + precedence ;
169- } else {
170- return "2" ;
171- }
166+ return "2" ;
172167 }
173168 } else {
174169 return "2" ;
Original file line number Diff line number Diff line change @@ -52,11 +52,15 @@ export async function getTests(ctx: Context) {
5252 assert . deepStrictEqual (
5353 _private . orderFromPath (
5454 "/Users/myuser/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rust-analyzer" ,
55- function ( ) {
56- assert . fail ( "Shouldn't get here." ) ;
55+ function ( path : string ) {
56+ assert . deepStrictEqual (
57+ path ,
58+ "/Users/myuser/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rust-analyzer" ,
59+ ) ;
60+ return "rust-analyzer 1.79.0 (129f3b99 2024-06-10)" ;
5761 } ,
5862 ) ,
59- "1" ,
63+ "0-2024-06-10/ 1" ,
6064 ) ;
6165 } ) ;
6266
@@ -75,11 +79,14 @@ export async function getTests(ctx: Context) {
7579 "/Users/myuser/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rust-analyzer" ,
7680 "/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer" ,
7781 function ( path : string ) {
78- assert . deepStrictEqual (
79- path ,
80- "/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer" ,
81- ) ;
82- return "rust-analyzer 1.67.0-nightly (b7bc90fe 2022-11-21)" ;
82+ if (
83+ path ===
84+ "/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer"
85+ ) {
86+ return "rust-analyzer 1.67.0-nightly (b7bc90fe 2022-11-21)" ;
87+ } else {
88+ return "rust-analyzer 1.79.0 (129f3b99 2024-06-10)" ;
89+ }
8390 } ,
8491 ) ,
8592 "/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer" ,
You can’t perform that action at this time.
0 commit comments