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(
154
154
raVersionResolver : ( path : string ) => string | undefined ,
155
155
) : string {
156
156
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
-
158
157
if ( capture ?. length === 2 ) {
159
158
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 ;
162
165
} 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" ;
172
167
}
173
168
} else {
174
169
return "2" ;
Original file line number Diff line number Diff line change @@ -52,11 +52,15 @@ export async function getTests(ctx: Context) {
52
52
assert . deepStrictEqual (
53
53
_private . orderFromPath (
54
54
"/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)" ;
57
61
} ,
58
62
) ,
59
- "1" ,
63
+ "0-2024-06-10/ 1" ,
60
64
) ;
61
65
} ) ;
62
66
@@ -75,11 +79,14 @@ export async function getTests(ctx: Context) {
75
79
"/Users/myuser/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rust-analyzer" ,
76
80
"/Users/myuser/.rustup/toolchains/nightly-2022-11-22-aarch64-apple-darwin/bin/rust-analyzer" ,
77
81
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
+ }
83
90
} ,
84
91
) ,
85
92
"/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