Commit Graph

20041 Commits

Author SHA1 Message Date
Aleksey Kladov
a1aa8212ef minor: if-let-else to shorter match 2021-11-27 18:18:00 +03:00
bors[bot]
90c435519d
Merge #10870
10870: ide: fix macro expansion for 'as _' r=Veykril a=jhgg

fixes: #10862

Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-27 02:29:54 +00:00
Jake Heinz
dca8f612d0 ide: fix expansion for 'as _' 2021-11-27 02:22:21 +00:00
bors[bot]
9f447ad522
Merge #10865
10865: internal: Use the right `ItemTree` when re-resolving attr r=jonas-schievink a=jonas-schievink

Followup to https://github.com/rust-analyzer/rust-analyzer/pull/10863, which caused a panic when analyzing diesel

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-11-26 02:59:07 +00:00
Jonas Schievink
c291e5e284 Use the right ItemTree when re-resolving attr 2021-11-26 03:57:25 +01:00
bors[bot]
5ea8a9cd20
Merge #10863
10863: internal: build per-block `ItemTree`s r=Veykril a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7717
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8911
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8614

`ItemTree`s are now flat lists of items, so they should probably be renamed at some point.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-11-26 00:52:02 +00:00
Jonas Schievink
3bb6f506ee Build per-block ItemTrees 2021-11-26 00:17:20 +01:00
bors[bot]
91cb422e1a
Merge #10859
10859: fix: Prioritize tuple fields in highlight_related r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-25 15:35:18 +00:00
Lukas Wirth
4bf75c5d6e fix: Prioritize tuple fields in highlight_related 2021-11-25 16:34:40 +01:00
bors[bot]
870e730dc8
Merge #10824
10824: project_model: print full cargo command if cargo metadata fails to run r=Veykril a=jhgg

well, `Command` implements a sensible `Debug` which *roughly* does what we want to do. Unfortunately it's got a bit of a quote situation,

So it'd output something like `"cargo" "metadata"  "--format-version" "1" "--features" "foo,bar,baz"`. 

Which although is a bit verbose with the quotes, it's at the very least, not entirely incorrect/misleading.

fixes #10797

Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-25 15:12:38 +00:00
bors[bot]
4ca6233bd2
Merge #10847
10847: fix: derive attr path handling in `replace_derive_with_manual_impl` r=rainy-me a=rainy-me

partially fixes #10666

renaming issues mentioned in https://github.com/rust-analyzer/rust-analyzer/issues/10666#issuecomment-955671021 doesn't seem to be fixable at this moment since it's not searchable?(not recorded?) by name.

<del>I'm not sure if it's appropriate to move `parse_comma_sep_paths` function to a method in `ast/node_ext`, maybe `ide_db::helpers` also make sense.</del> put into `ide_db::` instead.

Co-authored-by: rainy-me <github@yue.coffee>
2021-11-24 15:33:00 +00:00
rainy-me
0bb08ccb8f fix: derive path handling 2021-11-25 00:21:29 +09:00
bors[bot]
4a8db6ad66
Merge #10853
10853: fix: Remove possible multiline details in completions r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10316
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7531(this has already been fixed prior, from what I've seen)
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-24 15:08:44 +00:00
Lukas Wirth
0c98a01b3e Remove possible multiline details in completions 2021-11-24 16:08:11 +01:00
bors[bot]
3e4ac8a2c9
Merge #10846
10846: fix: qualify struct name in struct constructor completion r=Veykril a=andrewleverette

* Alter `add_struct_literal` method signature to take an optional module path
* Update `render_literal` method to use a qualified  

Relates to issue #10771 

Side note: This is my first contribution. Any feedback is welcome!

Co-authored-by: Andrew Leverette <andrewleverette@gmail.com>
2021-11-23 21:22:27 +00:00
bors[bot]
4b1bf5f540
Merge #10849
10849: fix: Disable string highlight injection for macros changing string literals r=Veykril a=Veykril

Fixes #10845
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-23 21:13:35 +00:00
Lukas Wirth
f3b25a6fc8 Disable string highlight injection for macros changing string literals 2021-11-23 22:13:10 +01:00
Andrew Leverette
7f15537fa9 Add optimization for not allocating in case of no module path for struct literal 2021-11-23 14:41:31 -06:00
Andrew Leverette
ce7a141110 Add support for qualified struct names 2021-11-23 10:57:29 -06:00
bors[bot]
054873ce15
Merge #10840
10840: fix: Omit generic defaults for types in hover messages r=jonas-schievink a=Veykril

Fixes #9198

We have ranged hovers now which query specifically for the type of an expression/pattern, so if interested in seeing the default, the user can use that functionality instead.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-23 15:21:47 +00:00
bors[bot]
1b938ef1ca
Merge #10834
10834: Make lint groups work correctly with `warningsAsInfo` and `warningsAsHint` r=Veykril a=Emilgardis

this change makes it possible to specify

```json
{
   "rust-analyzer.diagnostics.warningsAsInfo": ["unused"],
}
```

to make all lints in the `unused` group show as info, etc.

Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
2021-11-22 19:03:07 +00:00
Emil Gardström
3dc898389f
Make lint groups work correctly with warningsAsInfo and warningsAsHint 2021-11-22 18:38:28 +01:00
Lukas Wirth
ec07bb98f8 fix: Omit generic defaults for types in hover messages 2021-11-22 18:27:03 +01:00
bors[bot]
a07e406d06
Merge #10839
10839: fix: Fix mbe::Shift::new not accounting for non-ident token ids r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-22 17:01:40 +00:00
Lukas Wirth
a9c4c6da4c Fix mbe::Shift::new not accounting for non-ident token ids 2021-11-22 18:00:32 +01:00
Lukas Wirth
0bc3003960 Document token up/down mapping 2021-11-22 17:58:36 +01:00
bors[bot]
a0f01ec14e
Merge #10838
10838: internal: Add the ability to emit token map ids in macro expansion tests r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-22 15:59:52 +00:00
Lukas Wirth
64cb09ddea Add to macro testing infra to emit token map ids 2021-11-22 16:51:09 +01:00
bors[bot]
b69eee6487
Merge #10809
10809: fix: don't discard formatting of `use` lines r=Veykril a=iDawer

Use mutable syntax trees in `merge_imports`, `split_imports`. This tries to resolve #9013. But I haven't much managed to simplify code of merging.

Also resolve #9361. It reuses a use tree under the cursor so that comments+indentation are preserved. Merged trees are just appended to the end.

This touches bunch of tests. I removed the sorting of use trees as it needs a proper implementation that takes into account comments and line wrapping. I think it is rustfmt's job or at least until we get a close implementation.

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-11-22 14:29:24 +00:00
bors[bot]
e8f15bd794
Merge #10835
10835: internal: pull website before generating new changelog r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-11-22 13:47:25 +00:00
Jonas Schievink
03188e63cc Pull website before generating new changelog 2021-11-22 14:45:47 +01:00
bors[bot]
a37f613f32
Merge #10833
10833: internal: set upstream branch when promoting r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-11-22 12:42:03 +00:00
Jonas Schievink
be8d40a13e Set upstream branch when promoting 2021-11-22 13:39:07 +01:00
bors[bot]
bc37d9a29a
Merge #10832
10832: internal: Split parts of `ide_db::call_info` off into `ide` r=Veykril a=Veykril

`call_info` itself is just an ide feature and thus should not reside in `ide_db` itself.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-22 12:23:58 +00:00
Lukas Wirth
77f08d0fc3 Split parts of ide_db::call_info off into ide 2021-11-22 13:23:34 +01:00
bors[bot]
c189555d98
Merge #10831
10831: minor: Unnest `ide::display::navigation_target` module r=Veykril a=Veykril

This module contained multiple submodules before, but those were removed some time ago so there is no point in having this one module two layers deep anymore.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-22 12:05:57 +00:00
Lukas Wirth
54b2de45e1 Unnest ide::display::navigation_target module 2021-11-22 13:04:28 +01:00
bors[bot]
806d7d725d
Merge #10828
10828: doc: document absence of stability guarantees r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-11-22 10:07:23 +00:00
Aleksey Kladov
d9dc925c2e doc: document absence of stability guarantees 2021-11-22 13:06:37 +03:00
bors[bot]
183ef048f6
Merge #10823
10823: fix: better `Fn` traits formatting r=jonas-schievink a=veber-alex

This makes it so formatting `Fn` traits properly handles:

1. An `Fn` trait with only a single argument -> removes the trailing comma.
2. An `Fn` trait which returns nothing (an empty tuple) -> don't show `-> ()` as the return type.

before:
![before](https://user-images.githubusercontent.com/29788806/142745038-44ac68ce-de42-4396-a809-ffdb883be699.png)

after:
![after](https://user-images.githubusercontent.com/29788806/142745040-485feaa2-cc21-4a05-9576-5410ea355029.png)




Co-authored-by: Alex Veber <alexveber@gmail.com>
2021-11-21 20:01:07 +00:00
Jake Heinz
03eb9f3abb project_model: print full cargo command if it fails to run 2021-11-21 01:18:42 +00:00
Alex Veber
24f816c481 fix: better Fn traits formatting 2021-11-21 02:39:22 +02:00
bors[bot]
4566414789
Merge #10810
10810: feat: Add toggle to disable cache priming r=jonas-schievink a=lnicola

Even if it doesn't prevent the rest of the features from working, cache priming tends to be quite CPU-intensive and can make people think that the load times are worse than they actually are.

It's also less useful in Code and `rust-tools` because the inlay hints and semantic highlighting trigger quite a bit of computation assuming you have a file open in the editor.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-11-20 20:24:31 +00:00
bors[bot]
c9c6fa8f56
Merge #10821
10821: fix: wrap `inline_call` and `inline_into_callers` if it inlines into the left side of a binary expression r=Veykril a=rainy-me

close #10359

Co-authored-by: rainy-me <github@yue.coffee>
2021-11-20 17:25:17 +00:00
rainy-me
ebffaa4274 fix: check inline left of binary_expression 2021-11-21 01:48:04 +09:00
bors[bot]
55b7a06888
Merge #10820
10820: minor: Move incorrect case diagnostic things into their module r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-20 16:26:50 +00:00
Lukas Wirth
69782f55de Move incorrect case diagnostic things into their module 2021-11-20 17:25:57 +01:00
bors[bot]
f2707bce36
Merge #10819
10819: internal: Replace some `Vec` occurences with `Box`  r=Veykril a=Veykril

Shaves off ~15mb from self analysis

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-20 15:40:56 +00:00
Lukas Wirth
91def936bc Replace Vec with Box in Path.generic_args field 2021-11-20 16:37:41 +01:00
Lukas Wirth
ceaec9d866 internal: Replace Vec with Box in hir Pat 2021-11-20 16:17:30 +01:00