diff options
author | Aleksey Kladov <[email protected]> | 2019-12-22 19:12:23 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-22 21:41:21 +0000 |
commit | e424545c0f5cbaf135c52764169ea20df7d07d35 (patch) | |
tree | 86f6d29653ba7e548f2a321b2ecdb20e7dc366f4 /crates/ra_ide | |
parent | 7c405c01567e814f18ebf8bdc6aa1f8f694919f0 (diff) |
Rudimentary name resolution for local items
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/completion/complete_scope.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/ra_ide/src/completion/complete_scope.rs b/crates/ra_ide/src/completion/complete_scope.rs index d5739b58a..458d7525e 100644 --- a/crates/ra_ide/src/completion/complete_scope.rs +++ b/crates/ra_ide/src/completion/complete_scope.rs | |||
@@ -873,4 +873,41 @@ mod tests { | |||
873 | "### | 873 | "### |
874 | ); | 874 | ); |
875 | } | 875 | } |
876 | |||
877 | #[test] | ||
878 | fn completes_local_item() { | ||
879 | assert_debug_snapshot!( | ||
880 | do_reference_completion( | ||
881 | " | ||
882 | //- /main.rs | ||
883 | fn main() { | ||
884 | return f<|>; | ||
885 | fn frobnicate() {} | ||
886 | } | ||
887 | " | ||
888 | ), | ||
889 | @r###" | ||
890 | [ | ||
891 | CompletionItem { | ||
892 | label: "frobnicate()", | ||
893 | source_range: [23; 24), | ||
894 | delete: [23; 24), | ||
895 | insert: "frobnicate()$0", | ||
896 | kind: Function, | ||
897 | lookup: "frobnicate", | ||
898 | detail: "fn frobnicate()", | ||
899 | }, | ||
900 | CompletionItem { | ||
901 | label: "main()", | ||
902 | source_range: [23; 24), | ||
903 | delete: [23; 24), | ||
904 | insert: "main()$0", | ||
905 | kind: Function, | ||
906 | lookup: "main", | ||
907 | detail: "fn main()", | ||
908 | }, | ||
909 | ] | ||
910 | "### | ||
911 | ) | ||
912 | } | ||
876 | } | 913 | } |