Commit Graph

253 Commits

Author SHA1 Message Date
bors[bot]
eb804261dc
Merge #3228
3228: Use proper range for hover on macro arguments r=matklad a=edwin0cheng

This PR use `original_range` to remap the range of found syntax node in `hover` and thus it should return the proper text range now.

fixed #3000 
fixed #3135 


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-02-19 10:46:00 +00:00
Shotaro Yamada
d06733efeb Cleanup 2020-02-19 13:36:59 +09:00
Shotaro Yamada
dd0c3c41b9 Fix a crash with non-ascii whitespace in doc-comments 2020-02-19 13:13:29 +09:00
Edwin Cheng
b9d94d73a2 Use proper range for hover on macro arguments 2020-02-19 11:56:27 +08:00
Aleksey Kladov
b4450b1043 Cleanup imports 2020-02-18 23:52:53 +01:00
Aleksey Kladov
97ab471b6d Minor simplification 2020-02-18 18:52:33 +01:00
Kirill Bulatov
f6816c253b Update versions 2020-02-18 16:12:40 +02:00
Kirill Bulatov
eceaf94f19 More manual clippy fixes 2020-02-18 16:12:37 +02:00
bors[bot]
eab80cd961
Merge #3218
3218: Cut some deps r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-18 13:46:54 +00:00
Aleksey Kladov
b643ccfaed Drop extra deps 2020-02-18 14:44:52 +01:00
Veetaha
e00922d113 ra_syntax: SyntaxError::range() now returns by value 2020-02-17 22:24:38 +02:00
Veetaha
9fdf984958 ra_syntax: reshape SyntaxError for the sake of removing redundancy 2020-02-17 22:24:33 +02:00
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