diff options
17 files changed, 222 insertions, 28 deletions
diff --git a/Cargo.lock b/Cargo.lock index f672225c6..e8d9020d6 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -149,9 +149,9 @@ dependencies = [ | |||
149 | 149 | ||
150 | [[package]] | 150 | [[package]] |
151 | name = "cc" | 151 | name = "cc" |
152 | version = "1.0.66" | 152 | version = "1.0.67" |
153 | source = "registry+https://github.com/rust-lang/crates.io-index" | 153 | source = "registry+https://github.com/rust-lang/crates.io-index" |
154 | checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" | 154 | checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" |
155 | 155 | ||
156 | [[package]] | 156 | [[package]] |
157 | name = "cfg" | 157 | name = "cfg" |
@@ -418,9 +418,9 @@ dependencies = [ | |||
418 | 418 | ||
419 | [[package]] | 419 | [[package]] |
420 | name = "form_urlencoded" | 420 | name = "form_urlencoded" |
421 | version = "1.0.0" | 421 | version = "1.0.1" |
422 | source = "registry+https://github.com/rust-lang/crates.io-index" | 422 | source = "registry+https://github.com/rust-lang/crates.io-index" |
423 | checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" | 423 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" |
424 | dependencies = [ | 424 | dependencies = [ |
425 | "matches", | 425 | "matches", |
426 | "percent-encoding", | 426 | "percent-encoding", |
@@ -657,9 +657,9 @@ dependencies = [ | |||
657 | 657 | ||
658 | [[package]] | 658 | [[package]] |
659 | name = "idna" | 659 | name = "idna" |
660 | version = "0.2.1" | 660 | version = "0.2.2" |
661 | source = "registry+https://github.com/rust-lang/crates.io-index" | 661 | source = "registry+https://github.com/rust-lang/crates.io-index" |
662 | checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" | 662 | checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" |
663 | dependencies = [ | 663 | dependencies = [ |
664 | "matches", | 664 | "matches", |
665 | "unicode-bidi", | 665 | "unicode-bidi", |
@@ -918,9 +918,9 @@ dependencies = [ | |||
918 | 918 | ||
919 | [[package]] | 919 | [[package]] |
920 | name = "mio" | 920 | name = "mio" |
921 | version = "0.7.7" | 921 | version = "0.7.8" |
922 | source = "registry+https://github.com/rust-lang/crates.io-index" | 922 | source = "registry+https://github.com/rust-lang/crates.io-index" |
923 | checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" | 923 | checksum = "dc250d6848c90d719ea2ce34546fb5df7af1d3fd189d10bf7bad80bfcebecd95" |
924 | dependencies = [ | 924 | dependencies = [ |
925 | "libc", | 925 | "libc", |
926 | "log", | 926 | "log", |
@@ -941,9 +941,9 @@ dependencies = [ | |||
941 | 941 | ||
942 | [[package]] | 942 | [[package]] |
943 | name = "notify" | 943 | name = "notify" |
944 | version = "5.0.0-pre.5" | 944 | version = "5.0.0-pre.6" |
945 | source = "registry+https://github.com/rust-lang/crates.io-index" | 945 | source = "registry+https://github.com/rust-lang/crates.io-index" |
946 | checksum = "58e54552360d7b89a698eca6de3927205a8e03e8080dc13d779de5c7876e098b" | 946 | checksum = "e5fd82b93434edb9c00ae65ee741e0e081cdc8c63346ab9f687935a629aaf4c3" |
947 | dependencies = [ | 947 | dependencies = [ |
948 | "anymap", | 948 | "anymap", |
949 | "bitflags", | 949 | "bitflags", |
@@ -1700,9 +1700,9 @@ dependencies = [ | |||
1700 | 1700 | ||
1701 | [[package]] | 1701 | [[package]] |
1702 | name = "tracing" | 1702 | name = "tracing" |
1703 | version = "0.1.23" | 1703 | version = "0.1.24" |
1704 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1704 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1705 | checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3" | 1705 | checksum = "f77d3842f76ca899ff2dbcf231c5c65813dea431301d6eb686279c15c4464f12" |
1706 | dependencies = [ | 1706 | dependencies = [ |
1707 | "cfg-if", | 1707 | "cfg-if", |
1708 | "pin-project-lite", | 1708 | "pin-project-lite", |
@@ -1712,9 +1712,9 @@ dependencies = [ | |||
1712 | 1712 | ||
1713 | [[package]] | 1713 | [[package]] |
1714 | name = "tracing-attributes" | 1714 | name = "tracing-attributes" |
1715 | version = "0.1.12" | 1715 | version = "0.1.13" |
1716 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1716 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1717 | checksum = "43f080ea7e4107844ef4766459426fa2d5c1ada2e47edba05dc7fa99d9629f47" | 1717 | checksum = "a8a9bd1db7706f2373a190b0d067146caa39350c486f3d455b0e33b431f94c07" |
1718 | dependencies = [ | 1718 | dependencies = [ |
1719 | "proc-macro2", | 1719 | "proc-macro2", |
1720 | "quote", | 1720 | "quote", |
@@ -1732,9 +1732,9 @@ dependencies = [ | |||
1732 | 1732 | ||
1733 | [[package]] | 1733 | [[package]] |
1734 | name = "tracing-log" | 1734 | name = "tracing-log" |
1735 | version = "0.1.1" | 1735 | version = "0.1.2" |
1736 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1736 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1737 | checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" | 1737 | checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" |
1738 | dependencies = [ | 1738 | dependencies = [ |
1739 | "lazy_static", | 1739 | "lazy_static", |
1740 | "log", | 1740 | "log", |
@@ -1753,9 +1753,9 @@ dependencies = [ | |||
1753 | 1753 | ||
1754 | [[package]] | 1754 | [[package]] |
1755 | name = "tracing-subscriber" | 1755 | name = "tracing-subscriber" |
1756 | version = "0.2.15" | 1756 | version = "0.2.16" |
1757 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1757 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1758 | checksum = "a1fa8f0c8f4c594e4fc9debc1990deab13238077271ba84dd853d54902ee3401" | 1758 | checksum = "8ab8966ac3ca27126141f7999361cc97dd6fb4b71da04c02044fa9045d98bb96" |
1759 | dependencies = [ | 1759 | dependencies = [ |
1760 | "ansi_term", | 1760 | "ansi_term", |
1761 | "chrono", | 1761 | "chrono", |
@@ -1849,9 +1849,9 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" | |||
1849 | 1849 | ||
1850 | [[package]] | 1850 | [[package]] |
1851 | name = "url" | 1851 | name = "url" |
1852 | version = "2.2.0" | 1852 | version = "2.2.1" |
1853 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1853 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1854 | checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" | 1854 | checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" |
1855 | dependencies = [ | 1855 | dependencies = [ |
1856 | "form_urlencoded", | 1856 | "form_urlencoded", |
1857 | "idna", | 1857 | "idna", |
diff --git a/crates/assists/src/handlers/generate_impl.rs b/crates/assists/src/handlers/generate_impl.rs index 16a600e6f..a8e3c4fc2 100644 --- a/crates/assists/src/handlers/generate_impl.rs +++ b/crates/assists/src/handlers/generate_impl.rs | |||
@@ -122,6 +122,31 @@ mod tests { | |||
122 | $0 | 122 | $0 |
123 | }"#, | 123 | }"#, |
124 | ); | 124 | ); |
125 | |||
126 | check_assist( | ||
127 | generate_impl, | ||
128 | r#"pub trait Trait {} | ||
129 | struct Struct<T>$0 | ||
130 | where | ||
131 | T: Trait, | ||
132 | { | ||
133 | inner: T, | ||
134 | }"#, | ||
135 | r#"pub trait Trait {} | ||
136 | struct Struct<T> | ||
137 | where | ||
138 | T: Trait, | ||
139 | { | ||
140 | inner: T, | ||
141 | } | ||
142 | |||
143 | impl<T> Struct<T> | ||
144 | where | ||
145 | T: Trait, | ||
146 | { | ||
147 | $0 | ||
148 | }"#, | ||
149 | ); | ||
125 | } | 150 | } |
126 | 151 | ||
127 | #[test] | 152 | #[test] |
diff --git a/crates/assists/src/handlers/move_module_to_file.rs b/crates/assists/src/handlers/move_module_to_file.rs index 9d8579f47..91c395c1b 100644 --- a/crates/assists/src/handlers/move_module_to_file.rs +++ b/crates/assists/src/handlers/move_module_to_file.rs | |||
@@ -1,5 +1,6 @@ | |||
1 | use ast::edit::IndentLevel; | 1 | use ast::{edit::IndentLevel, VisibilityOwner}; |
2 | use ide_db::base_db::AnchoredPathBuf; | 2 | use ide_db::base_db::AnchoredPathBuf; |
3 | use stdx::format_to; | ||
3 | use syntax::{ | 4 | use syntax::{ |
4 | ast::{self, edit::AstNodeEdit, NameOwner}, | 5 | ast::{self, edit::AstNodeEdit, NameOwner}, |
5 | AstNode, TextRange, | 6 | AstNode, TextRange, |
@@ -59,7 +60,13 @@ pub(crate) fn move_module_to_file(acc: &mut Assists, ctx: &AssistContext) -> Opt | |||
59 | items | 60 | items |
60 | }; | 61 | }; |
61 | 62 | ||
62 | builder.replace(module_ast.syntax().text_range(), format!("mod {};", module_name)); | 63 | let mut buf = String::new(); |
64 | if let Some(v) = module_ast.visibility() { | ||
65 | format_to!(buf, "{} ", v); | ||
66 | } | ||
67 | format_to!(buf, "mod {};", module_name); | ||
68 | |||
69 | builder.replace(module_ast.syntax().text_range(), buf); | ||
63 | 70 | ||
64 | let dst = AnchoredPathBuf { anchor: ctx.frange.file_id, path }; | 71 | let dst = AnchoredPathBuf { anchor: ctx.frange.file_id, path }; |
65 | builder.create_file(dst, contents); | 72 | builder.create_file(dst, contents); |
@@ -138,6 +145,42 @@ fn f() {} | |||
138 | } | 145 | } |
139 | 146 | ||
140 | #[test] | 147 | #[test] |
148 | fn extract_public() { | ||
149 | check_assist( | ||
150 | move_module_to_file, | ||
151 | r#" | ||
152 | pub mod $0tests { | ||
153 | #[test] fn t() {} | ||
154 | } | ||
155 | "#, | ||
156 | r#" | ||
157 | //- /main.rs | ||
158 | pub mod tests; | ||
159 | //- /tests.rs | ||
160 | #[test] fn t() {} | ||
161 | "#, | ||
162 | ); | ||
163 | } | ||
164 | |||
165 | #[test] | ||
166 | fn extract_public_crate() { | ||
167 | check_assist( | ||
168 | move_module_to_file, | ||
169 | r#" | ||
170 | pub(crate) mod $0tests { | ||
171 | #[test] fn t() {} | ||
172 | } | ||
173 | "#, | ||
174 | r#" | ||
175 | //- /main.rs | ||
176 | pub(crate) mod tests; | ||
177 | //- /tests.rs | ||
178 | #[test] fn t() {} | ||
179 | "#, | ||
180 | ); | ||
181 | } | ||
182 | |||
183 | #[test] | ||
141 | fn available_before_curly() { | 184 | fn available_before_curly() { |
142 | mark::check!(available_before_curly); | 185 | mark::check!(available_before_curly); |
143 | check_assist_not_applicable(move_module_to_file, r#"mod m { $0 }"#); | 186 | check_assist_not_applicable(move_module_to_file, r#"mod m { $0 }"#); |
diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs index 8418e6e12..0074da741 100644 --- a/crates/assists/src/utils.rs +++ b/crates/assists/src/utils.rs | |||
@@ -421,7 +421,14 @@ fn generate_impl_text_inner(adt: &ast::Adt, trait_text: Option<&str>, code: &str | |||
421 | format_to!(buf, "<{}>", lifetime_params.chain(type_params).format(", ")) | 421 | format_to!(buf, "<{}>", lifetime_params.chain(type_params).format(", ")) |
422 | } | 422 | } |
423 | 423 | ||
424 | format_to!(buf, " {{\n{}\n}}", code); | 424 | match adt.where_clause() { |
425 | Some(where_clause) => { | ||
426 | format_to!(buf, "\n{}\n{{\n{}\n}}", where_clause, code); | ||
427 | } | ||
428 | None => { | ||
429 | format_to!(buf, " {{\n{}\n}}", code); | ||
430 | } | ||
431 | } | ||
425 | 432 | ||
426 | buf | 433 | buf |
427 | } | 434 | } |
diff --git a/crates/ide/src/extend_selection.rs b/crates/ide/src/extend_selection.rs index 2d722dee0..b540d04fe 100644 --- a/crates/ide/src/extend_selection.rs +++ b/crates/ide/src/extend_selection.rs | |||
@@ -12,15 +12,17 @@ use syntax::{ | |||
12 | 12 | ||
13 | use crate::FileRange; | 13 | use crate::FileRange; |
14 | 14 | ||
15 | // Feature: Extend Selection | 15 | // Feature: Expand and Shrink Selection |
16 | // | 16 | // |
17 | // Extends the current selection to the encompassing syntactic construct | 17 | // Extends or shrinks the current selection to the encompassing syntactic construct |
18 | // (expression, statement, item, module, etc). It works with multiple cursors. | 18 | // (expression, statement, item, module, etc). It works with multiple cursors. |
19 | // | 19 | // |
20 | // This is a standard LSP feature and not a protocol extension. | ||
21 | // | ||
20 | // |=== | 22 | // |=== |
21 | // | Editor | Shortcut | 23 | // | Editor | Shortcut |
22 | // | 24 | // |
23 | // | VS Code | kbd:[Ctrl+Shift+→] | 25 | // | VS Code | kbd:[Alt+Shift+→], kbd:[Alt+Shift+←] |
24 | // |=== | 26 | // |=== |
25 | pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange { | 27 | pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange { |
26 | let sema = Semantics::new(db); | 28 | let sema = Semantics::new(db); |
diff --git a/crates/ide_completion/src/completions/attribute.rs b/crates/ide_completion/src/completions/attribute.rs index ab25a8c58..3a5bc4381 100644 --- a/crates/ide_completion/src/completions/attribute.rs +++ b/crates/ide_completion/src/completions/attribute.rs | |||
@@ -101,6 +101,7 @@ const ATTRIBUTES: &[AttrCompletion] = &[ | |||
101 | ), | 101 | ), |
102 | attr(r#"doc(alias = "…")"#, Some("docalias"), Some(r#"doc(alias = "${0:docs}")"#)), | 102 | attr(r#"doc(alias = "…")"#, Some("docalias"), Some(r#"doc(alias = "${0:docs}")"#)), |
103 | attr(r#"doc = "…""#, Some("doc"), Some(r#"doc = "${0:docs}""#)), | 103 | attr(r#"doc = "…""#, Some("doc"), Some(r#"doc = "${0:docs}""#)), |
104 | attr(r#"doc(hidden)"#, Some("dochidden"), Some(r#"doc(hidden)"#)), | ||
104 | attr("feature(…)", Some("feature"), Some("feature(${0:flag})")).prefer_inner(), | 105 | attr("feature(…)", Some("feature"), Some("feature(${0:flag})")).prefer_inner(), |
105 | attr("forbid(…)", Some("forbid"), Some("forbid(${0:lint})")), | 106 | attr("forbid(…)", Some("forbid"), Some("forbid(${0:lint})")), |
106 | // FIXME: resolve through macro resolution? | 107 | // FIXME: resolve through macro resolution? |
@@ -471,6 +472,7 @@ struct Test {} | |||
471 | at export_name = "…" | 472 | at export_name = "…" |
472 | at doc(alias = "…") | 473 | at doc(alias = "…") |
473 | at doc = "…" | 474 | at doc = "…" |
475 | at doc(hidden) | ||
474 | at forbid(…) | 476 | at forbid(…) |
475 | at ignore = "…" | 477 | at ignore = "…" |
476 | at inline | 478 | at inline |
@@ -519,6 +521,7 @@ struct Test {} | |||
519 | at export_name = "…" | 521 | at export_name = "…" |
520 | at doc(alias = "…") | 522 | at doc(alias = "…") |
521 | at doc = "…" | 523 | at doc = "…" |
524 | at doc(hidden) | ||
522 | at feature(…) | 525 | at feature(…) |
523 | at forbid(…) | 526 | at forbid(…) |
524 | at global_allocator | 527 | at global_allocator |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt index ce80476fb..23ec2efba 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/compiler/mir/tagset.rs", | 9 | path: "/test/compiler/mir/tagset.rs", |
@@ -31,6 +33,8 @@ | |||
31 | CodeDescription { | 33 | CodeDescription { |
32 | href: Url { | 34 | href: Url { |
33 | scheme: "https", | 35 | scheme: "https", |
36 | username: "", | ||
37 | password: None, | ||
34 | host: Some( | 38 | host: Some( |
35 | Domain( | 39 | Domain( |
36 | "rust-lang.github.io", | 40 | "rust-lang.github.io", |
@@ -55,6 +59,8 @@ | |||
55 | location: Location { | 59 | location: Location { |
56 | uri: Url { | 60 | uri: Url { |
57 | scheme: "file", | 61 | scheme: "file", |
62 | username: "", | ||
63 | password: None, | ||
58 | host: None, | 64 | host: None, |
59 | port: None, | 65 | port: None, |
60 | path: "/test/compiler/lib.rs", | 66 | path: "/test/compiler/lib.rs", |
@@ -78,6 +84,8 @@ | |||
78 | location: Location { | 84 | location: Location { |
79 | uri: Url { | 85 | uri: Url { |
80 | scheme: "file", | 86 | scheme: "file", |
87 | username: "", | ||
88 | password: None, | ||
81 | host: None, | 89 | host: None, |
82 | port: None, | 90 | port: None, |
83 | path: "/test/compiler/mir/tagset.rs", | 91 | path: "/test/compiler/mir/tagset.rs", |
@@ -107,6 +115,8 @@ | |||
107 | MappedRustDiagnostic { | 115 | MappedRustDiagnostic { |
108 | url: Url { | 116 | url: Url { |
109 | scheme: "file", | 117 | scheme: "file", |
118 | username: "", | ||
119 | password: None, | ||
110 | host: None, | 120 | host: None, |
111 | port: None, | 121 | port: None, |
112 | path: "/test/compiler/lib.rs", | 122 | path: "/test/compiler/lib.rs", |
@@ -136,6 +146,8 @@ | |||
136 | CodeDescription { | 146 | CodeDescription { |
137 | href: Url { | 147 | href: Url { |
138 | scheme: "https", | 148 | scheme: "https", |
149 | username: "", | ||
150 | password: None, | ||
139 | host: Some( | 151 | host: Some( |
140 | Domain( | 152 | Domain( |
141 | "rust-lang.github.io", | 153 | "rust-lang.github.io", |
@@ -160,6 +172,8 @@ | |||
160 | location: Location { | 172 | location: Location { |
161 | uri: Url { | 173 | uri: Url { |
162 | scheme: "file", | 174 | scheme: "file", |
175 | username: "", | ||
176 | password: None, | ||
163 | host: None, | 177 | host: None, |
164 | port: None, | 178 | port: None, |
165 | path: "/test/compiler/mir/tagset.rs", | 179 | path: "/test/compiler/mir/tagset.rs", |
@@ -189,6 +203,8 @@ | |||
189 | MappedRustDiagnostic { | 203 | MappedRustDiagnostic { |
190 | url: Url { | 204 | url: Url { |
191 | scheme: "file", | 205 | scheme: "file", |
206 | username: "", | ||
207 | password: None, | ||
192 | host: None, | 208 | host: None, |
193 | port: None, | 209 | port: None, |
194 | path: "/test/compiler/mir/tagset.rs", | 210 | path: "/test/compiler/mir/tagset.rs", |
@@ -218,6 +234,8 @@ | |||
218 | CodeDescription { | 234 | CodeDescription { |
219 | href: Url { | 235 | href: Url { |
220 | scheme: "https", | 236 | scheme: "https", |
237 | username: "", | ||
238 | password: None, | ||
221 | host: Some( | 239 | host: Some( |
222 | Domain( | 240 | Domain( |
223 | "rust-lang.github.io", | 241 | "rust-lang.github.io", |
@@ -242,6 +260,8 @@ | |||
242 | location: Location { | 260 | location: Location { |
243 | uri: Url { | 261 | uri: Url { |
244 | scheme: "file", | 262 | scheme: "file", |
263 | username: "", | ||
264 | password: None, | ||
245 | host: None, | 265 | host: None, |
246 | port: None, | 266 | port: None, |
247 | path: "/test/compiler/mir/tagset.rs", | 267 | path: "/test/compiler/mir/tagset.rs", |
@@ -281,6 +301,8 @@ | |||
281 | { | 301 | { |
282 | Url { | 302 | Url { |
283 | scheme: "file", | 303 | scheme: "file", |
304 | username: "", | ||
305 | password: None, | ||
284 | host: None, | 306 | host: None, |
285 | port: None, | 307 | port: None, |
286 | path: "/test/compiler/mir/tagset.rs", | 308 | path: "/test/compiler/mir/tagset.rs", |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt index eb4a6b597..e5f01fb33 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/src/main.rs", | 9 | path: "/test/src/main.rs", |
@@ -31,6 +33,8 @@ | |||
31 | CodeDescription { | 33 | CodeDescription { |
32 | href: Url { | 34 | href: Url { |
33 | scheme: "https", | 35 | scheme: "https", |
36 | username: "", | ||
37 | password: None, | ||
34 | host: Some( | 38 | host: Some( |
35 | Domain( | 39 | Domain( |
36 | "doc.rust-lang.org", | 40 | "doc.rust-lang.org", |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt b/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt index bdcf2a38f..f999848a7 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/crates/hir_def/src/path.rs", | 9 | path: "/test/crates/hir_def/src/path.rs", |
@@ -34,6 +36,8 @@ | |||
34 | location: Location { | 36 | location: Location { |
35 | uri: Url { | 37 | uri: Url { |
36 | scheme: "file", | 38 | scheme: "file", |
39 | username: "", | ||
40 | password: None, | ||
37 | host: None, | 41 | host: None, |
38 | port: None, | 42 | port: None, |
39 | path: "/test/crates/hir_def/src/data.rs", | 43 | path: "/test/crates/hir_def/src/data.rs", |
@@ -63,6 +67,8 @@ | |||
63 | MappedRustDiagnostic { | 67 | MappedRustDiagnostic { |
64 | url: Url { | 68 | url: Url { |
65 | scheme: "file", | 69 | scheme: "file", |
70 | username: "", | ||
71 | password: None, | ||
66 | host: None, | 72 | host: None, |
67 | port: None, | 73 | port: None, |
68 | path: "/test/crates/hir_def/src/data.rs", | 74 | path: "/test/crates/hir_def/src/data.rs", |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt index 19f72196d..0d16af232 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/compiler/ty/list_iter.rs", | 9 | path: "/test/compiler/ty/list_iter.rs", |
@@ -31,6 +33,8 @@ | |||
31 | CodeDescription { | 33 | CodeDescription { |
32 | href: Url { | 34 | href: Url { |
33 | scheme: "https", | 35 | scheme: "https", |
36 | username: "", | ||
37 | password: None, | ||
34 | host: Some( | 38 | host: Some( |
35 | Domain( | 39 | Domain( |
36 | "doc.rust-lang.org", | 40 | "doc.rust-lang.org", |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt index 15ac95d72..31b6a12ce 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/runtime/compiler_support.rs", | 9 | path: "/test/runtime/compiler_support.rs", |
@@ -31,6 +33,8 @@ | |||
31 | CodeDescription { | 33 | CodeDescription { |
32 | href: Url { | 34 | href: Url { |
33 | scheme: "https", | 35 | scheme: "https", |
36 | username: "", | ||
37 | password: None, | ||
34 | host: Some( | 38 | host: Some( |
35 | Domain( | 39 | Domain( |
36 | "doc.rust-lang.org", | 40 | "doc.rust-lang.org", |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt index 5c282fe67..b6acb5f42 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/driver/subcommand/repl.rs", | 9 | path: "/test/driver/subcommand/repl.rs", |
@@ -38,6 +40,8 @@ | |||
38 | location: Location { | 40 | location: Location { |
39 | uri: Url { | 41 | uri: Url { |
40 | scheme: "file", | 42 | scheme: "file", |
43 | username: "", | ||
44 | password: None, | ||
41 | host: None, | 45 | host: None, |
42 | port: None, | 46 | port: None, |
43 | path: "/test/driver/subcommand/repl.rs", | 47 | path: "/test/driver/subcommand/repl.rs", |
@@ -71,6 +75,8 @@ | |||
71 | MappedRustDiagnostic { | 75 | MappedRustDiagnostic { |
72 | url: Url { | 76 | url: Url { |
73 | scheme: "file", | 77 | scheme: "file", |
78 | username: "", | ||
79 | password: None, | ||
74 | host: None, | 80 | host: None, |
75 | port: None, | 81 | port: None, |
76 | path: "/test/driver/subcommand/repl.rs", | 82 | path: "/test/driver/subcommand/repl.rs", |
@@ -107,6 +113,8 @@ | |||
107 | location: Location { | 113 | location: Location { |
108 | uri: Url { | 114 | uri: Url { |
109 | scheme: "file", | 115 | scheme: "file", |
116 | username: "", | ||
117 | password: None, | ||
110 | host: None, | 118 | host: None, |
111 | port: None, | 119 | port: None, |
112 | path: "/test/driver/subcommand/repl.rs", | 120 | path: "/test/driver/subcommand/repl.rs", |
@@ -146,6 +154,8 @@ | |||
146 | { | 154 | { |
147 | Url { | 155 | Url { |
148 | scheme: "file", | 156 | scheme: "file", |
157 | username: "", | ||
158 | password: None, | ||
149 | host: None, | 159 | host: None, |
150 | port: None, | 160 | port: None, |
151 | path: "/test/driver/subcommand/repl.rs", | 161 | path: "/test/driver/subcommand/repl.rs", |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt index d36d7693d..d765257c4 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/driver/subcommand/repl.rs", | 9 | path: "/test/driver/subcommand/repl.rs", |
@@ -38,6 +40,8 @@ | |||
38 | location: Location { | 40 | location: Location { |
39 | uri: Url { | 41 | uri: Url { |
40 | scheme: "file", | 42 | scheme: "file", |
43 | username: "", | ||
44 | password: None, | ||
41 | host: None, | 45 | host: None, |
42 | port: None, | 46 | port: None, |
43 | path: "/test/driver/subcommand/repl.rs", | 47 | path: "/test/driver/subcommand/repl.rs", |
@@ -71,6 +75,8 @@ | |||
71 | MappedRustDiagnostic { | 75 | MappedRustDiagnostic { |
72 | url: Url { | 76 | url: Url { |
73 | scheme: "file", | 77 | scheme: "file", |
78 | username: "", | ||
79 | password: None, | ||
74 | host: None, | 80 | host: None, |
75 | port: None, | 81 | port: None, |
76 | path: "/test/driver/subcommand/repl.rs", | 82 | path: "/test/driver/subcommand/repl.rs", |
@@ -107,6 +113,8 @@ | |||
107 | location: Location { | 113 | location: Location { |
108 | uri: Url { | 114 | uri: Url { |
109 | scheme: "file", | 115 | scheme: "file", |
116 | username: "", | ||
117 | password: None, | ||
110 | host: None, | 118 | host: None, |
111 | port: None, | 119 | port: None, |
112 | path: "/test/driver/subcommand/repl.rs", | 120 | path: "/test/driver/subcommand/repl.rs", |
@@ -146,6 +154,8 @@ | |||
146 | { | 154 | { |
147 | Url { | 155 | Url { |
148 | scheme: "file", | 156 | scheme: "file", |
157 | username: "", | ||
158 | password: None, | ||
149 | host: None, | 159 | host: None, |
150 | port: None, | 160 | port: None, |
151 | path: "/test/driver/subcommand/repl.rs", | 161 | path: "/test/driver/subcommand/repl.rs", |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt index 17845b711..6b0d94878 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/driver/subcommand/repl.rs", | 9 | path: "/test/driver/subcommand/repl.rs", |
@@ -38,6 +40,8 @@ | |||
38 | location: Location { | 40 | location: Location { |
39 | uri: Url { | 41 | uri: Url { |
40 | scheme: "file", | 42 | scheme: "file", |
43 | username: "", | ||
44 | password: None, | ||
41 | host: None, | 45 | host: None, |
42 | port: None, | 46 | port: None, |
43 | path: "/test/driver/subcommand/repl.rs", | 47 | path: "/test/driver/subcommand/repl.rs", |
@@ -71,6 +75,8 @@ | |||
71 | MappedRustDiagnostic { | 75 | MappedRustDiagnostic { |
72 | url: Url { | 76 | url: Url { |
73 | scheme: "file", | 77 | scheme: "file", |
78 | username: "", | ||
79 | password: None, | ||
74 | host: None, | 80 | host: None, |
75 | port: None, | 81 | port: None, |
76 | path: "/test/driver/subcommand/repl.rs", | 82 | path: "/test/driver/subcommand/repl.rs", |
@@ -107,6 +113,8 @@ | |||
107 | location: Location { | 113 | location: Location { |
108 | uri: Url { | 114 | uri: Url { |
109 | scheme: "file", | 115 | scheme: "file", |
116 | username: "", | ||
117 | password: None, | ||
110 | host: None, | 118 | host: None, |
111 | port: None, | 119 | port: None, |
112 | path: "/test/driver/subcommand/repl.rs", | 120 | path: "/test/driver/subcommand/repl.rs", |
@@ -146,6 +154,8 @@ | |||
146 | { | 154 | { |
147 | Url { | 155 | Url { |
148 | scheme: "file", | 156 | scheme: "file", |
157 | username: "", | ||
158 | password: None, | ||
149 | host: None, | 159 | host: None, |
150 | port: None, | 160 | port: None, |
151 | path: "/test/driver/subcommand/repl.rs", | 161 | path: "/test/driver/subcommand/repl.rs", |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt index f455cf25e..f7a313cf1 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/compiler/ty/select.rs", | 9 | path: "/test/compiler/ty/select.rs", |
@@ -31,6 +33,8 @@ | |||
31 | CodeDescription { | 33 | CodeDescription { |
32 | href: Url { | 34 | href: Url { |
33 | scheme: "https", | 35 | scheme: "https", |
36 | username: "", | ||
37 | password: None, | ||
34 | host: Some( | 38 | host: Some( |
35 | Domain( | 39 | Domain( |
36 | "doc.rust-lang.org", | 40 | "doc.rust-lang.org", |
@@ -55,6 +59,8 @@ | |||
55 | location: Location { | 59 | location: Location { |
56 | uri: Url { | 60 | uri: Url { |
57 | scheme: "file", | 61 | scheme: "file", |
62 | username: "", | ||
63 | password: None, | ||
58 | host: None, | 64 | host: None, |
59 | port: None, | 65 | port: None, |
60 | path: "/test/compiler/ty/select.rs", | 66 | path: "/test/compiler/ty/select.rs", |
@@ -84,6 +90,8 @@ | |||
84 | MappedRustDiagnostic { | 90 | MappedRustDiagnostic { |
85 | url: Url { | 91 | url: Url { |
86 | scheme: "file", | 92 | scheme: "file", |
93 | username: "", | ||
94 | password: None, | ||
87 | host: None, | 95 | host: None, |
88 | port: None, | 96 | port: None, |
89 | path: "/test/compiler/ty/select.rs", | 97 | path: "/test/compiler/ty/select.rs", |
@@ -113,6 +121,8 @@ | |||
113 | CodeDescription { | 121 | CodeDescription { |
114 | href: Url { | 122 | href: Url { |
115 | scheme: "https", | 123 | scheme: "https", |
124 | username: "", | ||
125 | password: None, | ||
116 | host: Some( | 126 | host: Some( |
117 | Domain( | 127 | Domain( |
118 | "doc.rust-lang.org", | 128 | "doc.rust-lang.org", |
@@ -137,6 +147,8 @@ | |||
137 | location: Location { | 147 | location: Location { |
138 | uri: Url { | 148 | uri: Url { |
139 | scheme: "file", | 149 | scheme: "file", |
150 | username: "", | ||
151 | password: None, | ||
140 | host: None, | 152 | host: None, |
141 | port: None, | 153 | port: None, |
142 | path: "/test/compiler/ty/select.rs", | 154 | path: "/test/compiler/ty/select.rs", |
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt b/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt index a19962167..a0cfb8d33 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt | |||
@@ -2,6 +2,8 @@ | |||
2 | MappedRustDiagnostic { | 2 | MappedRustDiagnostic { |
3 | url: Url { | 3 | url: Url { |
4 | scheme: "file", | 4 | scheme: "file", |
5 | username: "", | ||
6 | password: None, | ||
5 | host: None, | 7 | host: None, |
6 | port: None, | 8 | port: None, |
7 | path: "/test/src/main.rs", | 9 | path: "/test/src/main.rs", |
@@ -31,6 +33,8 @@ | |||
31 | CodeDescription { | 33 | CodeDescription { |
32 | href: Url { | 34 | href: Url { |
33 | scheme: "https", | 35 | scheme: "https", |
36 | username: "", | ||
37 | password: None, | ||
34 | host: Some( | 38 | host: Some( |
35 | Domain( | 39 | Domain( |
36 | "rust-lang.github.io", | 40 | "rust-lang.github.io", |
@@ -55,6 +59,8 @@ | |||
55 | location: Location { | 59 | location: Location { |
56 | uri: Url { | 60 | uri: Url { |
57 | scheme: "file", | 61 | scheme: "file", |
62 | username: "", | ||
63 | password: None, | ||
58 | host: None, | 64 | host: None, |
59 | port: None, | 65 | port: None, |
60 | path: "/test/src/main.rs", | 66 | path: "/test/src/main.rs", |
@@ -78,6 +84,8 @@ | |||
78 | location: Location { | 84 | location: Location { |
79 | uri: Url { | 85 | uri: Url { |
80 | scheme: "file", | 86 | scheme: "file", |
87 | username: "", | ||
88 | password: None, | ||
81 | host: None, | 89 | host: None, |
82 | port: None, | 90 | port: None, |
83 | path: "/test/src/main.rs", | 91 | path: "/test/src/main.rs", |
@@ -107,6 +115,8 @@ | |||
107 | MappedRustDiagnostic { | 115 | MappedRustDiagnostic { |
108 | url: Url { | 116 | url: Url { |
109 | scheme: "file", | 117 | scheme: "file", |
118 | username: "", | ||
119 | password: None, | ||
110 | host: None, | 120 | host: None, |
111 | port: None, | 121 | port: None, |
112 | path: "/test/src/main.rs", | 122 | path: "/test/src/main.rs", |
@@ -136,6 +146,8 @@ | |||
136 | CodeDescription { | 146 | CodeDescription { |
137 | href: Url { | 147 | href: Url { |
138 | scheme: "https", | 148 | scheme: "https", |
149 | username: "", | ||
150 | password: None, | ||
139 | host: Some( | 151 | host: Some( |
140 | Domain( | 152 | Domain( |
141 | "rust-lang.github.io", | 153 | "rust-lang.github.io", |
@@ -160,6 +172,8 @@ | |||
160 | location: Location { | 172 | location: Location { |
161 | uri: Url { | 173 | uri: Url { |
162 | scheme: "file", | 174 | scheme: "file", |
175 | username: "", | ||
176 | password: None, | ||
163 | host: None, | 177 | host: None, |
164 | port: None, | 178 | port: None, |
165 | path: "/test/src/main.rs", | 179 | path: "/test/src/main.rs", |
@@ -189,6 +203,8 @@ | |||
189 | MappedRustDiagnostic { | 203 | MappedRustDiagnostic { |
190 | url: Url { | 204 | url: Url { |
191 | scheme: "file", | 205 | scheme: "file", |
206 | username: "", | ||
207 | password: None, | ||
192 | host: None, | 208 | host: None, |
193 | port: None, | 209 | port: None, |
194 | path: "/test/src/main.rs", | 210 | path: "/test/src/main.rs", |
@@ -218,6 +234,8 @@ | |||
218 | CodeDescription { | 234 | CodeDescription { |
219 | href: Url { | 235 | href: Url { |
220 | scheme: "https", | 236 | scheme: "https", |
237 | username: "", | ||
238 | password: None, | ||
221 | host: Some( | 239 | host: Some( |
222 | Domain( | 240 | Domain( |
223 | "rust-lang.github.io", | 241 | "rust-lang.github.io", |
@@ -242,6 +260,8 @@ | |||
242 | location: Location { | 260 | location: Location { |
243 | uri: Url { | 261 | uri: Url { |
244 | scheme: "file", | 262 | scheme: "file", |
263 | username: "", | ||
264 | password: None, | ||
245 | host: None, | 265 | host: None, |
246 | port: None, | 266 | port: None, |
247 | path: "/test/src/main.rs", | 267 | path: "/test/src/main.rs", |
@@ -281,6 +301,8 @@ | |||
281 | { | 301 | { |
282 | Url { | 302 | Url { |
283 | scheme: "file", | 303 | scheme: "file", |
304 | username: "", | ||
305 | password: None, | ||
284 | host: None, | 306 | host: None, |
285 | port: None, | 307 | port: None, |
286 | path: "/test/src/main.rs", | 308 | path: "/test/src/main.rs", |
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 620810d72..00393d6e8 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -12,7 +12,7 @@ import { PersistentState } from './persistent_state'; | |||
12 | import { fetchRelease, download } from './net'; | 12 | import { fetchRelease, download } from './net'; |
13 | import { activateTaskProvider } from './tasks'; | 13 | import { activateTaskProvider } from './tasks'; |
14 | import { setContextValue } from './util'; | 14 | import { setContextValue } from './util'; |
15 | import { exec } from 'child_process'; | 15 | import { exec, spawnSync } from 'child_process'; |
16 | 16 | ||
17 | let ctx: Ctx | undefined; | 17 | let ctx: Ctx | undefined; |
18 | 18 | ||
@@ -297,7 +297,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string | |||
297 | "arm64 linux": "aarch64-unknown-linux-gnu", | 297 | "arm64 linux": "aarch64-unknown-linux-gnu", |
298 | "arm64 darwin": "aarch64-apple-darwin", | 298 | "arm64 darwin": "aarch64-apple-darwin", |
299 | }; | 299 | }; |
300 | const platform = platforms[`${process.arch} ${process.platform}`]; | 300 | let platform = platforms[`${process.arch} ${process.platform}`]; |
301 | if (platform === undefined) { | 301 | if (platform === undefined) { |
302 | await vscode.window.showErrorMessage( | 302 | await vscode.window.showErrorMessage( |
303 | "Unfortunately we don't ship binaries for your platform yet. " + | 303 | "Unfortunately we don't ship binaries for your platform yet. " + |
@@ -309,6 +309,9 @@ async function getServer(config: Config, state: PersistentState): Promise<string | |||
309 | ); | 309 | ); |
310 | return undefined; | 310 | return undefined; |
311 | } | 311 | } |
312 | if (platform === "x86_64-unknown-linux-gnu" && isMusl()) { | ||
313 | platform = "x86_64-unknown-linux-musl"; | ||
314 | } | ||
312 | const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : ""; | 315 | const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : ""; |
313 | const dest = path.join(config.globalStoragePath, `rust-analyzer-${platform}${ext}`); | 316 | const dest = path.join(config.globalStoragePath, `rust-analyzer-${platform}${ext}`); |
314 | const exists = await fs.stat(dest).then(() => true, () => false); | 317 | const exists = await fs.stat(dest).then(() => true, () => false); |
@@ -365,6 +368,13 @@ async function isNixOs(): Promise<boolean> { | |||
365 | } | 368 | } |
366 | } | 369 | } |
367 | 370 | ||
371 | function isMusl(): boolean { | ||
372 | // We can detect Alpine by checking `/etc/os-release` but not Void Linux musl. | ||
373 | // Instead, we run `ldd` since it advertises the libc which it belongs to. | ||
374 | const res = spawnSync("ldd", ["--version"]); | ||
375 | return res.stderr != null && res.stderr.indexOf("musl libc") >= 0; | ||
376 | } | ||
377 | |||
368 | async function downloadWithRetryDialog<T>(state: PersistentState, downloadFunc: () => Promise<T>): Promise<T> { | 378 | async function downloadWithRetryDialog<T>(state: PersistentState, downloadFunc: () => Promise<T>): Promise<T> { |
369 | while (true) { | 379 | while (true) { |
370 | try { | 380 | try { |