aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * Do not propose already imported importsKirill Bulatov2021-03-081-1/+3
| |
| * Properly handle turbofishes in qualifiersKirill Bulatov2021-03-082-2/+2
| |
| * Return more data about located importsKirill Bulatov2021-03-082-9/+18
| |
| * Draft the qualifier import resolutionKirill Bulatov2021-03-081-3/+6
| |
| * Test and initial refactoringKirill Bulatov2021-03-082-37/+2
| |
* | Merge #7898bors[bot]2021-03-081-6/+67
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7898: generate_function assist: infer return type r=JoshMcguigan a=JoshMcguigan This PR makes two changes to the generate function assist: 1. Attempt to infer an appropriate return type for the generated function 2. If a return type is inferred, and that return type is not unit, don't render the snippet ```rust fn main() { let x: u32 = foo$0(); // ^^^ trigger the assist to generate this function } // BEFORE fn foo() ${0:-> ()} { todo!() } // AFTER (only change 1) fn foo() ${0:-> u32} { todo!() } // AFTER (change 1 and 2, note the lack of snippet around the return type) fn foo() -> u32 { todo!() } ``` These changes are made as two commits, in case we want to omit change 2. I personally feel like it is a nice change, but I could understand there being some opposition. #### Pros of change 2 If we are able to infer a return type, and especially if that return type is not the unit type, the return type is almost as likely to be correct as the argument names/types. I think this becomes even more true as people learn how this feature works. #### Cons of change 2 We could never be as confident about the return type as we are about the function argument types, so it is more likely a user will want to change that. Plus it is a confusing UX to sometimes have the cursor highlight the return type after triggering this assist and sometimes not have that happen. #### Why omit unit type? The assumption is that if we infer the return type as unit, it is likely just because of the current structure of the code rather than that actually being the desired return type. However, this is obviously just a heuristic and will sometimes be wrong. But being wrong here just means falling back to the exact behavior that existed before this PR. Co-authored-by: Josh Mcguigan <[email protected]>
| * generate_function assist don't render snippet if ret type inferredJosh Mcguigan2021-03-081-26/+47
| |
| * generate_function assist infer return typeJosh Mcguigan2021-03-061-3/+43
| |
* | Use upstream cov-markLaurențiu Nicola2021-03-0823-150/+109
| |
* | Hygiene is an internal implementation detail of the compilerAleksey Kladov2021-03-082-4/+6
| |
* | Merge #7889bors[bot]2021-03-074-4/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | 7889: Make group imports configurable r=lnicola a=asv1 Co-authored-by: asv <[email protected]>
| * | Make group imports configurableasv2021-03-074-4/+4
| | |
* | | Merge #7896bors[bot]2021-03-061-59/+77
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7896: Only replace quotes in replace_string_with_char assist r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
| * | | Only replace quotes in replace_string_with_char assistLukas Wirth2021-03-061-59/+77
| | | |
* | | | Merge #7800bors[bot]2021-03-063-0/+407
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | 7800: [WIP] 7708: Initial implementation of generate Default assist. r=Veykril a=chetankhilosiya The Generate Default impl from new function. Co-authored-by: Chetan Khilosiya <[email protected]>
| * | | 7708: rust ideomatic code fixes.Chetan Khilosiya2021-03-061-9/+11
| | | |
| * | | 7708: handle both FamousDefs fixture and plain code.Chetan Khilosiya2021-03-061-8/+18
| | | | | | | | | | | | | | | | Also fix typo in example.
| * | | 7708: Added the updated implementation of is_default_implemented.Chetan Khilosiya2021-03-061-33/+31
| | | | | | | | | | | | | | | | The implementation uses hir create to find the implemented trait.
| * | | 7708: Added the logic to check is default impl is already present.Chetan Khilosiya2021-03-061-18/+97
| | | | | | | | | | | | | | | | Also added test cases for code present within module.
| * | | 7708: Updated generate default fn logic.Chetan Khilosiya2021-03-061-22/+48
| | | |
| * | | 7708: Added the work for review comments.Chetan Khilosiya2021-03-061-31/+60
| | | | | | | | | | | | | | | | Also added 1 test case to test multiple struct blocks are present.
| * | | 7708: Fixed many documentaion example issues.Chetan Khilosiya2021-03-062-6/+37
| | | |
| * | | 7708: Format code through rust-analyzer formatter.Chetan Khilosiya2021-03-061-35/+44
| | | |
| * | | 7708: Initial implementation of generate Default assist.Chetan Khilosiya2021-03-062-0/+223
| | |/ | |/| | | | | | | The Generate Default impl from new function.
* | | Merge #7865bors[bot]2021-03-061-1/+37
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | 7865: preserve escape sequences when replacing string with char r=Veykril a=jDomantas Currently it replaces escape sequence with the actual value, which is very wrong for `"\n"`. Co-authored-by: Domantas Jadenkus <[email protected]>
| * | preserve escape sequences when replacing string with charDomantas Jadenkus2021-03-031-1/+37
| | |
* | | generate function assist convert arg names to lower snake caseJosh Mcguigan2021-03-061-4/+52
| |/ |/|
* | Merge #7869bors[bot]2021-03-051-0/+43
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 7869: Add support for deref assignments to "pull assignment up" assist. r=Veykril a=Jesse-Bakker Fixes #7867 Co-authored-by: Jesse Bakker <[email protected]>
| * | Add support for deref assignments to "pull assignment up" assist.Jesse Bakker2021-03-051-0/+43
| |/ | | | | | | Fixes #7867
* | Merge #7880bors[bot]2021-03-051-2/+8
|\ \ | |/ |/| | | | | | | | | | | 7880: Honor snippet capability when using the extract function assist r=lnicola a=Arthamys This fixes issue #7793 Co-authored-by: san <[email protected]>
| * Honor snippet capability in extract function assistsan2021-03-051-2/+8
| |
* | Special-case parenthesized and negated expressions in demorgan assistJesse Bakker2021-03-031-2/+43
| |
* | Merge #7851bors[bot]2021-03-022-616/+424
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 7851: Compress tests r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Compress testsAleksey Kladov2021-03-022-616/+424
| | |
* | | chore: remove redundant testsConrad Ludgate2021-03-021-30/+0
| | |
* | | chore: codegenConrad Ludgate2021-03-021-19/+0
| | |
* | | refactor: re-use add_turbo_fish functionConrad Ludgate2021-03-023-201/+137
| | |
* | | chore: fmt + docsConrad Ludgate2021-03-021-2/+2
| | |
* | | chore: rename varConrad Ludgate2021-03-021-3/+3
| | |
* | | feat: add type ascription assistConrad Ludgate2021-03-023-0/+219
|/ /
* | strip useless methods, and unary ops in suggest_nameVladyslav Katasonov2021-03-021-7/+114
| |
* | pull out suggest_name::* to utils; enchance heuristicsVladyslav Katasonov2021-03-024-89/+821
| |
* | suggest parameter name before function nameVladyslav Katasonov2021-03-021-5/+5
| |
* | try to suggest name when extracting variableVladyslav Katasonov2021-03-021-7/+287
| |
* | Merge #7777bors[bot]2021-03-022-0/+421
|\ \ | |/ |/| | | | | | | | | | | 7777: Implement line<->block comment assist r=Veykril a=djrenren Fixes: https://github.com/rust-analyzer/rust-analyzer/issues/6515 Co-authored-by: John Renner <[email protected]>
| * Apply editsJohn Renner2021-03-011-51/+54
| |
| * Implement line<->block comment assistJohn Renner2021-02-252-0/+418
| |
* | Use consistent naming for assistAleksey Kladov2021-02-284-39/+39
| |
* | Don't spam loop-rewriting assistAleksey Kladov2021-02-282-2/+22
| | | | | | | | The more focused the assist, the better!
* | generate try_into instead of intoDomantas Jadenkus2021-02-273-72/+96
| |