Commit Graph

72 Commits

Author SHA1 Message Date
Nick Spain
49eeeb61ae Add a test for correct completion of ..Default::default() 2021-01-01 11:10:22 +11:00
Nick Spain
4cc3a6d4fe Fix completion of Default struct update syntax
Previously the inserted text was always `..Default::default()` which ends up as `...Default::default()`
if `.` was typed. Now  checks if the current token is `.` and inserts `.Default::default()`
if it is, so `..Default::default()` is correctly completed.

Fixes #6969
2020-12-31 16:23:05 +11:00
Laurențiu Nicola
42c24ff25f Avoid a couple of allocations 2020-12-29 14:35:49 +02:00
bors[bot]
ef1177c5b5
Merge #7064
7064: Ignore qualifiers when doing autoimport completions lookup r=lnicola a=SomeoneToIgnore

A follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/6918#issuecomment-748511151 and the PR itself.

Tweaks the `import_map` query api to be more flexible with the ways to match against the import path and now fuzzy imports search in names only.
This had improved the completion speed for me locally in ~5 times for `fuzzy_completion` span time, but please recheck me here.

IMO we're fast and presice enough now, so I've added the modules back to the fuzzy search output.

Also tweaks the the expect tests to display functions explicitly, to avoid confusing "duplicate" results.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-12-29 12:19:31 +00:00
bors[bot]
7b246a6a14
Merge #7076
7076: Properly parse path separators in format-like postfix r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-29 12:12:19 +00:00
Lukas Wirth
ddc25d87ca Properly parse path separators in format-like postfix 2020-12-29 13:10:35 +01:00
Lukas Wirth
20bd4ddd4e format-postfix completion takes format instead of fmt 2020-12-29 12:28:46 +01:00
Kirill Bulatov
77b4a1c5ef Tweak the fuzzy search limits 2020-12-28 16:37:51 +02:00
Kirill Bulatov
e4c3f753d2 Add docs and optimisations 2020-12-28 15:09:39 +02:00
Kirill Bulatov
c4995cfbd5 Better query api and fuzzy search 2020-12-28 15:06:10 +02:00
Kirill Bulatov
0e48cd0c3c Draft the module exclusion in modules 2020-12-28 15:06:10 +02:00
bors[bot]
ee06096b0c
Merge #6960
6960: Show enum variant on Self qualified paths r=matklad a=Veykril

Fixes first part of #6549
Fixes #6550

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-23 09:48:04 +00:00
Lukas Wirth
83121efcd5 Reduce some more code duplication 2020-12-22 19:00:38 +01:00
Lukas Wirth
2cd2947bf8 Insert snippet positions after fields names in record patterns 2020-12-21 15:10:27 +01:00
Lukas Wirth
2f6a24950a Emit snippets for struct pattern completion if enabled 2020-12-20 19:16:28 +01:00
Lukas Wirth
b184bfad7a Add completions for patterns 2020-12-20 18:19:23 +01:00
Lukas Wirth
15a52f69d9 Show enum variant completions for ref scrutinee 2020-12-20 12:32:53 +01:00
Lukas Wirth
943e4faceb Show enum variant on Self qualified paths 2020-12-20 12:31:59 +01:00
Aleksey Kladov
f6ed16674c Align code_model name with ungrammar 2020-12-20 10:05:24 +03:00
Kirill Bulatov
b45ec84739 Fewer allocations 2020-12-19 20:42:16 +02:00
Kirill Bulatov
0415dcd832 Tidy up 2020-12-19 14:13:27 +02:00
Kirill Bulatov
8c292e3cc5 Keep the original completion order in tests 2020-12-19 13:18:40 +02:00
Kirill Bulatov
5fa078f26f Add a slightly better fuzzy search heuristics 2020-12-19 12:54:17 +02:00
Kirill Bulatov
9d2cbf05e3 Show first fuzzy completions fully containing the input 2020-12-17 23:10:18 +02:00
Jeremy Kolb
26a1675764 Remove some redundant allocations 2020-12-12 12:27:09 -05:00
Aleksey Kladov
e179ed6f53 Use natural trait ordering in derive completion
derive(Clone, Copy) reads better than derive(Copy, Clone).

However, we preserve the reverse ordering in the lookup text for
sorting purposes. That way, it's convenient to type just `Ord` to
derive everything.
2020-12-11 15:45:53 +03:00
Aleksey Kladov
78de7f0d4a Remove debug print 2020-12-10 18:30:49 +03:00
Aleksey Kladov
076945e47c Minor, more orthogonal code
It's better to accept things as arguments rather than store them.
2020-12-10 18:01:02 +03:00
Aleksey Kladov
17f236c2b0 Normalize spelling to American English 2020-12-10 17:51:56 +03:00
Kirill Bulatov
bf24cb3e8d Tweak the search query params for better lookup speed 2020-12-08 15:05:09 +02:00
Kirill Bulatov
cbd3717f2c Better config name 2020-12-08 14:27:18 +02:00
Kirill Bulatov
3183ff3a7b Disable the completion for no corresponding client resolve capabilities 2020-12-08 01:07:20 +02:00
Kirill Bulatov
9656ceb896 Document the feature 2020-12-07 23:41:08 +02:00
Kirill Bulatov
077c1c3c1f Less panic, more tests 2020-12-07 23:41:08 +02:00
Kirill Bulatov
deda74edd8 Use stateless completion resolve 2020-12-07 23:41:08 +02:00
Lukas Wirth
2ff1ebe8f3 Update attributes completion list 2020-12-06 16:46:24 +01:00
Aleksey Kladov
21d962f0ac Trigger .let postfix snippet in the middle of the block 2020-12-01 15:38:06 +03:00
Aleksey Kladov
9d94ffad44 Place cursor correctly when completing assoc fns with self 2020-12-01 14:28:50 +03:00
Aleksey Kladov
6f51f728a1 Type-safer API for dealing with parameter lists with optional self 2020-12-01 13:53:39 +03:00
bors[bot]
f8726d781a
Merge #6601
6601: add let and letm postfix to turn expressions into variables r=matklad a=bnjjj

Partially resolve #6426 

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-11-29 19:21:25 +00:00
Benjamin Coenen
474ebd60d1 add let and letm postfix to turn expressions into variables
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-11-28 17:38:16 +01:00
Kirill Bulatov
3f612d37c6 Move the helpers into ide_db 2020-11-28 16:30:39 +02:00
Kirill Bulatov
f4ae3650d8 Extract the import code into the shared module 2020-11-27 18:28:41 +02:00
bors[bot]
fc0354b280
Merge #6635
6635: Complete struct in irrefutable let r=Veykril a=Veykril

Fixes #6210

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-26 20:30:16 +00:00
Lukas Wirth
ee06c07f50 Complete struct in irrefutable let 2020-11-26 21:28:43 +01:00
bors[bot]
db6988d4e7
Merge #6614 #6632
6614: Improve autoimports on completion speed r=matklad a=SomeoneToIgnore

Presumably closes https://github.com/rust-analyzer/rust-analyzer/issues/6594
May help https://github.com/rust-analyzer/rust-analyzer/issues/6612

* Ignore modules eaferly
* Do less completion string rendering

6632: Pin cargo_metadata r=matklad a=kjeremy

See: https://github.com/oli-obk/cargo_metadata/pull/142#issuecomment-733653275

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-26 10:43:35 +00:00
Kirill Bulatov
4c95c6e25d Gate autoimports begind experimental completions flag 2020-11-25 00:30:28 +02:00
Kirill Bulatov
4baac238a8 Improve autoimports on completion speed
* Ignore modules eaferly
* Do less completion string rendering
2020-11-24 02:28:45 +02:00
Benjamin Coenen
775c69183c add let and letm postfix to turn expressions into variables
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-11-21 15:06:22 +01:00
Kirill Bulatov
d4128beb3d Avoid turning completion objects into builders 2020-11-16 23:16:41 +02:00