Commit Graph

241 Commits

Author SHA1 Message Date
Aleksey Kladov
57140f1730 Drop proptest tests
It takes waaay to long to compile.

We should add quickcheck tests when we touch the relevant code next
time.
2020-02-17 16:57:06 +01:00
bors[bot]
fcf15cc05a
Merge #3169
3169: Show record field names in Enum completion r=flodiebold a=adamrk

Adresses https://github.com/rust-analyzer/rust-analyzer/issues/2947.
Previously the details shown when autocompleting an Enum variant would look like the variant was a tuple even if it was a record:
![2020-02-16-15:59:32_crop](https://user-images.githubusercontent.com/16367467/74607233-64f21980-50d7-11ea-99db-e973e29c71d7.png)

This change will show the names of the fields for a record and use curly braces instead of parentheses:
![2020-02-16-15:33:00_crop](https://user-images.githubusercontent.com/16367467/74607251-8ce17d00-50d7-11ea-9d4d-38d198a4aec0.png)

This required exposing the type `adt::StructKind` from `ra_hir` and adding a function 
```
kind(self, db: &impl HirDatabase) -> StructKind
```
in the `impl` of `EnumVariant`. 

There was also a previously existing function `is_unit(self, db: &impl HirDatabase) -> bool` for `EnumVariant` which I removed because it seemed redundant after adding `kind`.

Co-authored-by: adamrk <ark.email@gmail.com>
2020-02-17 10:54:32 +00:00
bors[bot]
93d28fb50c
Merge #3099
3099: Init implementation of structural search replace r=matklad a=mikhail-m1

next steps:
* ignore space and other minor difference
* add support to ra_cli
* call rust parser to check pattern
* documentation

original issue #2267 

Co-authored-by: Mikhail Modin <mikhailm1@gmail.com>
2020-02-17 10:02:54 +00:00
bors[bot]
8d8d542dfa
Merge #3108
3108: Magic Completion for `impl Trait for` Associated Items r=matklad a=kdelorey

# Summary
This PR adds a set of magic completions to auto complete associated trait items (functions/consts/types). 

![Associated Trait Impl](https://user-images.githubusercontent.com/2295721/74493144-d8f1af00-4e96-11ea-93a4-82725bf89646.gif)

## Notes
Since the assist and completion share the same logic when figuring out the associated items that are missing, a shared utility was created in the `ra_assists::utils` module.

Resolves #1046 

As this is my first PR to the rust-analyzer project, I'm new to the codebase, feedback welcomed!

Co-authored-by: Kevin DeLorey <2295721+kdelorey@users.noreply.github.com>
2020-02-17 09:34:08 +00:00
bors[bot]
c9989a524c
Merge #3153
3153: When a single test is run, do not run others with overlapping names r=matklad a=SomeoneToIgnore



Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-17 08:52:45 +00:00
Kirill Bulatov
dabdb57067 Simplify module retrieval 2020-02-16 18:44:46 +02:00
Aleksey Kladov
28fa5edbce Add module colors to css 2020-02-16 17:06:01 +01:00
adamrk
e88eb89132 add space before/after wrapping braces 2020-02-16 16:33:15 +01:00
adamrk
04aff742b1 show names for record fields in enum completion 2020-02-16 16:10:23 +01:00
Kevin DeLorey
057d0bee55 Added module doc comment to explain the purpose of the completion. 2020-02-15 10:27:04 -06:00
Kevin DeLorey
ae8ae650fc Fixed bug that allowed for completion in a nested method. 2020-02-15 09:50:07 -06:00
Kevin DeLorey
fc13b7fc9a Reordered the use items. 2020-02-14 18:54:00 -06:00
Kirill Bulatov
426c0f26fe If possible, use --exact flag when running tests 2020-02-15 01:06:14 +02:00
Mikhail Modin
f8f454ab5c Init implementation of structural search replace 2020-02-14 21:45:42 +00:00
Kevin DeLorey
be97cbfdb4 Adjusted the completion lookups to filter by just the name. 2020-02-13 19:10:08 -06:00
Kevin DeLorey
0bc9e62374 Completion now replaces whole fn/const/type def with snippet. 2020-02-12 21:00:47 -06:00
Kevin DeLorey
43e62a87ab Cheese const tests as they requre an ident before becoming a CONST_DEF. 2020-02-12 20:46:55 -06:00
Kevin DeLorey
877cfbacf9 Started to refactor the trigger of the trait_impl completion. 2020-02-12 20:21:43 -06:00
Aleksey Kladov
6ec982d54d Simplify 2020-02-12 18:02:00 +01:00
Aleksey Kladov
f3dd0a05bb Return early, return often 2020-02-11 18:36:12 +01:00
Aleksey Kladov
adfed5c689 Fix join lines when two rules match 2020-02-11 18:33:25 +01:00
Kevin DeLorey
6f130e7ef8 Formatting. 2020-02-11 10:07:23 -06:00
Kevin DeLorey
47d314e856 Fixing minor suggestions and added module level documentation. 2020-02-11 10:04:30 -06:00
Kevin DeLorey
e664cd73e3 Removed doc comments entirely from the changes. 2020-02-11 09:48:26 -06:00
bors[bot]
305d921982
Merge #3064
3064: Handle macro token cases for rename r=matklad a=edwin0cheng

Fixes #2957

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-02-11 15:46:05 +00:00
Kevin DeLorey
3aaf46afa1 Formatted changes. 2020-02-11 09:40:08 -06:00
Kevin DeLorey
d7e36c3dd2 Removed docs from private method. 2020-02-11 07:31:39 -06:00
Kevin DeLorey
785723e0d9 Added tests to test associated types and consts. 2020-02-10 21:02:51 -06:00
Kevin DeLorey
52c4324e31 Added some documentation to the complete_trait_impl completion. 2020-02-10 20:55:49 -06:00
Kevin DeLorey
3ffc84fd15 Added associated const magic completion. 2020-02-09 20:59:12 -06:00
Matthew Jasper
8c8d0bb34f Add or- and parenthesized-patterns 2020-02-09 22:06:15 +00:00
Kevin DeLorey
d85abd77b9 Added a utility function that can be used to determine the missing impl items. 2020-02-09 12:24:59 -06:00
Kevin DeLorey
a957c473fd Merge branch 'master' into kdelorey/complete-trait-impl 2020-02-09 10:37:43 -06:00
Aleksey Kladov
9769c5140c Simplify Assists interface
Instead of building a physical tree structure, just "tag" related
assists with the same group
2020-02-09 16:03:54 +01:00
Edwin Cheng
3038470c68 Use get_or_insert_with 2020-02-09 20:41:29 +08:00
Edwin Cheng
dd0421e587 Handle macro token cases for rename 2020-02-09 17:17:56 +08:00
Aleksey Kladov
409f8e1fb0 Remove hard-coded auto-import during completion
We now have a real auto-import system, so we can do a proper thing.
2020-02-09 10:04:47 +01:00
Kevin DeLorey
22caf982b9 Added associated type completion. 2020-02-08 15:41:25 -06:00
Kevin DeLorey
5c0c18926b Cleaning up unessicary code that the Magic completion takes care of. 2020-02-08 13:22:31 -06:00
Kevin DeLorey
f801723dd2 Got the magic completion working. 2020-02-08 11:28:39 -06:00
Kevin DeLorey
5216b09ed6 Update completion kind to Magic in the unit tests. 2020-02-07 21:02:01 -06:00
Kirill Bulatov
740a26b7d2 Rename add import assist 2020-02-07 23:53:08 +02:00
Aleksey Kladov
ae70d07237 Rename 2020-02-07 14:26:59 +01:00
Aleksey Kladov
f55be75a17 Remove irrelevant distinction 2020-02-07 14:25:16 +01:00
Aleksey Kladov
7e73b7a5f8 Minor rename 2020-02-06 18:47:26 +01:00
Aleksey Kladov
ad204f7562 Mostly remove ImoportLocator infra 2020-02-06 17:17:51 +01:00
Aleksey Kladov
a173e31890 Make assists use ImportsLocator directly 2020-02-06 16:40:28 +01:00
Aleksey Kladov
dfbe96750b Move imports locator to ide_db 2020-02-06 16:26:43 +01:00
Aleksey Kladov
271017e6bf Move NameKind up 2020-02-06 16:23:28 +01:00
Aleksey Kladov
f8dde21fe9 Simplify 2020-02-06 16:00:39 +01:00