Commit graph

205 commits

Author SHA1 Message Date
Lukas Wirth
050c69c19d Split out merge_imports module from helpers::insert_use 2021-04-24 13:31:43 +02:00
bors[bot]
5cbde9f531
Merge #8591 #8638
8591: Remove SyntaxRewriter usage in insert_use in favor of mutable syntax trees r=matklad a=Veykril

Unfortunately changing `insert_use` to not use `SyntaxRewriter` creates a lot of changes since so much relies on that. But on the other hand this should be the biggest usage of `SyntaxRewriter` I believe.

8638: Remove SyntaxRewriter::from_fn r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-23 16:49:08 +00:00
bors[bot]
85bab7539a
Merge #8317
8317: Convert tuple struct to named struct assist r=Veykril a=unexge

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

Co-authored-by: unexge <unexge@gmail.com>
2021-04-23 13:37:48 +00:00
unexge
322cd1fa7f Use multiple loops instead of Iterator::chain in FindUsages 2021-04-21 16:42:47 +03:00
Lukas Wirth
b290cd5782 Add cov_marks to insert_use tests 2021-04-20 19:34:43 +02:00
Lukas Wirth
fa20a5064b Remove SyntaxRewriter usage in insert_use in favor of ted 2021-04-20 02:09:12 +02:00
Lukas Wirth
2f62c0117a Check for rust doc code attributes like rustdoc does 2021-04-19 13:32:52 +02:00
bors[bot]
3f432730df
Merge #8467
8467: Adds impl Deref assist r=jhgg a=jhgg

This PR adds a new `generate_deref` assist that automatically generates a deref impl for a given struct field.

Check out this gif:

![2021-04-11_00-33-33](https://user-images.githubusercontent.com/5489149/114296006-b38e1000-9a5d-11eb-9112-807c01b8fd0a.gif)

--

I have a few Q's:
 - [x] Should I write more tests, if so, what precisely should I test for?
 - [x] I have an inline question on line 65, can someone provide guidance? :) 
 - [x] I can implement this for `ast::TupleField` too. But should it be a separate assist fn, or should I try and jam both into the `generate_deref`?
 - [x] I want to follow this up with an assist on `impl $0Deref for T {` which would automatically generate a `DerefMut` impl that mirrors the Deref as well, however, I could probably use some pointers on how to do that, since I'll have to reach into the ast of `fn deref` to grab the field that it's referencing for the `DerefMut` impl. 

Co-authored-by: jake <jh@discordapp.com>
2021-04-19 04:54:04 +00:00
bors[bot]
52585df24a
Merge #8546
8546: Return CallInfo for unclosed call expressions r=Veykril a=Veykril

Closes #8522
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-16 21:00:55 +00:00
Lukas Wirth
992965cd82 Return CallInfo for unclosed call expressions 2021-04-16 22:57:33 +02:00
Kirill Bulatov
739edfd5cf Exclude inherent traits from flyimports 2021-04-16 11:13:17 +03:00
Kirill Bulatov
af8a6049a5 Profile trait solving for all invocations 2021-04-14 19:11:17 +03:00
jake
a624e2ea8d Adds impl Deref assist 2021-04-11 00:42:05 -07:00
Jonas Schievink
035d84558c Avoid O(n²) when constructing AttrSourceMap 2021-04-06 22:25:44 +02:00
unexge
8d4be829e0 Add convert tuple struct to named struct assist 2021-04-04 20:52:43 +03:00
unexge
d3a112d68c Allow including Self kw references to FindUsages 2021-04-04 20:48:31 +03:00
Graeme Coupar
ee03849017 Convert Into to From assist
This adds a "Convert Into to From" assist, useful since clippy has
recently started adding lints on every `Into`.

It covers converting the signature, and converting any `self`/`Self`
references within the body to the correct types.

It does assume that every instance of `Into` can be converted to a
`From`, which I _think_ is the case now.  Let me know if there's
something I'm not thinking of and I can try and make it smarter.
2021-04-03 15:48:35 +01:00
bors[bot]
55d7d71590
Merge #8267
8267: Adding gifs and screenshots for features in manual r=matklad a=MozarellaMan

For #6539

This includes most of gif or screenshot examples of most items in the "Features" header. With the exceptions of:

- **On Typing Assists** - couldn't get it to work for a demo, I'm probably missing something?
- **Structural search and replace** - looked to be already a visual example of the feature
- **Workspace symbol** - wasn't sure how best to show this, all of the examples maybe? Also wasn't sure of the best code example to show it off
- **Semantic Syntax Highlighting** - seemed obvious enough to not need a screenshot, but I could easily add this

All the gifs/pngs are hosted in this [comment](https://github.com/rust-analyzer/rust-analyzer/issues/6539#issuecomment-809574840). Please let me know if any of them aren't suitable (and why) and I'll improve it! Or if you don't like the theme/font

Co-authored-by: Ayomide Bamidele <48062697+MozarellaMan@users.noreply.github.com>
2021-03-31 10:01:56 +00:00
Ayomide Bamidele
276022682b Gifs and screenshots for features in manual 2021-03-31 00:08:10 +01:00
bors[bot]
fd7c454d51
Merge #8186
8186: Lower traits to `TraitRef` instead of `TypeRef` r=matklad a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-30 16:45:05 +00:00
Jonas Schievink
41c7448e12 Accurately classify assoc. types in paths 2021-03-30 02:09:17 +02:00
Lukas Wirth
c2a63b97a8 Rename target_ty to self_ty 2021-03-29 17:47:47 +02:00
bors[bot]
bb1d925dab
Merge #8212
8212: Basic support macro 2.0 r=jonas-schievink a=edwin0cheng

Turn out it is quite straight forward :)

r @jonas-schievink 

![m2](https://user-images.githubusercontent.com/11014119/112712565-6eb99380-8f0b-11eb-88de-5d7f974dfe6d.png)


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-28 15:43:11 +00:00
Lukas Wirth
1ef55002c2 Cleanup ide_db imports 2021-03-27 21:51:00 +01:00
Edwin Cheng
4520002b63 Unleash macro 2.0 in hightlight and more 2021-03-27 14:42:49 +08:00
cynecx
5ff3299dd6 syntax: return owned string instead of leaking string 2021-03-26 18:30:59 +01:00
Jonas Schievink
4781479ab2 Sweep the new TraitEnvironmentQuery 2021-03-24 18:59:35 +01:00
Lukas Wirth
395183e0b7 Cleanup Definition::search_scope 2021-03-23 13:03:55 +01:00
Lukas Wirth
7c4eb66c1a Merge hir::MacroDef::is_* into hir::MacroDef::kind 2021-03-23 11:32:14 +01:00
Lukas Wirth
bad4e48672 Set up a search scope when searching for mbe macro references 2021-03-23 11:32:10 +01:00
Aleksey Kladov
45a8f37b6a Compute more mathematically well-rounded notion of transitive deps
By including the crate itself, we make the resulting set closed with
respect to `transitve_reveres_dependencies` operation, as it becomes a
proper transitive closure. This just feels more proper and mathy.

And, indeed, this actually allows us to simplify call sites somewhat.
2021-03-23 12:49:55 +03:00
Aleksey Kladov
9cbf09ec4f rewrite merge use trees assist to use muatable syntax trees
changelog internal
2021-03-22 20:47:46 +03:00
Edwin Cheng
7784cadc3d Reexport PrefixKind to remove deps to hir 2021-03-22 13:39:13 +08:00
Kirill Bulatov
b17d99c070 Fix the profile string 2021-03-21 11:45:37 +02:00
Kirill Bulatov
eaa4fcbbde Less reallocations 2021-03-21 11:45:37 +02:00
Kirill Bulatov
ec731e19df Use smart case in flyimport items lookup 2021-03-21 11:45:37 +02:00
bors[bot]
09412d85fc
Merge #8123
8123: Do not display unqualified assoc item completions r=SomeoneToIgnore a=SomeoneToIgnore

Part of https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/autoimport.20weirdness

Removes all flyimport completions for any unqualified associated type, effectively reverting https://github.com/rust-analyzer/rust-analyzer/pull/8095 
I've explained the reasoning in the corresponding FIXME and open to discussions.
As an alternative way, we could add yet another parameter in the method that's used by the `qualify_path` and enable it for the qualify assists only.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-03-21 09:37:08 +00:00
Lukas Wirth
38048c35d8 Don't use an untyped String for ActiveParam tracking 2021-03-20 23:22:09 +01:00
Kirill Bulatov
56a7d246d5 Disable unqualified assoc items completion for now 2021-03-20 23:08:44 +02:00
Kirill Bulatov
879432452d Docs 2021-03-20 22:55:34 +02:00
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
Lukas Wirth
34464ede3f Fix associated items not being appended to paths in import_assets 2021-03-18 21:36:52 +01:00
Jonas Schievink
5fbb97a0f0 Rename item_tree query to file_item_tree 2021-03-18 01:53:37 +01:00
Lukas Wirth
5734b347dd Fix incorrect newline emission in Attrs::docs 2021-03-17 17:00:08 +01:00
Matthias Krüger
ff5f90d8ae use simpler .map(|x| y) instead of .and_then(|x| Some(y)) for Options. (clippy::bind_instead_of_map) 2021-03-17 02:36:29 +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]
979e788957
Merge #8034
8034: Implement Crate::transitive_reverse_dependencies r=matklad a=Veykril

changelog internal Implement Crate::transitive_reverse_dependencies

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-16 14:54:12 +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
Lukas Wirth
e97cd709cd Implement Crate::transitive_reverse_dependencies 2021-03-15 18:28:31 +01:00