Commit graph

12260 commits

Author SHA1 Message Date
Lukas Wirth
4f99c6467b Don't concat path in replace_qualified assist when they start with a keyword 2021-07-20 18:57:12 +02:00
bors[bot]
ea105f9396
Merge #9619
9619: Support GATs for associated type arg parsing r=Veykril a=Veykril

Fixes #9602

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-18 09:10:56 +00:00
Lukas Wirth
e7aa37c20a Support GATs for associated type arg parsing 2021-07-18 11:08:43 +02:00
Laurențiu Nicola
a9df3f858a Fix AbsPath::ends_with 2021-07-18 10:25:14 +03:00
Aleksey Kladov
8f3335f5fb internal: make it clearer where IO happens 2021-07-17 23:56:50 +03:00
bors[bot]
398ae3e67f
Merge #9622
9622: feat: improve parser error recovery for function parameters r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-17 19:41:42 +00:00
Aleksey Kladov
15f11dce4a feat: improve parser error recovery for function parameters 2021-07-17 22:41:04 +03:00
Aleksey Kladov
8d8c26e6f5 internal: a bit more of cwd safety for flycheck 2021-07-17 18:13:35 +03:00
Aleksey Kladov
8df38aa797 internal: make sure that proc macro machinery doesn't depend on cwd 2021-07-17 17:55:16 +03:00
Aleksey Kladov
9318c643f1 internal: make it easier to isolate IO 2021-07-17 17:55:16 +03:00
bors[bot]
a2f83c956e
Merge #9614
9614: Parse input expressions for dbg! invocations in remove_dbg r=Veykril a=Veykril

Instead of inspecting the input tokentree manually, parse the input as `,` delimited expressions instead and act on that. This simplifies the assist quite a bit.

Fixes #8455

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-16 13:48:23 +00:00
Lukas Wirth
c5bcd56433 Cleanup tests 2021-07-16 15:47:59 +02:00
Lukas Wirth
da00208ab9 Parse input expressions in for dbg! in remove_dbg 2021-07-16 15:20:50 +02:00
Kirill Bulatov
8a5b24eb7e Explicitly connect an ambiguous import path case logic with the test on it 2021-07-16 00:41:00 +03:00
Lukas Wirth
efc96b2c60 Add regression test fo #7222 2021-07-15 22:23:34 +02:00
bors[bot]
f39a250df6
Merge #9607
9607: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-15 19:29:28 +00:00
Lukas Wirth
4450365ec8 Simplify 2021-07-15 21:28:30 +02:00
bors[bot]
c18cba78c8
Merge #9605
9605: internal: Folding ranges respect item visibilities r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-15 15:54:55 +00:00
Lukas Wirth
ed73460971 Folding ranges respect item visibilities 2021-07-15 17:44:23 +02:00
Lukas Wirth
efea07f31c Add nested region folding test 2021-07-15 17:02:45 +02:00
bors[bot]
e67cd766f7
Merge #9604
9604: fix: Don't fold consecutive modules with item lists r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-15 14:36:22 +00:00
Lukas Wirth
658514d378 Don't fold consecutive modules with item lists 2021-07-15 16:35:31 +02:00
Lukas Wirth
317b0c2e6d Move attribute completion tests 2021-07-15 16:27:01 +02:00
bors[bot]
190f37afab
Merge #9600
9600: fix: Single-line and nested blocks in the `unwrap_block` assist r=Veykril a=patrick-gu

Fixes #8411

Rework the system for stripping whitespace and braces in the unwrap_block assist to allow correct unwrapping of blocks such as:
```rust
{ $0 0 }
```
into
```rust
0
```

and nested blocks, such as:
```rust
$0{
    {
        3
    }
}
```
into
```rust
{
    3
}
```

This is done by creating the `update_expr_string_with_pat` function (along with `update_expr_string` and `update_expr_string_without_newline`), which strips whitespace and braces in a way that ensures that only whitespace and a maximum of one brace are removed from the start and end of the expression string.

I have also created several tests to ensure that this functionality works correctly.

Co-authored-by: patrick-gu <55641350+patrick-gu@users.noreply.github.com>
2021-07-15 00:45:55 +00:00
bors[bot]
95d85336df
Merge #9595
9595: Show test mod runnable in outline modules r=Veykril a=Veykril

This shows a runnable inside outline test modules at the top of its file:
![image](https://user-images.githubusercontent.com/3757771/125494747-169c9238-3faa-4eed-9700-90bd730b4e3c.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-15 00:20:44 +00:00
patrick-gu
6c591a9275 fix: Single-line and nested blocks in unwrap_block
Rework the system for stripping whitespace and braces in the
unwrap_block assist to allow correct unwrapping of `{$0 { 0 } }`
2021-07-14 12:02:38 -07:00
Levente Gyozo Lenart
a3f0197454 Update tests 2021-07-14 18:20:01 +02:00
Levente Gyozo Lenart
a0bc236adf Add true and false as completion suggestions when expecting an expression 2021-07-14 18:19:47 +02:00
Lukas Wirth
d837a5d5a7 Show test mod runnable in outline modules 2021-07-14 11:30:51 +02:00
Lukas Wirth
12fe48c04d Use Type::walk for goto_type_definition 2021-07-14 01:42:30 +02:00
bors[bot]
9bd6836513
Merge #9596
9596: Return type arguments in goto_type_definition result  r=Veykril a=Veykril

Fixes #9586
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-13 17:25:00 +00:00
Lukas Wirth
796988a269 Return type arguments in goto_type_definition result 2021-07-13 19:24:29 +02:00
Lukas Wirth
d1256a3709 Assign mutable semantic token modifier to assignment operators 2021-07-13 18:32:02 +02:00
Lukas Wirth
b3337c26db Split main highlighting function up into a few subfunctions 2021-07-13 18:29:57 +02:00
Aleksey Kladov
cd6df6935f minor: make sure that project_root works correctly 2021-07-13 15:02:29 +03:00
bors[bot]
62622c6940
Merge #9550
9550: Proc macro multi abi proof of concept r=matklad a=alexjg

#8925 was irritating me so I thought I would have a bash at fixing it. What I've done here is copy the `crates/proc_macro_srv/src/proc_macro` code (which is copied from `<RUST>/library/proc_macro`) to `crates/proc_macro_srv/src/proc_macro_nightly` and the modified the nightly version to include the changes from https://github.com/rust-analyzer/rust-analyzer/pull/9047 and aeb7b183a2

This gives us the code to support both stable and nightly ABIs. Then we use the `proc_macro_api::version::read_dylib_info` to determine which version of the ABI to load when creating a `ProcMacroLibraryLibLoading` (which is now an enum). 

This seems to work for me.  The code could be cleaned up but I wanted to see if the approach makes sense before I spend more time on it.

I've split the change into two commits, the first is just copying and modifying the `proc_macro` crate, the second contains most of the interesting work around figuring out which ABI to use.

Co-authored-by: Alex Good <alex@memoryandthought.me>
Co-authored-by: alexjg <alex@memoryandthought.me>
2021-07-13 10:35:20 +00:00
Aleksey Kladov
6f269708e8 internal: get rid of a call to slow O(N) visibility_of function
Instead of inferring module's declared visibility by looking at the
scope of its parent, let's just remeber the declared visibility in the
DefMap.
2021-07-12 21:13:43 +03:00
Aleksey Kladov
a9d0d1414a internal: remove erroneous default impl 2021-07-12 20:18:07 +03:00
Aleksey Kladov
67a7dfda43 internal: remove deprecated fn 2021-07-12 20:05:09 +03:00
Aleksey Kladov
d40cf52e6d internal: perpare to remove ModuleData::default 2021-07-12 20:02:56 +03:00
Aleksey Kladov
107e07458c internal: remove erroneous Default impl for ModuleOrigin
In rust-analyzer, we avoid defualt impls for types which don't have
sensible, "empty" defaults. In particular, we avoid using invalid
indices for defaults and similar hacks.
2021-07-12 20:00:17 +03:00
Alex Good
e240eb67a8 Introduce proc_macro_srv::abis, impl 1.47 and 1.55
Rather than a "Stable" and "Nightly" ABI we instead name ABIs based on
the version of the rust compiler in which they were introduced. We place
these ABIs in a new module - `proc_macro_srv::abis` - where we also add
some mchinery to abstract over ABIs. This should make it easy to add new
ABIs at a later date as the rust compiler evolves.
2021-07-12 16:05:45 +01:00
alexjg
14a51d28b5 check rustc major version == 1 not < 1
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-07-12 16:05:45 +01:00
Alex Good
39b8d10b93 Use rustc version of dylib to choose which proc macro ABI to use 2021-07-12 16:05:45 +01:00
Alex Good
a8b0a91011 copy proc_maco to proc_macro_nightly and modify for nightly ABI compatibility 2021-07-12 16:05:45 +01:00
Jonas Schievink
7c2b9fb660 Set more CARGO_ env vars 2021-07-12 15:34:49 +02:00
bors[bot]
091dbfe637
Merge #9535
9535: internal: remove proc macro management thread r=jonas-schievink a=jonas-schievink

Communication with the proc macro server process has always happened one request at a time, so the additional thread isn't really needed (it just forwarded each request, and sent back the response). This removes some indirection that was a bit hard to understand (a channel was allocated and sent over another channel to return the response).

Hope I'm not missing anything here

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-12 13:23:26 +00:00
Jonas Schievink
29db33ce76 Address review comments 2021-07-12 15:19:53 +02:00
bors[bot]
fe00358888
Merge #9569
9569: internal: Explicitly check for reference locals or fields in Name classification r=Veykril a=Veykril

Closes #7524
Inlines all the calls to reference related name classification as well as emits both goto definition targets for field shorthands.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-11 14:28:08 +00:00
Lukas Wirth
ab2647769c Return both field and local references for shorthands in goto_def 2021-07-11 16:16:16 +02:00