Commit graph

543 commits

Author SHA1 Message Date
Aleksey Kladov
0146a95a39 Cleanup 2020-05-20 01:23:05 +02:00
Aleksey Kladov
80545e5d3a New assist: add turbo fish 2020-05-20 00:27:10 +02:00
Aleksey Kladov
2bf6b16a7f Server side of SnippetTextEdit 2020-05-19 20:28:27 +02:00
Aleksey Kladov
fa2e5299c3 Add snippet support for some assists 2020-05-19 20:28:27 +02:00
Aleksey Kladov
c847c079fd Add AssistConfig 2020-05-19 20:28:27 +02:00
bors[bot]
12d82687cd
Merge #4273
4273: Trigger add_vis assist on paths/record fields as well r=flodiebold a=TimoFreiberg

Resolves #4037.

- [x] Function defs
- [x] ADT defs
- [x] Enum variants
- [x] Consts
- [x] Statics
- [x] Traits
- [x] Type aliases
- [x] Modules
- [x] Record fields (using different implementation)
    - [x] struct fields
    - [x] enum variant fields
    -   union fields (`Semantics::resolve_record_field` seems to not work for union fields, so I think this can be handled in a future PR)
- [x] More tests? 
- [x] Improve test fixture code and documentation a bit (see [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/resolve_path.20between.20fixture.20files))

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-05-14 14:29:22 +00:00
bors[bot]
f1587ac263
Merge #4445
4445: Correctly fill default type parameters r=flodiebold a=montekki

Fixes #3877 

So, basically even if the parameters are omitted from the `impl` block, check the parameters in `trait` if they have a default type, and if they do go from `hir` to `ast::TypeArg`. I've added a helper for that but I am not sure that it's a proper way to go from `hir` to `ast` here.

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2020-05-14 11:20:42 +00:00
Fedor Sakharov
2dfbec149f
Fix formatting 2020-05-14 10:31:34 +03:00
Fedor Sakharov
7e9396c7eb
Change type_arg to type_ref func 2020-05-14 10:14:04 +03:00
Fedor Sakharov
a55ad20388
Use generic_defaults and display_source_code 2020-05-14 09:56:20 +03:00
Trevor Spiteri
2d0a949236 Use back ticks instead of single quotes around code 2020-05-14 01:06:07 +02:00
Fedor Sakharov
00f3b6c59a
Correctly fill default type parameters 2020-05-13 16:07:44 +03:00
bors[bot]
0063ad970d
Merge #4358
4358: add if let and while let postfix for Option and Result #4348 r=matklad a=bnjjj

close #4348 

I also added `while let` for iterator or stream it could be useful 

![iflet](https://user-images.githubusercontent.com/5719034/81278000-676c6b80-9055-11ea-87ad-6b8476dd983f.gif)


Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-11 18:08:26 +00:00
bors[bot]
a3dbd272e0
Merge #4406 #4410 #4411 #4417
4406: Update cargo-metadata r=matklad a=edwin0cheng

This PR update `cargo-metadata` to  0.10.0 and it also relax the` serde-derive` deps to 1.0 for tests in `proc-macro-srv`.

cc @robojumper 

r= @matklad  , I think you would have something to say related to https://github.com/serde-rs/json/issues/647#issue-593788429 ?





4410: Improve wording in comment r=matklad a=edwin0cheng



4411: do not remove then block when you unwrap else block #4361 r=matklad a=bnjjj

close #4361 

4417: Omit default types in HirDisplay SourceCode mode r=matklad a=TimoFreiberg

Closes #4390

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-05-10 17:37:07 +00:00
Timo Freiberg
cbbbd48325 Omit default types in HirDisplay SourceCode mode 2020-05-10 18:10:15 +02:00
Timo Freiberg
66db88d226 Trigger change_visibility assist when on an invisible struct field
Union fields apparently don't work :(
2020-05-10 16:51:12 +02:00
Benjamin Coenen
98a7bb2435 do not remove then block when you unwrap else block #4361
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-10 15:31:51 +02:00
Timo Freiberg
7568d07709 Trigger change_visibility assist when on a path to an invisible def 2020-05-10 13:54:04 +02:00
Benjamin Coenen
92b2230fef add if let and while let postfix for Option and Result
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-10 12:45:35 +02:00
bors[bot]
f1cb5b8a29
Merge #4392
4392: Add From should not move the cursor r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-09 14:22:06 +00:00
Aleksey Kladov
d9828a57fc Add From should not move the cursor 2020-05-09 16:21:10 +02:00
Aleksey Kladov
e201e7834d Ascribe more correct types 2020-05-09 15:57:53 +02:00
Aleksey Kladov
5c04d8544c unindent -> dedent 2020-05-09 14:48:43 +02:00
Aleksey Kladov
231fddab54 More fluent indent API 2020-05-09 14:40:11 +02:00
Aleksey Kladov
c6334285e3 Fix visibility 2020-05-09 13:59:25 +02:00
Timo Freiberg
64e6b8200b Use new HirDisplay variant in add_function assist 2020-05-08 17:14:45 +02:00
Aleksey Kladov
1e790ea314 Simplify 2020-05-07 17:32:01 +02:00
Aleksey Kladov
28fcff125a Nicer API 2020-05-07 17:29:23 +02:00
Aleksey Kladov
c6b81bc013 Rename AssitLabel -> Assist 2020-05-07 17:18:28 +02:00
Aleksey Kladov
4867968d22 Refactor assists API to be more convenient for adding new assists
It now duplicates completion API in its shape.
2020-05-07 16:27:54 +02:00
Benjamin Coenen
51c02ab84f add Ok wrapping
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-06 17:45:55 +02:00
Aleksey Kladov
020ca6695f Simplify 2020-05-06 16:39:11 +02:00
Aleksey Kladov
0970c3454b Rename 2020-05-06 16:10:35 +02:00
Aleksey Kladov
fdd4df97ba Use SourceChange for assists 2020-05-06 15:43:47 +02:00
Aleksey Kladov
1116c9a0e9 Fix TODO 2020-05-06 13:21:49 +02:00
Aleksey Kladov
233f01c9ba Move target to AssistLabel
Target is used for assists sorting, so we need it before we compute
the action.
2020-05-06 12:51:28 +02:00
Aleksey Kladov
eea431180e Regenerate 2020-05-06 10:21:35 +02:00
Aleksey Kladov
d308ff910b Merge doc_tests and tests 2020-05-06 10:18:12 +02:00
Aleksey Kladov
25e6bbde01 Merge assits::test_helpers and tests 2020-05-06 10:16:55 +02:00
Aleksey Kladov
ca9e0f5fe9 Fixup tests 2020-05-05 23:48:26 +02:00
Aleksey Kladov
4a6fa8f0df Rename AtomTextEdit -> Indel 2020-05-05 23:15:49 +02:00
Aleksey Kladov
381cbc6088 Minor cleanups 2020-05-05 22:14:01 +02:00
Aleksey Kladov
df00da15c4 Fix compilation 2020-05-05 20:45:44 +02:00
Aleksey Kladov
aee22c73c3 Move group_label where it belongs 2020-05-05 20:42:52 +02:00
Aleksey Kladov
6c2414430a use GroupLabel for type safety 2020-05-05 20:34:45 +02:00
Aleksey Kladov
d5b9282ede Minor rename 2020-05-05 20:33:10 +02:00
Aleksey Kladov
13c078db9c Flip Assist::new arguments 2020-05-05 20:30:33 +02:00
Edwin Cheng
92665358cd Rename ImplItem to AssocItem 2020-05-05 23:56:10 +08:00
bors[bot]
f68e099777
Merge #4265
4265: Make `change_visibility` assist work for tuple struct fields r=matklad a=Jesse-Bakker

Fixes #4206 

Co-authored-by: Jesse Bakker <git@jessebakker.com>
2020-05-05 14:42:33 +00:00
Aleksey Kladov
d7450222a9 Simplify 2020-05-04 14:55:24 +02:00