Jess Balint
1fae96a8d4
handle the case of conflicting lifetime param name
...
- and clean/format code
2020-05-22 08:51:37 -05:00
Jess Balint
2ab79c6f4d
Assist: replace anonymous lifetime with a named one
...
(fixes #4523 )
2020-05-21 21:04:02 -05:00
Aleksey Kladov
ff28c79ebd
Remove dead code for handling cursor positions
2020-05-21 15:08:03 +02:00
Aleksey Kladov
4fdb1eac08
Remove unused cursor positions
2020-05-21 10:37:11 +02:00
Aleksey Kladov
70930d3bb2
Remove set_cursor
2020-05-21 00:03:42 +02:00
Aleksey Kladov
4ac0abd296
Snippetify unwrap -> match
2020-05-21 00:01:08 +02:00
Aleksey Kladov
8300132ed0
More snippets
2020-05-20 23:50:42 +02:00
Aleksey Kladov
5e13e4eba1
More snippets
2020-05-20 23:33:03 +02:00
Aleksey Kladov
fd77170718
Snippetify introduce/inline var
2020-05-20 23:07:17 +02:00
Aleksey Kladov
65fa586410
Relax cursor position tests in assists
...
Those will be replaced with snippets anyway
2020-05-20 22:55:37 +02:00
Aleksey Kladov
ba3a58d1b2
Snippetify fix_visibility
2020-05-20 14:13:17 +02:00
Aleksey Kladov
c446fd76a2
Snippetify fill_match_arms
2020-05-20 14:01:10 +02:00
Aleksey Kladov
a622b54ac0
Don't set cursor in change_visibility
2020-05-20 13:48:31 +02:00
Aleksey Kladov
74da16f6f9
Cleanup imports
2020-05-20 13:45:00 +02:00
Aleksey Kladov
cec773926f
Split change_ and fix_ visibility assists
2020-05-20 13:33:13 +02:00
Aleksey Kladov
ecac5d7de2
Switch to new magic marks
2020-05-20 13:02:53 +02:00
Aleksey Kladov
d18d1c0594
Significantly more glorious marks
2020-05-20 13:00:50 +02:00
bors[bot]
4d3fd62f89
Merge #4530
...
4530: Use snippets in change_return_type_to_result r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-20 09:10:52 +00:00
Aleksey Kladov
33e111483f
Use snippets in change_return_type_to_result
2020-05-20 11:10:15 +02:00
Aleksey Kladov
d8881d98d3
Fix Some|None order in fill_match_arms
2020-05-20 10:51:48 +02:00
Aleksey Kladov
d790a443f3
wip
2020-05-20 10:30:18 +02:00
Aleksey Kladov
2e74df4e2b
Cleanup
2020-05-20 10:28:58 +02:00
Aleksey Kladov
36a5ca9a84
Minor
2020-05-20 10:26:14 +02:00
Aleksey Kladov
45e343a0ef
Minor
2020-05-20 10:20:21 +02:00
Aleksey Kladov
9b2bd022dc
Snippetify add_new
2020-05-20 10:17:46 +02:00
bors[bot]
efac093093
Merge #4525
...
4525: Better cursor placement when adding impl members r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-20 00:11:25 +00:00
Aleksey Kladov
767d169a2a
Better cursor placement when adding impl members
2020-05-20 02:07:21 +02:00
bors[bot]
b26dbf8009
Merge #4524
...
4524: Use snippets in add_missing_members r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-19 23:54:08 +00:00
Aleksey Kladov
a04cababaa
Use snippets in add_missing_members
2020-05-20 01:53:21 +02:00
bors[bot]
a36202390c
Merge #4521 #4522
...
4521: Use snippets in add_function r=matklad a=matklad
bors r+
🤖
4522: Explain the purpose of `ast::make` module more clearly r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-19 23:30:48 +00:00
Aleksey Kladov
e6fc0bdffb
Moderate cleanup of add_function
2020-05-20 01:30:12 +02:00
Aleksey Kladov
4de2749db8
Explain the purpose of ast::make
module more clearly
2020-05-20 01:28:46 +02:00
Aleksey Kladov
8eb3272ad6
Use snippets in add function
2020-05-20 01:23:05 +02:00
Aleksey Kladov
9c3acd3028
Cleanup
2020-05-20 01:23:05 +02:00
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
Aleksey Kladov
802617ccc2
Simplify
2020-05-04 14:16:10 +02:00
Edwin Cheng
2034002413
Support auto-import in macro
2020-05-03 03:24:55 +08:00
Jesse Bakker
b5c330bf5a
Make change_visibility
assist work for tuple struct field visibility
2020-05-02 18:25:38 +02:00
Benjamin Coenen
6d5f3922f7
Add unwrap block assist #4156
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-02 12:31:11 +02:00
Benjamin Coenen
0b40876b99
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer
2020-05-02 12:25:04 +02:00
Benjamin Coenen
eea21738ab
Add unwrap block assist #4156
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-02 12:20:39 +02:00
Aleksey Kladov
b73dbbfbf2
Add missing members generates indented blocks
2020-05-02 11:53:07 +02:00
Aleksey Kladov
4f2134cc33
Introduce EffectExpr
2020-05-02 11:21:39 +02:00
Benjamin Coenen
df7899e47a
Add unwrap block assist #4156
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-01 16:41:29 +02:00
Benjamin Coenen
dc34162450
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer
2020-05-01 16:26:30 +02:00
Edwin Cheng
44f5e2048c
Remove lower_path from AssistCtx to Semantic
2020-05-01 20:05:12 +08:00
Edwin Cheng
bdcf6f5658
Introduce LowerCtx for path lowering
2020-05-01 20:01:17 +08:00
Benjamin Coenen
bbe22640b8
Add unwrap block assist #4156
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-29 14:53:47 +02:00
Aleksey Kladov
b4dd475257
More principled approach for finding From trait
2020-04-29 14:51:44 +02:00
Benjamin Coenen
76733f0cd4
Add unwrap block assist #4156
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-29 14:08:30 +02:00
Aleksey Kladov
7c3c289dab
Use specific pattern when translating if-let-else to match
...
We *probably* should actually use the same machinery here, as we do
for fill match arms, but just special-casing options and results seems
to be a good first step.
2020-04-29 11:59:11 +02:00