aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/handlers
Commit message (Collapse)AuthorAgeFilesLines
* Don't inline mutable locals in 'inline_local_variable'Lukas Wirth2021-06-041-0/+17
|
* NFC: remove redundant clones (clippy::perf)Matthias Krüger2021-06-031-1/+1
|
* Preserve indentationJonas Schievink2021-06-021-5/+30
|
* Account for traitsJonas Schievink2021-06-021-10/+29
|
* Merge #9108bors[bot]2021-06-021-2/+31
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9108: Don't show extract into variable assist for unit expressions r=jonas-schievink a=brandondong **Reproduction:** ```rust fn main() { let mut i = 3; $0if i >= 0 { i += 1; } else { i -= 1; }$0 } ``` 1. Select the snippet of code between the $0's. 2. The extract into variable assist shows up, pushing down the more useful extract into function assist. 3. The resulting output of selecting the extract into variable assist is valid but with the extracted variable having the unit type: ```rust fn main() { let mut i = 3; let var_name = if i >= 0 { i += 1; } else { i -= 1; }; var_name } ``` **Fix:** - Don't show the extract into variable assist for unit expressions. I could not think of any scenarios where such a variable extraction would be desired. Co-authored-by: Brandon <[email protected]>
| * Don't show extract into variable assist for unit expressionsBrandon2021-06-021-2/+31
| |
* | Merge #9112bors[bot]2021-06-021-44/+125
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9112: Fix some bugs in `extract_struct_from_enum_variant` assist r=Veykril a=Veykril bors r+ Fixes #9100 Fixes #9099 Kind of fixes #9109, it now copies all the generics might be incorrect if the variant doesn't use all of them) Co-authored-by: Lukas Wirth <[email protected]>
| * | Fix references to patterns in extract_struct_from_enum_variant assistLukas Wirth2021-06-021-26/+51
| | |
| * | Carry over attributes in extract_struct_from_enum_variantLukas Wirth2021-06-021-5/+32
| | |
| * | Account for generics in extract_struct_from_enum_variantLukas Wirth2021-06-021-17/+46
| |/
* / Place extracted type alias outside of implJonas Schievink2021-06-021-1/+27
|/
* clippy::redundant_clone fixesLaurențiu Nicola2021-05-261-1/+1
|
* add test that it does not create extraneous commasDomantas Jadenkus2021-05-241-0/+20
|
* generate match arms with todo!() as placeholder bodyDomantas Jadenkus2021-05-241-54/+74
|
* Merge #8945bors[bot]2021-05-231-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | 8945: fix: Make expected type work in more situations r=flodiebold a=flodiebold Also makes call info show the correct types for generic methods. ![2021-05-23-182952_1134x616_scrot](https://user-images.githubusercontent.com/906069/119269023-dd5a5b00-bbf5-11eb-993a-b6e122c3b9a6.png) ![2021-05-23-183117_922x696_scrot](https://user-images.githubusercontent.com/906069/119269025-dfbcb500-bbf5-11eb-983c-fc415b8428e0.png) Co-authored-by: Florian Diebold <[email protected]>
| * Get rid of field_type againFlorian Diebold2021-05-231-1/+1
| |
* | feat: generate getter avoids generating types like `&Vec<T>`Aleksey Kladov2021-05-231-7/+106
| |
* | feat: generate getter assist places the cursor at the generated functionAleksey Kladov2021-05-231-7/+12
| |
* | minimize testsAleksey Kladov2021-05-231-44/+54
| |
* | remove duplicate testsAleksey Kladov2021-05-231-103/+26
| |
* | reduce duplicationAleksey Kladov2021-05-232-208/+160
|/
* Merge #8901bors[bot]2021-05-221-25/+56
|\ | | | | | | | | | | | | | | | | | | | | 8901: fix: `fill_match_arms` hangs on a tuple of large enums r=matklad a=iDawer + Lazy computation of missing arms. + Convenience function to test lazy computation: `ide_assists::tests::check_assist_unresolved`. Fixes #8835 Co-authored-by: Dawer <[email protected]>
| * Test `fill_match_arms` for lazy computation.Dawer2021-05-211-1/+19
| | | | | | | | This also adds `ide_assists::tests::check_assist_unresolved` function.
| * fix: `fill_match_arms` hangs on a tuple of large enumsDawer2021-05-201-2/+14
| |
| * Compute missing arms lazily.Dawer2021-05-201-23/+24
| |
* | Merge #8897bors[bot]2021-05-201-0/+14
|\ \ | | | | | | | | | | | | | | | | | | | | | 8897: minor: Don't compare ast::Visibility by stringifying r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Tobias Wirth <[email protected]>
| * | Don't compare ast::Visibility by stringifyingLukas Tobias Wirth2021-05-201-0/+14
| |/
* / Update outdated auto-import documentationLukas Tobias Wirth2021-05-201-9/+8
|/
* add_explicit_type respects `@` patternsDawer2021-05-191-5/+20
|
* Extract function assist will add async if requiredJamie Cunliffe2021-05-171-2/+63
| | | | | The extract function assist will check for an AWAIT_EXPR in the body and if found, will add async to the generated function.
* Merge #8845bors[bot]2021-05-161-12/+275
|\ | | | | | | | | | | | | | | 8845: Generate the impl block via generate_trait_impl_text_from_impl r=Veykril a=hi-rustin Try to close https://github.com/rust-analyzer/rust-analyzer/issues/8827 Co-authored-by: hi-rustin <[email protected]>
| * Remove attrshi-rustin2021-05-151-5/+1
| |
| * Address comments and add more testshi-rustin2021-05-151-25/+249
| | | | | | | | | | | | Fix tests Fmt code
| * Generate the impl block via generate_trait_impl_texthi-rustin2021-05-151-2/+45
| |
* | internal: use standard test styleAleksey Kladov2021-05-161-304/+305
| |
* | internal: use mutable trees when filling match armsAleksey Kladov2021-05-161-8/+20
| |
* | minor: use uniform namesAleksey Kladov2021-05-1611-27/+26
| |
* | Merge #8813bors[bot]2021-05-163-2/+30
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | 8813: Get some more array lengths! r=lf- a=lf- This is built on #8799 and thus contains its changes. I'll rebase it onto master when that one gets merged. It adds support for r-a understanding the length of: * `let a: [u8; 2] = ...` * `let a = b"aaa"` * `let a = [0u8; 4]` I have added support for getting the values of byte strings, which was not previously there. I am least confident in the correctness of this part and it probably needs some more tests, as we currently have only one test that exercised that part (!). Fixes #2922. Co-authored-by: Jade <[email protected]>
| * Add more tests, refactor array lengths/consteval workJade2021-05-141-0/+28
| | | | | | | | | | | | | | | | | | | | | | Fix #2922: add unknown length as a condition for a type having unknown. Incorporate reviews: * Extract some of the const evaluation workings into functions * Add fixmes on the hacks * Add tests for impls on specific array lengths (these work!!! 😁) * Add tests for const generics (indeed we don't support it yet)
| * Support length for ByteStringsJade2021-05-132-2/+2
| | | | | | | | I am not confident that my added byte string parsing is right.
* | internal: use standard style for testsAleksey Kladov2021-05-141-54/+99
| |
* | internal: rewrite assoc item manipulaion to use mutable treesAleksey Kladov2021-05-141-1/+2
| |
* | Merge #8814bors[bot]2021-05-131-5/+33
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 8814: fix: Keep doc comments and outer attrs on "Move module to file" assist r=Veykril a=Jesse-Bakker Fixes #8804 Co-authored-by: Jesse Bakker <[email protected]>
| * | fix: Keep doc comments and outer attrs on "Move module to file" assistJesse Bakker2021-05-131-5/+33
| | |
* | | Merge #8820bors[bot]2021-05-131-0/+26
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8820: fix: Return absolute paths in find_path if crate start is ambiguous r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
| * | | Return absolute paths in find_path if crate start is ambiguousLukas Wirth2021-05-131-0/+26
| | | |
* | | | Corrected minor typo on line 20mixio2021-05-131-1/+1
| |_|/ |/| |
* | | Merge #8802bors[bot]2021-05-121-9/+126
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | 8802: Keep comments and attrs when extracting struct from enum variant r=Veykril a=DropDemBits Fixes #6730 Still unsure if existing visibilities of fields should be forced to pub (which is what was previously done), or if it's okay to keep it in the extracted struct. Co-authored-by: DropDemBits <[email protected]>
| * | Keep comments and attrs when extracting struct from enum variantDropDemBits2021-05-111-9/+126
| | |
* | | Merge #8800bors[bot]2021-05-111-16/+34
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | 8800: feat: Make "pull assignments up" assist work in more cases r=Jesse-Bakker a=Jesse-Bakker Fixes #8771 Co-authored-by: Jesse Bakker <[email protected]>