aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/handlers
Commit message (Collapse)AuthorAgeFilesLines
* Switch introduce_named_lifetime assist to use mutable syntax treeDawer2021-04-141-36/+76
|
* Merge #8436bors[bot]2021-04-101-19/+109
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8436: Fix extract function's mutability of variables outliving the body r=matklad a=brandondong **Reproduction:** ```rust fn main() { let mut k = 1; let mut j = 2; j += 1; k += j; } ``` 1. Select the first to third lines of the main function. Use the "Extract into function" code assist. 2. The output is the following which does not compile because the outlived variable `k` is declared as immutable: ```rust fn main() { let (k, j) = fun_name(); k += j; } fn fun_name() -> (i32, i32) { let mut k = 1; let mut j = 2; j += 1; (k, j) } ``` 3. We would instead expect the output to be: ```rust fn main() { let (mut k, j) = fun_name(); k += j; } ``` **Fix:** - Instead of declaring outlived variables as immutable unconditionally, check for any mutable usages outside of the extracted function. Co-authored-by: Brandon <[email protected]>
| * Fix extract function's mutability of variables outliving the bodyBrandon2021-04-091-19/+109
| |
* | Insert unnamed consts to ChildBySource DynMapLukas Wirth2021-04-091-1/+1
| |
* | Merge #8207bors[bot]2021-04-081-11/+94
|\ \ | |/ |/| | | | | | | | | | | | | 8207: Show dbg remove assist on empty contents r=edwin0cheng a=ivan770 Closes #8185 Co-authored-by: ivan770 <[email protected]> Co-authored-by: ivan770 <[email protected]>
| * Apply test style fixes to all empty remove_dbg testsivan7702021-03-291-21/+17
| |
| * Update crates/ide_assists/src/handlers/remove_dbg.rs ivan7702021-03-291-5/+9
| | | | | | | | | | Apply standard test style fixes Co-authored-by: Aleksey Kladov <[email protected]>
| * Replace empty dbg with unit in letexprs, better removal in blocksivan7702021-03-271-13/+72
| |
| * Replace match on option with ifivan7702021-03-271-3/+4
| |
| * Remove dbg expression and newline as wholeivan7702021-03-271-6/+28
| |
| * Show dbg remove assist on empty contentsivan7702021-03-261-8/+9
| |
* | Merge #8339bors[bot]2021-04-051-18/+55
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 8339: fix: extract variable works in guards r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | fix: extract variable works in guardsAleksey Kladov2021-04-051-18/+55
| | | | | | | | | | | | closes #8336
* | | Merge #8326bors[bot]2021-04-051-39/+50
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | 8326: Rewrite reorder fields assist to use mutable syntax trees r=matklad a=Veykril This also instead uses `Either` to use the typed `RecordPat` and `RecordExpr` nodes, this unfortunately gives a bit of code duplication Co-authored-by: Lukas Wirth <[email protected]>
| * | Rewrite reorder fields assist to use mutable syntax treesLukas Wirth2021-04-031-39/+50
| | |
* | | Convert Into to From assistGraeme Coupar2021-04-031-0/+355
|/ / | | | | | | | | | | | | | | | | | | | | | | This adds a "Convert Into to From" assist, useful since clippy has recently started adding lints on every `Into`. It covers converting the signature, and converting any `self`/`Self` references within the body to the correct types. It does assume that every instance of `Into` can be converted to a `From`, which I _think_ is the case now. Let me know if there's something I'm not thinking of and I can try and make it smarter.
* | Merge #8210bors[bot]2021-03-311-0/+149
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 8210: Implement "Extract type alias" assist r=jonas-schievink a=jonas-schievink Co-authored-by: Jonas Schievink <[email protected]> Co-authored-by: Jonas Schievink <[email protected]>
| * | Don't use snippetsJonas Schievink2021-03-291-17/+12
| | |
| * | Use `find_node_at_range`Jonas Schievink2021-03-291-25/+3
| | |
| * | Snippet support in extract_type_aliasJonas Schievink2021-03-271-13/+24
| | |
| * | Implement "Extract type alias" assistJonas Schievink2021-03-261-0/+165
| |/
* | Merge #8267bors[bot]2021-03-311-0/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8267: Adding gifs and screenshots for features in manual r=matklad a=MozarellaMan For #6539 This includes most of gif or screenshot examples of most items in the "Features" header. With the exceptions of: - **On Typing Assists** - couldn't get it to work for a demo, I'm probably missing something? - **Structural search and replace** - looked to be already a visual example of the feature - **Workspace symbol** - wasn't sure how best to show this, all of the examples maybe? Also wasn't sure of the best code example to show it off - **Semantic Syntax Highlighting** - seemed obvious enough to not need a screenshot, but I could easily add this All the gifs/pngs are hosted in this [comment](https://github.com/rust-analyzer/rust-analyzer/issues/6539#issuecomment-809574840). Please let me know if any of them aren't suitable (and why) and I'll improve it! Or if you don't like the theme/font Co-authored-by: Ayomide Bamidele <[email protected]>
| * | Gifs and screenshots for features in manualAyomide Bamidele2021-03-311-0/+2
| | |
* | | Rename target_ty to self_tyLukas Wirth2021-03-292-2/+2
|/ /
* | Merge #8213bors[bot]2021-03-271-3/+14
|\ \ | | | | | | | | | | | | | | | | | | | | | 8213: Added support for const generics in impl generation r=Veykril a=ivan770 Closes #8211 Co-authored-by: ivan770 <[email protected]>
| * | Added support for const generics in impl generationivan7702021-03-271-3/+14
| |/
* / syntax: return owned string instead of leaking stringcynecx2021-03-264-5/+7
|/
* refine comment style of testshi-rustin2021-03-242-48/+48
|
* Merge #8168bors[bot]2021-03-241-7/+70
|\ | | | | | | | | | | | | | | 8168: correct `convert to guard return` let_stmt r=Veykril a=hi-rustin close https://github.com/rust-analyzer/rust-analyzer/issues/8074 Co-authored-by: hi-rustin <[email protected]>
| * correct `convert to guard return` let_stmthi-rustin2021-03-241-7/+70
| | | | | | | | | | | | | | | | fix fix add check
* | CleanupAleksey Kladov2021-03-231-67/+45
| |
* | Simplify codeAleksey Kladov2021-03-232-37/+15
| | | | | | | | changelog: skip
* | Use styleguide conforming import for ast nodesAleksey Kladov2021-03-231-34/+36
| |
* | Unify test styleAleksey Kladov2021-03-231-38/+52
| | | | | | | | changelog skip
* | Tweak assits API to fit mutable syntax treesAleksey Kladov2021-03-232-20/+12
|/ | | | changelog: skip
* rewrite merge use trees assist to use muatable syntax treesAleksey Kladov2021-03-222-37/+42
| | | | changelog internal
* clippy::complexity simplifications related to IteratorsMatthias Krüger2021-03-213-16/+10
|
* Less reallocationsKirill Bulatov2021-03-211-1/+0
|
* Disable unqualified assoc items completion for nowKirill Bulatov2021-03-201-0/+1
|
* DocsKirill Bulatov2021-03-201-2/+2
|
* Do not query item search by name eagerlyKirill Bulatov2021-03-201-15/+20
|
* Merge #8119bors[bot]2021-03-202-4/+3
|\ | | | | | | | | | | | | | | 8119: Don't return a SourceChange on WillRenameFiles when nothing gets refactored r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
| * Fix add_life_to_type label typoLukas Wirth2021-03-202-4/+3
| |
* | simplifyAleksey Kladov2021-03-191-3/+3
|/ | | | changelog skip
* Cleanup qualify_pathLukas Wirth2021-03-191-27/+17
|
* Fix associated items not being appended to paths in import_assetsLukas Wirth2021-03-181-2/+35
|
* use simpler .map(|x| y) instead of .and_then(|x| Some(y)) for Options. ↵Matthias Krüger2021-03-171-2/+2
| | | | (clippy::bind_instead_of_map)
* don't clone types that are copy (clippy::clone_on_copy)Matthias Krüger2021-03-171-5/+2
|
* Move more boundsAleksey Kladov2021-03-161-26/+10
| | | | changelog: skip
* Upgrade rowanAleksey Kladov2021-03-169-62/+34
| | | | Notably, new rowan comes with support for mutable syntax trees.