aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ide/src/references.rs9
-rw-r--r--crates/ide/src/references/rename.rs9
-rw-r--r--crates/rust-analyzer/tests/rust-analyzer/main.rs16
-rw-r--r--crates/rust-analyzer/tests/rust-analyzer/support.rs10
-rw-r--r--editors/code/README.md28
5 files changed, 69 insertions, 3 deletions
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index 5d0449e56..fef70533d 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -39,6 +39,15 @@ pub struct Declaration {
39 pub access: Option<ReferenceAccess>, 39 pub access: Option<ReferenceAccess>,
40} 40}
41 41
42// Feature: Find All References
43//
44// Shows all references of the item at the cursor location
45//
46// |===
47// | Editor | Shortcut
48//
49// | VS Code | kbd:[Shift+Alt+F12]
50// |===
42pub(crate) fn find_all_refs( 51pub(crate) fn find_all_refs(
43 sema: &Semantics<RootDatabase>, 52 sema: &Semantics<RootDatabase>,
44 position: FilePosition, 53 position: FilePosition,
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs
index 175ddd759..22ddeeae3 100644
--- a/crates/ide/src/references/rename.rs
+++ b/crates/ide/src/references/rename.rs
@@ -59,6 +59,15 @@ pub(crate) fn prepare_rename(
59 Ok(RangeInfo::new(range, ())) 59 Ok(RangeInfo::new(range, ()))
60} 60}
61 61
62// Feature: Rename
63//
64// Renames the item below the cursor and all of its references
65//
66// |===
67// | Editor | Shortcut
68//
69// | VS Code | kbd:[F2]
70// |===
62pub(crate) fn rename( 71pub(crate) fn rename(
63 db: &RootDatabase, 72 db: &RootDatabase,
64 position: FilePosition, 73 position: FilePosition,
diff --git a/crates/rust-analyzer/tests/rust-analyzer/main.rs b/crates/rust-analyzer/tests/rust-analyzer/main.rs
index 391a0b60d..7545b4a34 100644
--- a/crates/rust-analyzer/tests/rust-analyzer/main.rs
+++ b/crates/rust-analyzer/tests/rust-analyzer/main.rs
@@ -54,6 +54,9 @@ version = "0.0.0"
54use std::collections::Spam; 54use std::collections::Spam;
55"#, 55"#,
56 ) 56 )
57 .with_config(serde_json::json!({
58 "cargo": { "noSysroot": false }
59 }))
57 .server() 60 .server()
58 .wait_until_workspace_is_loaded(); 61 .wait_until_workspace_is_loaded();
59 62
@@ -450,6 +453,9 @@ fn main() {{}}
450"#, 453"#,
451 librs, libs 454 librs, libs
452 )) 455 ))
456 .with_config(serde_json::json!({
457 "cargo": { "noSysroot": false }
458 }))
453 .server() 459 .server()
454 .wait_until_workspace_is_loaded(); 460 .wait_until_workspace_is_loaded();
455 461
@@ -572,7 +578,10 @@ fn main() {
572"###, 578"###,
573 ) 579 )
574 .with_config(serde_json::json!({ 580 .with_config(serde_json::json!({
575 "cargo": { "loadOutDirsFromCheck": true } 581 "cargo": {
582 "loadOutDirsFromCheck": true,
583 "noSysroot": true,
584 }
576 })) 585 }))
577 .server() 586 .server()
578 .wait_until_workspace_is_loaded(); 587 .wait_until_workspace_is_loaded();
@@ -715,7 +724,10 @@ pub fn foo(_input: TokenStream) -> TokenStream {
715"###, 724"###,
716 ) 725 )
717 .with_config(serde_json::json!({ 726 .with_config(serde_json::json!({
718 "cargo": { "loadOutDirsFromCheck": true }, 727 "cargo": {
728 "loadOutDirsFromCheck": true,
729 "noSysroot": true,
730 },
719 "procMacro": { 731 "procMacro": {
720 "enable": true, 732 "enable": true,
721 "server": PathBuf::from(env!("CARGO_BIN_EXE_rust-analyzer")), 733 "server": PathBuf::from(env!("CARGO_BIN_EXE_rust-analyzer")),
diff --git a/crates/rust-analyzer/tests/rust-analyzer/support.rs b/crates/rust-analyzer/tests/rust-analyzer/support.rs
index 726d555e4..6b774073d 100644
--- a/crates/rust-analyzer/tests/rust-analyzer/support.rs
+++ b/crates/rust-analyzer/tests/rust-analyzer/support.rs
@@ -27,7 +27,15 @@ pub(crate) struct Project<'a> {
27 27
28impl<'a> Project<'a> { 28impl<'a> Project<'a> {
29 pub(crate) fn with_fixture(fixture: &str) -> Project { 29 pub(crate) fn with_fixture(fixture: &str) -> Project {
30 Project { fixture, tmp_dir: None, roots: vec![], config: serde_json::Value::Null } 30 Project {
31 fixture,
32 tmp_dir: None,
33 roots: vec![],
34 config: serde_json::json!({
35 // Loading standard library is costly, let's ignore it by default
36 "cargo": { "noSysroot": true }
37 }),
38 }
31 } 39 }
32 40
33 pub(crate) fn tmp_dir(mut self, tmp_dir: TestDir) -> Project<'a> { 41 pub(crate) fn tmp_dir(mut self, tmp_dir: TestDir) -> Project<'a> {
diff --git a/editors/code/README.md b/editors/code/README.md
index 336695d9f..e7d7a06f0 100644
--- a/editors/code/README.md
+++ b/editors/code/README.md
@@ -2,4 +2,32 @@
2 2
3Provides support for rust-analyzer: novel LSP server for the Rust programming language. 3Provides support for rust-analyzer: novel LSP server for the Rust programming language.
4 4
5
6Features:
7
8* [code completion], [imports insertion]
9* [go to definition], [implementation], [type definition]
10* [find all references], [workspace symbol search], [rename]
11* [types and documentation on hover]
12* [inlay hints]
13* [semantic syntax highlighting]
14* a lot of [assist(code actions)]
15* apply suggestions from errors
16* ... and many more, checkout the [manual] to see them all
17
18[code completion]: https://rust-analyzer.github.io/manual.html#magic-completions
19[imports insertion]: https://rust-analyzer.github.io/manual.html#auto-import
20[go to definition]: https://rust-analyzer.github.io/manual.html#go-to-definition
21[implementation]: https://rust-analyzer.github.io/manual.html#go-to-implementation
22[type definition]: https://rust-analyzer.github.io/manual.html#go-to-type-definition
23[find all references]: https://rust-analyzer.github.io/manual.html#find-all-references
24[workspace symbol search]: https://rust-analyzer.github.io/manual.html#workspace-symbol
25[rename]: https://rust-analyzer.github.io/manual.html#rename
26[types and documentation on hover]: https://rust-analyzer.github.io/manual.html#hover
27[inlay hints]: https://rust-analyzer.github.io/manual.html#inlay-hints
28[semantic syntax highlighting]: https://rust-analyzer.github.io/manual.html#semantic-syntax-highlighting
29[assist(code actions)]: https://rust-analyzer.github.io/manual.html#assists-code-actions
30
31[manual]: https://rust-analyzer.github.io/manual.html
32
5See https://rust-analyzer.github.io/ for more information. 33See https://rust-analyzer.github.io/ for more information.