Commit graph

472 commits

Author SHA1 Message Date
Kirill Bulatov
a631108d2d Do not query item search by name eagerly 2021-03-20 22:33:54 +02:00
Kirill Bulatov
81961dc035 Do not propose assoc items without qualifiers 2021-03-20 22:18:43 +02:00
Jonas Schievink
c05a1a6e37 Store an AstId for procedural macros 2021-03-18 16:11:18 +01:00
Lukas Wirth
ec824a92d0 Better handling of block doc comments 2021-03-17 14:48:57 +01:00
Matthias Krüger
048dad8c2e don't clone types that are copy (clippy::clone_on_copy) 2021-03-17 01:56:31 +01:00
Matthias Krüger
966c23f529 avoid converting types into themselves via .into() (clippy::useless-conversion)
example: let x: String = String::from("hello world").into();
2021-03-17 01:27:56 +01:00
bors[bot]
b4ed3e1551
Merge #8052
8052: minor style fixes per feedback on #8036 r=JoshMcguigan a=JoshMcguigan

cc @matklad  - this PR addresses your comments in #8036. 

changelog fixup #8036

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2021-03-16 13:56:53 +00:00
Josh Mcguigan
81f51fcd65 minor style fixes per feedback on #8036 2021-03-16 06:54:17 -07:00
bors[bot]
da5328a01b
Merge #8051
8051: Fix more unused wariable warnings r=lnicola a=lnicola

bors r+

changelog skip

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-16 13:35:26 +00:00
Laurențiu Nicola
a7cf976c63 Fix more unused wariable warnings 2021-03-16 15:34:19 +02:00
bors[bot]
c49b5b7468
Merge #7498
7498: Clone for update r=matklad a=matklad

rowan counterpart https://github.com/rust-analyzer/rowan/pull/93

#6857

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-16 13:14:48 +00:00
Aleksey Kladov
f5a81ec468 Upgrade rowan
Notably, new rowan comes with support for mutable syntax trees.
2021-03-16 16:10:49 +03:00
bors[bot]
1a82af3527
Merge #7900 #8000
7900: show function params in completion detail r=matklad a=JoshMcguigan

This resolves #7842 by updating the detail for function completions from `-> T` to `fn(T, U) -> V`. I added an expicit unit test for this, `ide_completion::render::fn_detail_includes_args_and_return_type`, which passes.

Lots of other unit tests fail (~60 of them) due to this change, although I believe the failures are purely cosmetic (they were testing the exact format of this output). I'm happy to go update those tests, but before I do that I'd like to make sure this is in fact the format we want for the detail?

edit - I realized `UPDATE_EXPECT=1 cargo test` automatically updates `expect!` tests. Big 👍 to whoever worked on that! So I'll go ahead and update all these tests soon. But I still would like to confirm `fn(T, U) -> V` is the desired content in the `detail` field. 

8000: Use hir formatter for hover text r=matklad a=oxalica

Fix #2765 , (should) fix #4665

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
Co-authored-by: oxalica <oxalicc@pm.me>
2021-03-16 08:05:24 +00:00
Josh Mcguigan
405bbb3aa4 completions: centralize calculation of relevance and ref matches 2021-03-15 19:40:42 -07:00
bors[bot]
ce3125165a
Merge #8035
8035: unqualfied_path completions aren't responsible for variant pattern completions r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-15 16:51:53 +00:00
Lukas Wirth
4a0ab832f3 unqualfied_path completions aren't responsible for pattern completions 2021-03-15 17:23:08 +01:00
Josh Mcguigan
db8bcf132c implement function completion scoring 2021-03-15 08:35:28 -07:00
Laurențiu Nicola
e941cb0238 Drop non-working mark 2021-03-15 16:05:16 +02:00
Laurențiu Nicola
88cee24c6c Enable thread-local coverage marks 2021-03-15 16:02:50 +02:00
Josh Mcguigan
67d59aeb7c remove expected_name_and_type method on completion context in favor of using fields added in #8008 2021-03-15 06:25:39 -07:00
Josh Mcguigan
d91151c3b1 update algorithm for determining expected type of completion 2021-03-15 05:38:19 -07:00
Matthias Krüger
cad617bba0 some clippy::performance fixes
use vec![] instead of Vec::new() +  push()
avoid redundant clones
use chars instead of &str for single char patterns in ends_with() and starts_with()
allocate some Vecs with capacity to avoid unneccessary resizing
2021-03-15 10:19:59 +01:00
Josh Mcguigan
ba924d04b3 increase completion relevance for items in local scope 2021-03-14 08:00:47 -07:00
ivan770
8a9ebe62a1
Skip ref_match on same types, remove sorting in tests 2021-03-14 12:25:37 +02:00
ivan770
661cc7f0c8
Added both references and original matches to tests 2021-03-13 18:31:52 +02:00
ivan770
32ad929b82
Fix incorrect DerefMut test reference type 2021-03-13 17:28:05 +02:00
ivan770
3bc5d81a33
Make relevance tests display references, suggest derefs only when needed 2021-03-13 17:25:41 +02:00
ivan770
75cb441fba
Simplify call site and deref completion test 2021-03-13 15:32:37 +02:00
ivan770
d064ed5f63
Count derefs as matched types if possible 2021-03-13 14:34:11 +02:00
Josh Mcguigan
d5f0f58e63 add params_display and ty_display 2021-03-12 13:46:40 -08:00
Josh Mcguigan
53bb46fa85 show function params in completion detail 2021-03-12 13:36:13 -08:00
Josh Mcguigan
acbe297fbd update relevance score u8 -> u32 2021-03-12 06:16:04 -08:00
Josh Mcguigan
10fb065b14 add relevance score test 2021-03-12 06:16:04 -08:00
Josh Mcguigan
9ee3914c61 remove unused CompletionScore enum 2021-03-12 06:16:04 -08:00
Josh Mcguigan
3679821eea add completion relevance score 2021-03-12 06:16:01 -08:00
Aleksey Kladov
7e217a42e1 Unify naming 2021-03-12 12:22:45 +03:00
yonip23
99c4a41cd1 use references in CompletionItem's builder 2021-03-11 17:46:41 +02:00
Aleksey Kladov
842d8ad9c8 Compilation speed 2021-03-09 22:30:58 +03:00
Aleksey Kladov
b2764a6641 Future proof completion scores 2021-03-09 20:24:09 +03:00
Aleksey Kladov
12fe301a0c Cleanup auto-ref in completion 2021-03-09 18:06:08 +03:00
Aleksey Kladov
abc0ed36bd Cleanup 2021-03-09 17:44:27 +03:00
Aleksey Kladov
444d67ae18 Cleanup 2021-03-09 17:42:05 +03:00
bors[bot]
21913d0fdb
Merge #7873 #7933
7873: Consider unresolved qualifiers during flyimport r=matklad a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/7679

Takes unresolved qualifiers into account, providing better completions (or none, if the path is resolved or do not match).

Does not handle cases when both path qualifier and some trait has to be imported: there are many extra issues with those (such as overlapping imports, for instance) that will require large diffs to address.

Also does not do a fuzzy search on qualifier, that requires some adjustments in `import_map` for better queries and changes to the default replace range which also seems relatively big to include here.

![qualifier_completion](https://user-images.githubusercontent.com/2690773/110040808-0af8dc00-7d4c-11eb-83db-65af94e843bb.gif)


7933: Improve compilation speed r=matklad a=matklad

bors r+
🤖

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-09 11:58:48 +00:00
Duong Do Minh Chau
73590f0f0b
Fix format 2021-03-09 16:38:07 +07:00
Duong Do Minh Chau
a068cedee0
Add trailing commas 2021-03-09 16:00:06 +07:00
Duong Do Minh Chau
ea835fc800
Update the test to match the change 2021-03-09 15:48:53 +07:00
Duong Do Minh Chau
5fc91058ff
Add completion to turn x.err into Err(x) 2021-03-09 15:36:41 +07:00
Kirill Bulatov
dccbb38d2e Less lifetines: derive SemanticsScope in place 2021-03-08 23:59:20 +02:00
Kirill Bulatov
db61d4ea13 Rebase leftovers 2021-03-08 23:59:20 +02:00
Kirill Bulatov
c56b59d377 Cleanup 2021-03-08 23:59:20 +02:00
Kirill Bulatov
84c575a212 Restrict fuzzy qualifiers for now 2021-03-08 23:59:20 +02:00
Kirill Bulatov
6ca6f101c1 Test for fuzzy unresolved path maatch 2021-03-08 23:59:20 +02:00
Kirill Bulatov
24a5d3b19d Fix the completion labels and tests 2021-03-08 23:59:20 +02:00
Kirill Bulatov
33c83e72b9 Work towards better import labels 2021-03-08 23:59:20 +02:00
Kirill Bulatov
821e8369d9 Update the docs 2021-03-08 23:59:20 +02:00
Kirill Bulatov
e214c3a6bd Simplify 2021-03-08 23:59:20 +02:00
Kirill Bulatov
e74c55bb4a Refactor the import location 2021-03-08 23:59:20 +02:00
Kirill Bulatov
89d410cef5 Do not propose already imported imports 2021-03-08 23:59:20 +02:00
Kirill Bulatov
9482353fa8 Properly handle turbofishes in qualifiers 2021-03-08 23:59:20 +02:00
Kirill Bulatov
d386481fac Fix some tests 2021-03-08 23:59:20 +02:00
Kirill Bulatov
582cee2cdf Return more data about located imports 2021-03-08 23:59:18 +02:00
Kirill Bulatov
309421c117 Draft the qualifier import resolution 2021-03-08 23:58:48 +02:00
Kirill Bulatov
005bc49d74 Test and initial refactoring 2021-03-08 23:58:32 +02:00
Laurențiu Nicola
fc9eed4836 Use upstream cov-mark 2021-03-08 22:19:44 +02:00
asv
96fc01a30b Make group imports configurable 2021-03-07 10:15:17 +02:00
Lukas Wirth
02e9440e23 Complete while let 2021-03-03 23:04:11 +01:00
Lukas Wirth
1914b7723f Don't complete super unless its valid in paths 2021-03-03 21:58:48 +01:00
Laurențiu Nicola
0fb01367f5 Format generated features manually instead of relying on rustfmt 2021-02-27 16:25:06 +02:00
Jonas Schievink
cf456d72db Add test 2021-02-23 14:54:01 +01:00
Benjamin Coenen
cf32dbd9bf feat(completion): add doc(hidden) completion for attributes
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-02-20 15:16:05 +01:00
Kirill Bulatov
4fe5786c0c Consider import prefix config settings during flyimports 2021-02-20 13:53:50 +02:00
Aleksey Kladov
3db64a400c rename completion -> ide_completion
We don't have completion-related PRs in flight, so lets do it
2021-02-17 17:53:31 +03:00