Commit Graph

12891 Commits

Author SHA1 Message Date
Jörg Sommer
c87b860d3d Use todo!() instead of () for missing fields
The generated code with `()` doesn't compile in most of the cases. To signal
the developer there's something to do, fill in `todo!()`.

Because the file *missing_fields.rs* contains the string `todo!()` it needs
an exception for the test *check_todo*.
2021-09-09 18:04:50 +02:00
bors[bot]
92ce768ea3
Merge #10188
10188: fix: add multi-token mapping support to runnables r=jonas-schievink a=lnicola

Closes #10184


changelog fix (first contribution) add multi-token mapping support to runnables

Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
2021-09-09 15:07:43 +00:00
Anatol Ulrich
5d08ac20d9 implement #10070 in runnables
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-09 18:02:53 +03:00
Jonas Schievink
85993171e5 minor: include ImplLoc in panic context 2021-09-09 02:20:55 +02:00
bors[bot]
6a8062092b
Merge #10174
10174: fix: path display error when start with `crate` r=flodiebold a=dzvon

Fixes  #10172

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-09-08 14:40:54 +00:00
Yotam Ofek
ebb891246c Split and document array method resolution logic. 2021-09-08 13:15:40 +03:00
Yotam Ofek
9593fe684d Fix resolution of inherent array methods. 2021-09-08 11:49:05 +03:00
Yotam Ofek
1785493cae Add (failing) test for inherent array method resolution. 2021-09-08 11:00:55 +03:00
Dezhi Wu
87436a08fa fix super path wrong display 2021-09-07 17:49:46 +08:00
Dezhi Wu
880af425d4 fix path wrong display 2021-09-07 16:54:02 +08:00
Dezhi Wu
6d2154e409 cargo fmt 2021-09-07 14:50:33 +08:00
Dezhi Wu
82ae228d98 fix: path display error when start with crate 2021-09-07 14:44:30 +08:00
Aleksey Kladov
682fbbbd5a minor: modernize 2021-09-06 18:54:16 +03:00
Aleksey Kladov
104cd0ce88 internal: make name consistent with usage 2021-09-06 18:34:03 +03:00
bors[bot]
7d9eb4fd73
Merge #10167
10167: minor: Avoid extra allocation in completion rendering r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-06 15:15:10 +00:00
Laurențiu Nicola
d27ed8c243 Avoid extra allocation in completion rendering 2021-09-06 17:55:07 +03:00
David Barsky
184fbf24f0 update to tracing-tree 0.1.10, which does not pull in syn. 2021-09-06 10:33:08 -04:00
bors[bot]
cbc13ae6bd
Merge #10152
10152: feat: Add completion for raw identifiers r=matklad a=nabakin

![rust_analyzer_pr](https://user-images.githubusercontent.com/894305/132110362-c21b713d-acaf-4a6d-9749-ff812172cbce.gif)
Adds support for valid Rust completion of raw identifiers.

Previously, code completion of fields made via raw identifiers would not re-insert those raw identifiers, resulting in invalid Rust code. Now, code completion of fields made via raw identifiers do re-insert those raw identifiers, resulting in valid Rust code.

The same is true for all code completion instances for fields and compatible Rust identifiers.

Co-authored-by: Blake Wyatt <894305+nabakin@users.noreply.github.com>
2021-09-06 10:54:18 +00:00
bors[bot]
0bc8e2acb8
Merge #10154
10154: feat: Complete `#![recursion_limit = "N"]` instead of `#![recursion_limit = N]` r=lnicola a=hkmatsumoto

Currently ra emits `#![recursion_limit = 128]`, but this should rather be `#![recursion_limit = "128"]`

Co-authored-by: Hirochika Matsumoto <git@hkmatsumoto.com>
2021-09-06 10:38:41 +00:00
Jonas Schievink
8e736da456 Recover from statement macro expansion errors 2021-09-06 00:16:12 +02:00
Aleksey Kladov
dbb702cfc1 internal: remove accidental code re-use
FragmentKind played two roles:

* entry point to the parser
* syntactic category of a macro call

These are different use-cases, and warrant different types. For example,
macro can't expand to visibility, but we have such fragment today.

This PR introduces `ExpandsTo` enum to separate this two use-cases.

I suspect we might further split `FragmentKind` into `$x:specifier` enum
specific to MBE, and a general parser entry point, but that's for
another PR!
2021-09-05 22:36:36 +03:00
Jonas Schievink
d6a12b491f Don't dump DefMaps to build the panic context 2021-09-05 20:42:22 +02:00
Jonas Schievink
7d67c71c34 Add panic info for impl_trait/trait_data 2021-09-05 19:19:34 +02:00
bors[bot]
487078feb5
Merge #10155
10155: Minor: replace old name `CrateDefMap` in comments r=jonas-schievink a=toyboot4e

This PR replaces the old name `CrateDefMap` in comments with the new name `DefMap`. The renaming was done in [57a82fb0](https://github.com/rust-analyzer/rust-analyzer/commit/57a82fb0) (Jan 2021).

I didn't touch the working code ([CrateDefMapQueryQuery][QQ]). Thank you.

[QQ]: https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_db/src/apply_change.rs#L126


Co-authored-by: toyboot4e <toyboot4e@gmail.com>
2021-09-05 16:57:46 +00:00
Jonas Schievink
65bb5d7511 Add crate name to nameres panic context 2021-09-05 18:48:34 +02:00
toyboot4e
89e46b40c3 Minor: replace old name CrateDefMap 2021-09-05 19:22:34 +09:00
Hirochika Matsumoto
1f238b3bb5 Complete #![recursion_limit = "N"] over #![recursion_limit = N] 2021-09-05 18:05:06 +09:00
Blake Wyatt
6c51ecad5b Add completion for raw identifiers 2021-09-04 19:28:59 -04:00
bors[bot]
fd30bd179c
Merge #10146
10146: fix: use placeholder as default type in `Generate function` and `Extract into function`. r=matklad a=iDawer

Closes #10123 

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-04 14:04:30 +00:00
bors[bot]
5fb2eb2314
Merge #10147
10147: fix: don't panic if the client sends invalid request r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-04 13:56:47 +00:00
Aleksey Kladov
2d2c4e7c22 internal: deduplicate 2021-09-04 16:56:23 +03:00
Dawer
535761e63f minor: update test 2021-09-04 15:19:44 +05:00
Aleksey Kladov
33199b7e43 fix: don't panic if the client sends invalid request 2021-09-04 12:27:27 +03:00
Dawer
3d9d10be39 fix: use placeholder as default type in Extract into function. 2021-09-04 14:25:17 +05:00
Dawer
a6c650edf6 fix: use placeholder as default type in Generate function. 2021-09-04 14:24:54 +05:00
Jade
1857b2b5d6 Update dependency minor versions 2021-09-04 00:27:05 -07:00
bors[bot]
5506e0dfaf
Merge #10139
10139: Fix replacing for loops over ranges with for_each. r=yotamofek a=yotamofek

Previously, the assist would turn this:
```rust
for x in 0..92 {
    ...
}
```
into the syntactically incorrect code below:
```rust
0..92.for_each(|x| ...)
```

This fixes the assist by parenthesizing range expressions.

Co-authored-by: Yotam Ofek <yotam.ofek@gmail.com>
2021-09-03 18:03:52 +00:00
Yotam Ofek
dd9433cc63
Update crates/ide_assists/src/handlers/replace_for_loop_with_for_each.rs
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-03 21:02:48 +03:00
bors[bot]
7234f943aa
Merge #10130
10130: fix error message for when DidChangeTextDocument path doesn't exist r=matklad a=alidn

Fixes #10129

Co-authored-by: Ali <59405723+alidn@users.noreply.github.com>
2021-09-03 17:49:23 +00:00
Yotam Ofek
0d453cc2be Fix replacing for loops over ranges with for_each. 2021-09-03 19:43:40 +03:00
bors[bot]
ac2520128d
Merge #10135
10135: minor: fix some clippy lints r=lnicola a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-03 14:28:27 +00:00
Lukas Wirth
36a5ce9790 minor: fix some clippy lints 2021-09-03 16:00:50 +02:00
Ali
1fd153a24e
fix error message for when DidChangeTextDocument path doesn't exist 2021-09-02 15:19:47 -07:00
Lukas Wirth
0fee14bfdd When descending tokens don't bail on failed macro call expansions 2021-09-02 19:12:08 +02:00
Lukas Wirth
e2ede38d47 Use correct search scopes for macros 2021-09-02 17:30:55 +02:00
bors[bot]
48f84a7b60
Merge #10114
10114: fix: Deduplicate imports for qualify_path r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-01 19:53:10 +00:00
Lukas Wirth
8e8ea537ab Deduplicate imports for qualify_path 2021-09-01 21:51:28 +02:00
Jonas Schievink
bdba35cc93 fix: multi-token mapping aware find references 2021-09-01 19:19:16 +02:00
bors[bot]
81ab52c6ca
Merge #10109
10109: fix: Enable flyimport for ident patterns r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-01 14:17:47 +00:00
Lukas Wirth
40a2faee65 Enable flyimport for ident patterns 2021-09-01 16:13:53 +02:00