Aleksey Kladov
f9707cde68
Rename expr -> tail_expr
2021-01-05 15:51:13 +03:00
Michael-F-Bryan
7b4b4ef026
Created an inline-function assist ( fixes #6863 )
2021-01-05 04:18:57 +08:00
Aleksey Kladov
46afdb6e9b
rename exrtract_assignment -> pull
...
Vertical code motions are conventionally called "pull up" / "push
down".
"extract" is used for introducing new names.
2021-01-04 16:41:57 +03:00
Jesse Bakker
ba4c42af02
Support assignment to FieldExpr for extract_assignment assist
2021-01-03 15:46:57 +01:00
bors[bot]
520b8a5a4d
Merge #7115
...
7115: Migrate HasSource::source to return Option r=matklad a=nick96
I've made a start on fixing #6913 based on the provided work plan, migrating `HasSource::source` to return an `Option`. The simple cases are migrated but there are a few that I'm unsure exactly how they should be handled:
- Logging the processing of functions in `AnalysisStatsCmd::run`: In verbose mode it includes the path to the module containing the function and the syntax range. I've handled this with an if-let but would it be better to blow up here with `expect`? I'm not 100% on the code paths but if we're processing a function definition then the source should exist.
I've handled `source()` in all code paths as `None` being a valid return value but are there some cases where we should just blow up? Also, all I've done is bubble up the returned `None`s, there may be some places where we can recover and still provide something.
Co-authored-by: Nick Spain <nicholas.spain@stileeducation.com>
Co-authored-by: Nick Spain <nicholas.spain96@gmail.com>
2021-01-03 08:56:17 +00:00
cynecx
59fe884ef5
Fix warnings on rust-nightly
2021-01-02 20:48:39 +01:00
Jesse Bakker
bfe6a8e71a
Add support for MatchExpr to extract_assigment assist
2021-01-02 17:10:46 +01:00
Jesse Bakker
31204e3590
Add extract-assignment assist
2021-01-02 16:59:01 +01:00
Nick Spain
6800c606ec
Handle missing source in target_data_for_def
2021-01-02 21:53:52 +11:00
Nick Spain
0a9b735240
Handle missing source in filter_assoc_items
2021-01-02 21:53:52 +11:00
Nick Spain
1c009c9f12
Go back to use of source_old() in offset_target_and_file_id as it's not as simple as I thought
2021-01-02 21:53:52 +11:00
Nick Spain
c936e4b86f
source_old -> source for cases that can be handled by simple bubbling
2021-01-02 21:53:52 +11:00
Nick Spain
ea4708c444
Mark HasSource::source_old as deprecated but allow at all call sites
2021-01-02 21:53:51 +11:00
Nick Spain
27cadcd531
HasSource::source -> HasSource::source_old
...
To start migrating HasSource::source to return an Option.
2021-01-02 21:53:51 +11:00
bors[bot]
0e5fe47153
Merge #7080
...
7080: Implement ConstParams for HIR r=Veykril a=Veykril
r? @flodiebold
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-01 13:45:10 +00:00
Lukas Wirth
18bf2e5af5
Add ConstParams to the ide layer
2021-01-01 14:43:16 +01:00
kjeremy
dc1396eec7
Update crates
2020-12-30 10:39:50 -05:00
Laurențiu Nicola
42c24ff25f
Avoid a couple of allocations
2020-12-29 14:35:49 +02:00
Aleksey Kladov
2f22675537
Simplify assists resolution API
...
Assist vs UnresolvedAssist split doesn't really pull its weight. This
is especially bad if we want to include `Assist` as a field of
diagnostics, where we'd have to make the thing generic.
2020-12-26 14:11:42 +03:00
bors[bot]
44893bbcc5
Merge #7038
...
7038: Fix type typo in add_missing_impl_members doc r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-25 17:17:14 +00:00
Lukas Wirth
e7dd73ea9e
Fix type typo in add_missing_impl_members doc
2020-12-25 18:15:31 +01:00
Aleksey Kladov
2c84c2d07a
Don't think that /submod.rs is /mod.rs
2020-12-23 11:02:42 +03:00
Aleksey Kladov
41bc32368e
Improve extract_module_to_file assist
...
* simplify code
* correctly handle crate roots and mod.rs files (nested inline modules
are still mishandled)
* make sure that new text contains a trailing newline
2020-12-22 19:13:53 +03:00
bors[bot]
b98ee075ee
Merge #6746
...
6746: Feature/add assist extract module to file r=matklad a=sasurau4
Fix #6522
## Screenshot
<img src="https://user-images.githubusercontent.com/13580199/102748269-33a44300-43a5-11eb-9e37-f5fcb8e62f73.gif " width=600 />
## TODO
- [x] Remove all TODO comment
- [x] Pass the doc test
Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2020-12-22 10:04:24 +00:00
Rüdiger Herrmann
658ba9e29c
Delete related whitespace when removing unused param
...
Include adjacent whitespace in the text edits to remove the
parameter declaration and its occurences in calling code.
https://github.com/rust-analyzer/rust-analyzer/issues/6663
2020-12-21 18:42:42 +01:00
Jesse Bakker
2e7abf8384
Remove parentheses when inverting !(cond)
2020-12-21 17:37:38 +01:00
Daiki Ihara
66fd262962
Fix assist test logic
2020-12-21 15:55:40 +09:00
Daiki Ihara
7a2eebde22
Add initial_contents field for CreateFile
2020-12-21 15:55:40 +09:00
Daiki Ihara
414576fb30
Add extract_module_to_file assist
2020-12-21 15:55:40 +09:00
Daiki Ihara
c8f5792a36
Add handling file_system_edit in test assists
2020-12-21 15:52:02 +09:00
Aleksey Kladov
f6ed16674c
Align code_model name with ungrammar
2020-12-20 10:05:24 +03:00
Aleksey Kladov
cd4a7bf36e
Minor, cleanup API
2020-12-18 19:50:00 +03:00
bors[bot]
067067a6c1
Merge #6896
...
6896: Node-ify lifetimes r=jonas-schievink a=Veykril
Let's see if this passes the tests 🤞
Depends on https://github.com/rust-analyzer/ungrammar/pull/15
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-16 17:08:03 +00:00
Lukas Wirth
dd496223f5
Node-ify lifetimes
2020-12-16 14:16:09 +01:00
bors[bot]
c1c36acb02
Merge #6861
...
6861: generate default implementation for an enum from an enum variant #6860 r=matklad a=bnjjj
close #6860
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-12-16 08:36:05 +00:00
bors[bot]
ece626fe81
Merge #6894
...
6894: Parenthesize composite if condition before inverting in invert-if assist r=matklad a=Jesse-Bakker
Fixes #6867
Co-authored-by: Jesse Bakker <github@jessebakker.com>
2020-12-16 08:20:11 +00:00
Benjamin Coenen
2c82a1aec7
generate default implementation for an enum from an enum variant #6860
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-12-15 21:35:41 +01:00
Jesse Bakker
0f42a71806
Parenthesize composite if condition before inverting in invert-if assist
2020-12-15 16:25:57 +01:00
Aleksey Kladov
c582e52a1b
Use standard test style
2020-12-15 11:53:16 +03:00
Benjamin Coenen
490475ee19
generate default implementation for an enum from an enum variant #6860
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-12-15 09:46:02 +01:00
Benjamin Coenen
08090d81b1
generate default implementation for an enum from an enum variant #6860
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-12-14 09:44:24 +01:00
bors[bot]
a15d19619e
Merge #6845
...
6845: Don't HirDisplay unknown types when displaying for source r=Veykril a=Veykril
Was wondering why the add missing impl assist didn't do anything here:
![Code_JCA1Qo0V9P](https://user-images.githubusercontent.com/3757771/101990300-7af44a80-3ca6-11eb-8431-e5eb4de4e78c.png )
Turns out me forgetting to set the Index::Idx type in the trait causes RA to panic due to it trying to to create an unparsable type in the `make` module.
Now we get this instead which imo is definitely better to have.
![Code_MUFPJUCULY](https://user-images.githubusercontent.com/3757771/101990347-c9094e00-3ca6-11eb-9c6a-146bddf64b7c.png )
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-12 18:06:36 +00:00
Lukas Wirth
69b78edb5e
Don't HirDisplay unknown types when displaying for source
2020-12-12 19:05:00 +01:00
Jeremy Kolb
26a1675764
Remove some redundant allocations
2020-12-12 12:27:09 -05:00
Lukas Wirth
11f8664182
Add Lifetimes to the HIR
2020-12-12 00:56:52 +01:00
Aleksey Kladov
17f236c2b0
Normalize spelling to American English
2020-12-10 17:51:56 +03:00
Lukas Wirth
44c76d6550
Add replace_match_with_if_let assist
2020-12-05 15:41:36 +01:00
Lukas Wirth
ec94657077
Fix use merging not using the first path segment
2020-11-30 17:21:07 +01:00
Aleksey Kladov
8c3472b6f9
Minor cleanup
2020-11-30 13:47:38 +03:00
Kirill Bulatov
3f612d37c6
Move the helpers into ide_db
2020-11-28 16:30:39 +02:00