diff options
-rw-r--r-- | Cargo.lock | 49 | ||||
-rw-r--r-- | crates/assists/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/completion/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/hir/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/hir_def/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/hir_def/src/import_map.rs | 6 | ||||
-rw-r--r-- | crates/hir_ty/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 2 | ||||
-rw-r--r-- | crates/ide/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ide/src/diagnostics.rs | 22 | ||||
-rw-r--r-- | crates/ide_db/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/project_model/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ssr/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/syntax/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 8 | ||||
-rw-r--r-- | editors/code/package.json | 8 | ||||
-rw-r--r-- | editors/code/src/client.ts | 11 | ||||
-rw-r--r-- | editors/code/src/config.ts | 3 | ||||
-rw-r--r-- | editors/code/src/ctx.ts | 2 |
20 files changed, 97 insertions, 36 deletions
diff --git a/Cargo.lock b/Cargo.lock index fd04ec3c5..9ddbeac47 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -26,9 +26,9 @@ dependencies = [ | |||
26 | 26 | ||
27 | [[package]] | 27 | [[package]] |
28 | name = "anyhow" | 28 | name = "anyhow" |
29 | version = "1.0.36" | 29 | version = "1.0.37" |
30 | source = "registry+https://github.com/rust-lang/crates.io-index" | 30 | source = "registry+https://github.com/rust-lang/crates.io-index" |
31 | checksum = "68803225a7b13e47191bab76f2687382b60d259e8cf37f6e1893658b84bb9479" | 31 | checksum = "ee67c11feeac938fae061b232e38e0b6d94f97a9df10e6271319325ac4c56a86" |
32 | 32 | ||
33 | [[package]] | 33 | [[package]] |
34 | name = "anymap" | 34 | name = "anymap" |
@@ -53,7 +53,7 @@ dependencies = [ | |||
53 | "either", | 53 | "either", |
54 | "hir", | 54 | "hir", |
55 | "ide_db", | 55 | "ide_db", |
56 | "itertools", | 56 | "itertools 0.10.0", |
57 | "profile", | 57 | "profile", |
58 | "rustc-hash", | 58 | "rustc-hash", |
59 | "stdx", | 59 | "stdx", |
@@ -211,7 +211,7 @@ dependencies = [ | |||
211 | "chalk-derive", | 211 | "chalk-derive", |
212 | "chalk-ir", | 212 | "chalk-ir", |
213 | "ena", | 213 | "ena", |
214 | "itertools", | 214 | "itertools 0.9.0", |
215 | "petgraph", | 215 | "petgraph", |
216 | "rustc-hash", | 216 | "rustc-hash", |
217 | "tracing", | 217 | "tracing", |
@@ -250,7 +250,7 @@ dependencies = [ | |||
250 | "expect-test", | 250 | "expect-test", |
251 | "hir", | 251 | "hir", |
252 | "ide_db", | 252 | "ide_db", |
253 | "itertools", | 253 | "itertools 0.10.0", |
254 | "log", | 254 | "log", |
255 | "profile", | 255 | "profile", |
256 | "rustc-hash", | 256 | "rustc-hash", |
@@ -534,7 +534,7 @@ dependencies = [ | |||
534 | "hir_def", | 534 | "hir_def", |
535 | "hir_expand", | 535 | "hir_expand", |
536 | "hir_ty", | 536 | "hir_ty", |
537 | "itertools", | 537 | "itertools 0.10.0", |
538 | "log", | 538 | "log", |
539 | "profile", | 539 | "profile", |
540 | "rustc-hash", | 540 | "rustc-hash", |
@@ -557,7 +557,7 @@ dependencies = [ | |||
557 | "fst", | 557 | "fst", |
558 | "hir_expand", | 558 | "hir_expand", |
559 | "indexmap", | 559 | "indexmap", |
560 | "itertools", | 560 | "itertools 0.10.0", |
561 | "log", | 561 | "log", |
562 | "mbe", | 562 | "mbe", |
563 | "once_cell", | 563 | "once_cell", |
@@ -601,7 +601,7 @@ dependencies = [ | |||
601 | "expect-test", | 601 | "expect-test", |
602 | "hir_def", | 602 | "hir_def", |
603 | "hir_expand", | 603 | "hir_expand", |
604 | "itertools", | 604 | "itertools 0.10.0", |
605 | "log", | 605 | "log", |
606 | "once_cell", | 606 | "once_cell", |
607 | "profile", | 607 | "profile", |
@@ -637,7 +637,7 @@ dependencies = [ | |||
637 | "hir", | 637 | "hir", |
638 | "ide_db", | 638 | "ide_db", |
639 | "indexmap", | 639 | "indexmap", |
640 | "itertools", | 640 | "itertools 0.10.0", |
641 | "log", | 641 | "log", |
642 | "oorandom", | 642 | "oorandom", |
643 | "profile", | 643 | "profile", |
@@ -661,7 +661,7 @@ dependencies = [ | |||
661 | "expect-test", | 661 | "expect-test", |
662 | "fst", | 662 | "fst", |
663 | "hir", | 663 | "hir", |
664 | "itertools", | 664 | "itertools 0.10.0", |
665 | "log", | 665 | "log", |
666 | "once_cell", | 666 | "once_cell", |
667 | "profile", | 667 | "profile", |
@@ -742,10 +742,19 @@ dependencies = [ | |||
742 | ] | 742 | ] |
743 | 743 | ||
744 | [[package]] | 744 | [[package]] |
745 | name = "itertools" | ||
746 | version = "0.10.0" | ||
747 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
748 | checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" | ||
749 | dependencies = [ | ||
750 | "either", | ||
751 | ] | ||
752 | |||
753 | [[package]] | ||
745 | name = "itoa" | 754 | name = "itoa" |
746 | version = "0.4.6" | 755 | version = "0.4.7" |
747 | source = "registry+https://github.com/rust-lang/crates.io-index" | 756 | source = "registry+https://github.com/rust-lang/crates.io-index" |
748 | checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" | 757 | checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" |
749 | 758 | ||
750 | [[package]] | 759 | [[package]] |
751 | name = "jod-thread" | 760 | name = "jod-thread" |
@@ -1219,7 +1228,7 @@ dependencies = [ | |||
1219 | "base_db", | 1228 | "base_db", |
1220 | "cargo_metadata", | 1229 | "cargo_metadata", |
1221 | "cfg", | 1230 | "cfg", |
1222 | "itertools", | 1231 | "itertools 0.10.0", |
1223 | "log", | 1232 | "log", |
1224 | "paths", | 1233 | "paths", |
1225 | "proc_macro_api", | 1234 | "proc_macro_api", |
@@ -1342,7 +1351,7 @@ dependencies = [ | |||
1342 | "hir_ty", | 1351 | "hir_ty", |
1343 | "ide", | 1352 | "ide", |
1344 | "ide_db", | 1353 | "ide_db", |
1345 | "itertools", | 1354 | "itertools 0.10.0", |
1346 | "jod-thread", | 1355 | "jod-thread", |
1347 | "log", | 1356 | "log", |
1348 | "lsp-server", | 1357 | "lsp-server", |
@@ -1518,9 +1527,9 @@ dependencies = [ | |||
1518 | 1527 | ||
1519 | [[package]] | 1528 | [[package]] |
1520 | name = "serde_json" | 1529 | name = "serde_json" |
1521 | version = "1.0.60" | 1530 | version = "1.0.61" |
1522 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1531 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1523 | checksum = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779" | 1532 | checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" |
1524 | dependencies = [ | 1533 | dependencies = [ |
1525 | "indexmap", | 1534 | "indexmap", |
1526 | "itoa", | 1535 | "itoa", |
@@ -1586,7 +1595,7 @@ dependencies = [ | |||
1586 | "expect-test", | 1595 | "expect-test", |
1587 | "hir", | 1596 | "hir", |
1588 | "ide_db", | 1597 | "ide_db", |
1589 | "itertools", | 1598 | "itertools 0.10.0", |
1590 | "rustc-hash", | 1599 | "rustc-hash", |
1591 | "syntax", | 1600 | "syntax", |
1592 | "test_utils", | 1601 | "test_utils", |
@@ -1599,9 +1608,9 @@ version = "0.0.0" | |||
1599 | 1608 | ||
1600 | [[package]] | 1609 | [[package]] |
1601 | name = "syn" | 1610 | name = "syn" |
1602 | version = "1.0.55" | 1611 | version = "1.0.56" |
1603 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1612 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1604 | checksum = "a571a711dddd09019ccc628e1b17fe87c59b09d513c06c026877aa708334f37a" | 1613 | checksum = "a9802ddde94170d186eeee5005b798d9c159fa970403f1be19976d0cfb939b72" |
1605 | dependencies = [ | 1614 | dependencies = [ |
1606 | "proc-macro2", | 1615 | "proc-macro2", |
1607 | "quote", | 1616 | "quote", |
@@ -1627,7 +1636,7 @@ dependencies = [ | |||
1627 | "arrayvec", | 1636 | "arrayvec", |
1628 | "expect-test", | 1637 | "expect-test", |
1629 | "indexmap", | 1638 | "indexmap", |
1630 | "itertools", | 1639 | "itertools 0.10.0", |
1631 | "once_cell", | 1640 | "once_cell", |
1632 | "parser", | 1641 | "parser", |
1633 | "profile", | 1642 | "profile", |
diff --git a/crates/assists/Cargo.toml b/crates/assists/Cargo.toml index 3fd8327d6..ed8ad666f 100644 --- a/crates/assists/Cargo.toml +++ b/crates/assists/Cargo.toml | |||
@@ -11,7 +11,7 @@ doctest = false | |||
11 | 11 | ||
12 | [dependencies] | 12 | [dependencies] |
13 | rustc-hash = "1.1.0" | 13 | rustc-hash = "1.1.0" |
14 | itertools = "0.9.0" | 14 | itertools = "0.10.0" |
15 | either = "1.6.1" | 15 | either = "1.6.1" |
16 | 16 | ||
17 | stdx = { path = "../stdx", version = "0.0.0" } | 17 | stdx = { path = "../stdx", version = "0.0.0" } |
diff --git a/crates/completion/Cargo.toml b/crates/completion/Cargo.toml index 35e169a28..78e93e78e 100644 --- a/crates/completion/Cargo.toml +++ b/crates/completion/Cargo.toml | |||
@@ -10,7 +10,7 @@ edition = "2018" | |||
10 | doctest = false | 10 | doctest = false |
11 | 11 | ||
12 | [dependencies] | 12 | [dependencies] |
13 | itertools = "0.9.0" | 13 | itertools = "0.10.0" |
14 | log = "0.4.8" | 14 | log = "0.4.8" |
15 | rustc-hash = "1.1.0" | 15 | rustc-hash = "1.1.0" |
16 | either = "1.6.1" | 16 | either = "1.6.1" |
diff --git a/crates/hir/Cargo.toml b/crates/hir/Cargo.toml index 6dc5ad63b..d4ea7327e 100644 --- a/crates/hir/Cargo.toml +++ b/crates/hir/Cargo.toml | |||
@@ -14,7 +14,7 @@ log = "0.4.8" | |||
14 | rustc-hash = "1.1.0" | 14 | rustc-hash = "1.1.0" |
15 | either = "1.5.3" | 15 | either = "1.5.3" |
16 | arrayvec = "0.5.1" | 16 | arrayvec = "0.5.1" |
17 | itertools = "0.9.0" | 17 | itertools = "0.10.0" |
18 | 18 | ||
19 | stdx = { path = "../stdx", version = "0.0.0" } | 19 | stdx = { path = "../stdx", version = "0.0.0" } |
20 | syntax = { path = "../syntax", version = "0.0.0" } | 20 | syntax = { path = "../syntax", version = "0.0.0" } |
diff --git a/crates/hir_def/Cargo.toml b/crates/hir_def/Cargo.toml index a88b5f57e..e8b581e2f 100644 --- a/crates/hir_def/Cargo.toml +++ b/crates/hir_def/Cargo.toml | |||
@@ -17,7 +17,7 @@ either = "1.5.3" | |||
17 | anymap = "0.12.1" | 17 | anymap = "0.12.1" |
18 | drop_bomb = "0.1.4" | 18 | drop_bomb = "0.1.4" |
19 | fst = { version = "0.4", default-features = false } | 19 | fst = { version = "0.4", default-features = false } |
20 | itertools = "0.9.0" | 20 | itertools = "0.10.0" |
21 | indexmap = "1.4.0" | 21 | indexmap = "1.4.0" |
22 | smallvec = "1.4.0" | 22 | smallvec = "1.4.0" |
23 | 23 | ||
diff --git a/crates/hir_def/src/import_map.rs b/crates/hir_def/src/import_map.rs index c4dc894df..30b22f51d 100644 --- a/crates/hir_def/src/import_map.rs +++ b/crates/hir_def/src/import_map.rs | |||
@@ -432,6 +432,7 @@ fn item_import_kind(item: ItemInNs) -> Option<ImportKind> { | |||
432 | mod tests { | 432 | mod tests { |
433 | use base_db::{fixture::WithFixture, SourceDatabase, Upcast}; | 433 | use base_db::{fixture::WithFixture, SourceDatabase, Upcast}; |
434 | use expect_test::{expect, Expect}; | 434 | use expect_test::{expect, Expect}; |
435 | use stdx::format_to; | ||
435 | 436 | ||
436 | use crate::{data::FunctionData, test_db::TestDB, AssocContainerId, Lookup}; | 437 | use crate::{data::FunctionData, test_db::TestDB, AssocContainerId, Lookup}; |
437 | 438 | ||
@@ -467,9 +468,10 @@ mod tests { | |||
467 | if let ItemInNs::Types(ModuleDefId::FunctionId(function_id)) | 468 | if let ItemInNs::Types(ModuleDefId::FunctionId(function_id)) |
468 | | ItemInNs::Values(ModuleDefId::FunctionId(function_id)) = item | 469 | | ItemInNs::Values(ModuleDefId::FunctionId(function_id)) = item |
469 | { | 470 | { |
470 | full_path += &format!( | 471 | format_to!( |
472 | full_path, | ||
471 | "::{}", | 473 | "::{}", |
472 | FunctionData::fn_data_query(&db, function_id).name | 474 | FunctionData::fn_data_query(&db, function_id).name, |
473 | ); | 475 | ); |
474 | } | 476 | } |
475 | full_path | 477 | full_path |
diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml index 965c1780a..2dfccd191 100644 --- a/crates/hir_ty/Cargo.toml +++ b/crates/hir_ty/Cargo.toml | |||
@@ -10,7 +10,7 @@ edition = "2018" | |||
10 | doctest = false | 10 | doctest = false |
11 | 11 | ||
12 | [dependencies] | 12 | [dependencies] |
13 | itertools = "0.9.0" | 13 | itertools = "0.10.0" |
14 | arrayvec = "0.5.1" | 14 | arrayvec = "0.5.1" |
15 | smallvec = "1.2.0" | 15 | smallvec = "1.2.0" |
16 | ena = "0.14.0" | 16 | ena = "0.14.0" |
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 70a3f3075..f2fc69b2f 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -648,6 +648,8 @@ impl<'a> InferenceContext<'a> { | |||
648 | } | 648 | } |
649 | Expr::Array(array) => { | 649 | Expr::Array(array) => { |
650 | let elem_ty = match &expected.ty { | 650 | let elem_ty = match &expected.ty { |
651 | // FIXME: remove when https://github.com/rust-lang/rust/issues/80501 is fixed | ||
652 | #[allow(unreachable_patterns)] | ||
651 | ty_app!(TypeCtor::Array, st) | ty_app!(TypeCtor::Slice, st) => { | 653 | ty_app!(TypeCtor::Array, st) | ty_app!(TypeCtor::Slice, st) => { |
652 | st.as_single().clone() | 654 | st.as_single().clone() |
653 | } | 655 | } |
diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml index 4d483580d..f1544dbe0 100644 --- a/crates/ide/Cargo.toml +++ b/crates/ide/Cargo.toml | |||
@@ -12,7 +12,7 @@ doctest = false | |||
12 | [dependencies] | 12 | [dependencies] |
13 | either = "1.5.3" | 13 | either = "1.5.3" |
14 | indexmap = "1.4.0" | 14 | indexmap = "1.4.0" |
15 | itertools = "0.9.0" | 15 | itertools = "0.10.0" |
16 | log = "0.4.8" | 16 | log = "0.4.8" |
17 | rustc-hash = "1.1.0" | 17 | rustc-hash = "1.1.0" |
18 | oorandom = "11.1.2" | 18 | oorandom = "11.1.2" |
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 038273750..79d126ff2 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs | |||
@@ -199,6 +199,12 @@ fn check_unnecessary_braces_in_use_statement( | |||
199 | ) -> Option<()> { | 199 | ) -> Option<()> { |
200 | let use_tree_list = ast::UseTreeList::cast(node.clone())?; | 200 | let use_tree_list = ast::UseTreeList::cast(node.clone())?; |
201 | if let Some((single_use_tree,)) = use_tree_list.use_trees().collect_tuple() { | 201 | if let Some((single_use_tree,)) = use_tree_list.use_trees().collect_tuple() { |
202 | // If there is a comment inside the bracketed `use`, | ||
203 | // assume it is a commented out module path and don't show diagnostic. | ||
204 | if use_tree_list.has_inner_comment() { | ||
205 | return Some(()); | ||
206 | } | ||
207 | |||
202 | let use_range = use_tree_list.syntax().text_range(); | 208 | let use_range = use_tree_list.syntax().text_range(); |
203 | let edit = | 209 | let edit = |
204 | text_edit_for_remove_unnecessary_braces_with_self_in_use_statement(&single_use_tree) | 210 | text_edit_for_remove_unnecessary_braces_with_self_in_use_statement(&single_use_tree) |
@@ -638,6 +644,22 @@ mod a { | |||
638 | } | 644 | } |
639 | "#, | 645 | "#, |
640 | ); | 646 | ); |
647 | check_no_diagnostics( | ||
648 | r#" | ||
649 | use a; | ||
650 | use a::{ | ||
651 | c, | ||
652 | // d::e | ||
653 | }; | ||
654 | |||
655 | mod a { | ||
656 | mod c {} | ||
657 | mod d { | ||
658 | mod e {} | ||
659 | } | ||
660 | } | ||
661 | "#, | ||
662 | ); | ||
641 | check_fix( | 663 | check_fix( |
642 | r" | 664 | r" |
643 | mod b {} | 665 | mod b {} |
diff --git a/crates/ide_db/Cargo.toml b/crates/ide_db/Cargo.toml index 0ad6e1000..ebe53c8ee 100644 --- a/crates/ide_db/Cargo.toml +++ b/crates/ide_db/Cargo.toml | |||
@@ -19,7 +19,7 @@ fst = { version = "0.4", default-features = false } | |||
19 | rustc-hash = "1.1.0" | 19 | rustc-hash = "1.1.0" |
20 | once_cell = "1.3.1" | 20 | once_cell = "1.3.1" |
21 | either = "1.6.1" | 21 | either = "1.6.1" |
22 | itertools = "0.9.0" | 22 | itertools = "0.10.0" |
23 | 23 | ||
24 | stdx = { path = "../stdx", version = "0.0.0" } | 24 | stdx = { path = "../stdx", version = "0.0.0" } |
25 | syntax = { path = "../syntax", version = "0.0.0" } | 25 | syntax = { path = "../syntax", version = "0.0.0" } |
diff --git a/crates/project_model/Cargo.toml b/crates/project_model/Cargo.toml index c55e85709..a65e42261 100644 --- a/crates/project_model/Cargo.toml +++ b/crates/project_model/Cargo.toml | |||
@@ -16,7 +16,7 @@ cargo_metadata = "=0.12.0" | |||
16 | serde = { version = "1.0.106", features = ["derive"] } | 16 | serde = { version = "1.0.106", features = ["derive"] } |
17 | serde_json = "1.0.48" | 17 | serde_json = "1.0.48" |
18 | anyhow = "1.0.26" | 18 | anyhow = "1.0.26" |
19 | itertools = "0.9.0" | 19 | itertools = "0.10.0" |
20 | 20 | ||
21 | arena = { path = "../arena", version = "0.0.0" } | 21 | arena = { path = "../arena", version = "0.0.0" } |
22 | cfg = { path = "../cfg", version = "0.0.0" } | 22 | cfg = { path = "../cfg", version = "0.0.0" } |
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 53e70eaf7..0a002337b 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -18,7 +18,7 @@ path = "src/bin/main.rs" | |||
18 | anyhow = "1.0.26" | 18 | anyhow = "1.0.26" |
19 | crossbeam-channel = "0.5.0" | 19 | crossbeam-channel = "0.5.0" |
20 | env_logger = { version = "0.8.1", default-features = false } | 20 | env_logger = { version = "0.8.1", default-features = false } |
21 | itertools = "0.9.0" | 21 | itertools = "0.10.0" |
22 | jod-thread = "0.1.0" | 22 | jod-thread = "0.1.0" |
23 | log = "0.4.8" | 23 | log = "0.4.8" |
24 | lsp-types = { version = "0.86.0", features = ["proposed"] } | 24 | lsp-types = { version = "0.86.0", features = ["proposed"] } |
diff --git a/crates/ssr/Cargo.toml b/crates/ssr/Cargo.toml index 98ed25fb6..339eda86a 100644 --- a/crates/ssr/Cargo.toml +++ b/crates/ssr/Cargo.toml | |||
@@ -12,7 +12,7 @@ doctest = false | |||
12 | 12 | ||
13 | [dependencies] | 13 | [dependencies] |
14 | rustc-hash = "1.1.0" | 14 | rustc-hash = "1.1.0" |
15 | itertools = "0.9.0" | 15 | itertools = "0.10.0" |
16 | 16 | ||
17 | text_edit = { path = "../text_edit", version = "0.0.0" } | 17 | text_edit = { path = "../text_edit", version = "0.0.0" } |
18 | syntax = { path = "../syntax", version = "0.0.0" } | 18 | syntax = { path = "../syntax", version = "0.0.0" } |
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml index 21015591c..5d8389ade 100644 --- a/crates/syntax/Cargo.toml +++ b/crates/syntax/Cargo.toml | |||
@@ -11,7 +11,7 @@ edition = "2018" | |||
11 | doctest = false | 11 | doctest = false |
12 | 12 | ||
13 | [dependencies] | 13 | [dependencies] |
14 | itertools = "0.9.0" | 14 | itertools = "0.10.0" |
15 | rowan = "0.10.0" | 15 | rowan = "0.10.0" |
16 | rustc_lexer = { version = "695.0.0", package = "rustc-ap-rustc_lexer" } | 16 | rustc_lexer = { version = "695.0.0", package = "rustc-ap-rustc_lexer" } |
17 | rustc-hash = "1.1.0" | 17 | rustc-hash = "1.1.0" |
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index c45cb514a..2aa472fb4 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs | |||
@@ -193,6 +193,14 @@ impl ast::UseTreeList { | |||
193 | .and_then(ast::UseTree::cast) | 193 | .and_then(ast::UseTree::cast) |
194 | .expect("UseTreeLists are always nested in UseTrees") | 194 | .expect("UseTreeLists are always nested in UseTrees") |
195 | } | 195 | } |
196 | |||
197 | pub fn has_inner_comment(&self) -> bool { | ||
198 | self.syntax() | ||
199 | .children_with_tokens() | ||
200 | .filter_map(|it| it.into_token()) | ||
201 | .find_map(ast::Comment::cast) | ||
202 | .is_some() | ||
203 | } | ||
196 | } | 204 | } |
197 | 205 | ||
198 | impl ast::Impl { | 206 | impl ast::Impl { |
diff --git a/editors/code/package.json b/editors/code/package.json index 13749a084..587f11b90 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -283,6 +283,14 @@ | |||
283 | "default": null, | 283 | "default": null, |
284 | "markdownDescription": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then `#rust-analyzer.updates.channel#` setting is not used" | 284 | "markdownDescription": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then `#rust-analyzer.updates.channel#` setting is not used" |
285 | }, | 285 | }, |
286 | "rust-analyzer.server.extraEnv": { | ||
287 | "type": [ | ||
288 | "null", | ||
289 | "object" | ||
290 | ], | ||
291 | "default": null, | ||
292 | "markdownDescription": "Extra environment variables that will be passed to the rust-analyzer executable. Useful for passing e.g. `RA_LOG` for debugging." | ||
293 | }, | ||
286 | "rust-analyzer.trace.server": { | 294 | "rust-analyzer.trace.server": { |
287 | "type": "string", | 295 | "type": "string", |
288 | "scope": "window", | 296 | "scope": "window", |
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 63ab82dde..539e487ec 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts | |||
@@ -6,6 +6,10 @@ import { DocumentSemanticsTokensSignature, DocumentSemanticsTokensEditsSignature | |||
6 | import { assert } from './util'; | 6 | import { assert } from './util'; |
7 | import { WorkspaceEdit } from 'vscode'; | 7 | import { WorkspaceEdit } from 'vscode'; |
8 | 8 | ||
9 | export interface Env { | ||
10 | [name: string]: string; | ||
11 | } | ||
12 | |||
9 | function renderCommand(cmd: ra.CommandLink) { | 13 | function renderCommand(cmd: ra.CommandLink) { |
10 | return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip!}')`; | 14 | return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip!}')`; |
11 | } | 15 | } |
@@ -27,14 +31,17 @@ async function semanticHighlightingWorkaround<R, F extends (...args: any[]) => v | |||
27 | return res; | 31 | return res; |
28 | } | 32 | } |
29 | 33 | ||
30 | export function createClient(serverPath: string, cwd: string): lc.LanguageClient { | 34 | export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc.LanguageClient { |
31 | // '.' Is the fallback if no folder is open | 35 | // '.' Is the fallback if no folder is open |
32 | // TODO?: Workspace folders support Uri's (eg: file://test.txt). | 36 | // TODO?: Workspace folders support Uri's (eg: file://test.txt). |
33 | // It might be a good idea to test if the uri points to a file. | 37 | // It might be a good idea to test if the uri points to a file. |
34 | 38 | ||
39 | const newEnv = Object.assign({}, process.env); | ||
40 | Object.assign(newEnv, extraEnv); | ||
41 | |||
35 | const run: lc.Executable = { | 42 | const run: lc.Executable = { |
36 | command: serverPath, | 43 | command: serverPath, |
37 | options: { cwd }, | 44 | options: { cwd, env: newEnv }, |
38 | }; | 45 | }; |
39 | const serverOptions: lc.ServerOptions = { | 46 | const serverOptions: lc.ServerOptions = { |
40 | run, | 47 | run, |
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 848e92af9..fe9f3b4a8 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import { Env } from './client'; | ||
2 | import { log } from "./util"; | 3 | import { log } from "./util"; |
3 | 4 | ||
4 | export type UpdatesChannel = "stable" | "nightly"; | 5 | export type UpdatesChannel = "stable" | "nightly"; |
@@ -13,6 +14,7 @@ export class Config { | |||
13 | readonly rootSection = "rust-analyzer"; | 14 | readonly rootSection = "rust-analyzer"; |
14 | private readonly requiresReloadOpts = [ | 15 | private readonly requiresReloadOpts = [ |
15 | "serverPath", | 16 | "serverPath", |
17 | "server", | ||
16 | "cargo", | 18 | "cargo", |
17 | "procMacro", | 19 | "procMacro", |
18 | "files", | 20 | "files", |
@@ -92,6 +94,7 @@ export class Config { | |||
92 | } | 94 | } |
93 | 95 | ||
94 | get serverPath() { return this.get<null | string>("serverPath"); } | 96 | get serverPath() { return this.get<null | string>("serverPath"); } |
97 | get serverExtraEnv() { return this.get<Env | null>("server.extraEnv") ?? {}; } | ||
95 | get channel() { return this.get<UpdatesChannel>("updates.channel"); } | 98 | get channel() { return this.get<UpdatesChannel>("updates.channel"); } |
96 | get askBeforeDownload() { return this.get<boolean>("updates.askBeforeDownload"); } | 99 | get askBeforeDownload() { return this.get<boolean>("updates.askBeforeDownload"); } |
97 | get traceExtension() { return this.get<boolean>("trace.extension"); } | 100 | get traceExtension() { return this.get<boolean>("trace.extension"); } |
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index d39864d33..e7585184b 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts | |||
@@ -24,7 +24,7 @@ export class Ctx { | |||
24 | serverPath: string, | 24 | serverPath: string, |
25 | cwd: string, | 25 | cwd: string, |
26 | ): Promise<Ctx> { | 26 | ): Promise<Ctx> { |
27 | const client = createClient(serverPath, cwd); | 27 | const client = createClient(serverPath, cwd, config.serverExtraEnv); |
28 | 28 | ||
29 | const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); | 29 | const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); |
30 | extCtx.subscriptions.push(statusBar); | 30 | extCtx.subscriptions.push(statusBar); |