Commit Graph

593 Commits

Author SHA1 Message Date
Jonas Schievink
a182156517 Add trailing ; when completing assoc const/type 2022-04-12 18:28:43 +02:00
Jonas Schievink
3328a0a11b Fix trait impl completions' lookup_by text 2022-04-12 17:17:31 +02:00
Jonas Schievink
e66037f139 simplify 2022-04-12 15:34:12 +02:00
Jonas Schievink
63f87ff047 Deprioritize already-imported names 2022-04-11 18:48:27 +02:00
Jonas Schievink
22b13c8bff Make trait item completions work in a bare impl and score them 2022-04-08 19:56:41 +02:00
Jonas Schievink
99d91bc550 flyimport: omit types when completing where-clause 2022-04-07 20:02:33 +02:00
Jonas Schievink
5d8b4c40eb Determine function unsafety semantically 2022-04-07 18:33:03 +02:00
bors[bot]
f5c069c9d9
Merge #11894
11894: complete pattern args based on type name r=Veykril a=cameron1024

Addresses #11892 

Changes function argument completion to cover a case like this:
```rust
struct Foo { bar: i32 }

fn qux(Foo { bar }: Foo) {
  println!("{bar}");
}
```
When completing the function call for `qux`, instead of expanding to `qux(_)`, it will now expand to `qux(foo)` (based on the snake-cased version of the name of the ADT)

Non ADTs are unaffected


Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: cameron1024 <cameron.studdstreet@gmail.com>
2022-04-04 13:06:51 +00:00
cameron1024
37d2a8243f
Update crates/ide_completion/src/render/function.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-04 13:33:14 +01:00
cameron
bb1c3a20b5 fix type error 2022-04-04 14:30:49 +01:00
cameron
2137bdfca3 remove unwarp on adt name 2022-04-04 14:28:15 +01:00
cameron
c735b979ed complete pattern args based on type name 2022-04-04 13:51:51 +01:00
Aleksey Kladov
a8f460209d add test for postfix completion relevance
Follow up to #11857, add a test and cov-marks
2022-04-03 12:13:26 +01:00
hkalbasi
003a6b74e4 suggest infered type in auto complete 2022-04-03 11:17:33 +04:30
Lukas Wirth
f610e2c2ed Simplify completion import insertion 2022-04-02 01:42:21 +02:00
Lukas Wirth
28251e486c Cleanup relevance scoring 2022-04-02 01:19:33 +02:00
bors[bot]
a9ae0b0855
Merge #11857
11857: Lower postfix suggestions in completions list r=Veykril a=avrong

Fixes #11850

Adds a parameter for postfix suggestions in `CompletionRelevance`, and basing on it, decreases relevance score of such items in completion list

Co-authored-by: Aleksei Trifonov <avrong@avrong.me>
2022-04-01 21:42:54 +00:00
Aleksei Trifonov
eda4046a05 Introduce postfix item types 2022-04-01 20:50:27 +03:00
Lukas Wirth
75689f2ad8 internal: Enforce Resolver to always have a module scope 2022-03-31 11:12:08 +02:00
Aleksei Trifonov
41d8369d1c Fix formatting 2022-03-31 02:59:15 +03:00
Aleksei Trifonov
0d1f4f9b27 Lower postfix suggestions in completions list 2022-03-31 02:27:33 +03:00
Lukas Wirth
ef92453dfe internal: Refactor FamousDefs builtin crate search 2022-03-30 22:23:54 +02:00
Florian Diebold
9a427839fa fix: Disable ref_match for qualified paths as well
I.e. don't suggest `Foo::&foo()`.

CC #8058.
2022-03-27 12:50:55 +02:00
Lukas Wirth
9b046d1051 fix: Don't complete Drop::drop for qualified paths 2022-03-26 18:46:49 +01:00
bors[bot]
652233283b
Merge #11791
11791: fix: some fixes and improvements to signature help r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-23 00:36:11 +00:00
bors[bot]
c2ea378920
Merge #11795
11795: fix: Correctly suggest auto importing traits from aliases r=Veykril a=unexge

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11506

Co-authored-by: unexge <unexge@gmail.com>
2022-03-22 21:44:06 +00:00
unexge
4e4c9ea4ac fix: Correctly suggest auto importing traits from aliases 2022-03-22 22:30:29 +01:00
Lukas Wirth
8e91bb7660 minor: Bump dependencies 2022-03-22 17:42:24 +01:00
Jonas Schievink
b7cc9a7275 Trigger call info when completing generic type
Closes #11763
2022-03-22 16:10:17 +01:00
Lukas Wirth
000e681d5f fix: Fix tuple- and record struct completions not working with existing braces 2022-03-21 22:01:26 +01:00
Lukas Wirth
7370a6b5b8 fix: Fix flyimport showing functions in pattern position 2022-03-21 19:41:39 +01:00
Jonas Schievink
14203c6378 Complete assoc const patterns on builtin types 2022-03-18 15:36:18 +01:00
Jonas Schievink
e7564086f4
Update crates/ide_completion/src/tests/pattern.rs 2022-03-18 14:53:44 +01:00
hi-rustin
bc8665e14d Fix typo
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 22:59:47 +08:00
hi-rustin
2bc545d9ef Match the enum and union
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 21:38:21 +08:00
hi-rustin
c6ef4e830e Fix the wrong path resolution
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 20:39:04 +08:00
hi-rustin
a9aae250ed Add completes_associated_const test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 20:39:00 +08:00
hi-rustin
37d0c722ef Complete associated consts in patterns
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-17 20:35:04 +08:00
Lukas Wirth
a40a847d77 Revert omitting field completions 2022-03-16 16:41:35 +01:00
Lukas Wirth
c1f6f135e1 Remove code duplication 2022-03-16 16:32:36 +01:00
Lukas Wirth
02b401b130 Simplify completion render functionality 2022-03-16 16:27:55 +01:00
Lukas Wirth
4fe5f03c7f Rename compound things to variant things 2022-03-16 13:41:47 +01:00
bors[bot]
61b1449387
Merge #11714
11714: fix: Fix completions not always working in for-loop patterns r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11205
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-15 17:58:21 +00:00
Lukas Wirth
d5f8d91872 fix: Fix completions not always working in for-loop patterns 2022-03-15 18:46:32 +01:00
bors[bot]
683fea4de4
Merge #11707
11707: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-14 20:05:46 +00:00
Lukas Wirth
fbc1d2a514 Simplify 2022-03-14 20:36:35 +01:00
Matthias Krüger
77790f2b8e fix clippy::needless_return 2022-03-12 16:50:49 +01:00
Matthias Krüger
7912e33ed6 fix clippy::needless_borrow 2022-03-12 16:50:49 +01:00
bors[bot]
ff7e057dca
Merge #11691
11691: feat: Suggest union literals, suggest union fields within an empty union literal r=Veykril a=m0rg-dev

Adds a `Union {…}` completion in contexts where a union is expected, expanding to a choice of available fields (if snippets are supported):

![image](https://user-images.githubusercontent.com/38578268/158023335-84c03e39-daf0-4a52-b969-f40b01501cc8.png)
![image](https://user-images.githubusercontent.com/38578268/158023354-db49d0bb-034c-49d3-bc02-07414179cb61.png)

Also, adds support for listing possible fields in an empty union literal.

![image](https://user-images.githubusercontent.com/38578268/158023398-4695ae34-ce64-4f40-8494-68731a3030c6.png)
![image](https://user-images.githubusercontent.com/38578268/158023406-be96dd95-125a-47ac-9628-0bce634ca2eb.png)

Closes #11568.

Co-authored-by: Morgan Thomas <corp@m0rg.dev>
2022-03-12 15:44:51 +00:00
Morgan Thomas
f922b805fe - clean up match in ide_completion::completions::record::complete_record_literal
- use original instead of adjusted type in ide_completion::completions::record::complete_record
- don't even bother checking if we can complete union literals to Default or to struct update syntax
2022-03-12 07:35:13 -08:00