aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge #8773bors[bot]2021-05-081-1/+1
|\ | | | | | | | | | | | | | | 8773: fix: Correctly support SelfType when searching for usages r=Veykril a=Veykril Fixes #7443 Co-authored-by: Lukas Wirth <[email protected]>
| * Correctly support SelfType when searching for usagesLukas Wirth2021-05-081-1/+1
| |
* | feat: add "mentoring instructions" test for pull up assistAleksey Kladov2021-05-081-1/+32
| |
* | internal: pull_assignment_up uses mutable treesAleksey Kladov2021-05-081-69/+68
| |
* | minor: add missing testAleksey Kladov2021-05-081-16/+36
|/
* internal: remove one more usage of SyntaxRewriterAleksey Kladov2021-05-081-56/+46
|
* internal: remove one more syntax rewriterAleksey Kladov2021-05-082-64/+34
|
* Merge #8711bors[bot]2021-05-043-14/+326
|\ | | | | | | | | | | | | | | | | | | 8711: Only resolve selected assist r=matklad a=SomeoneToIgnore Part of https://github.com/rust-analyzer/rust-analyzer/issues/8700 Now resolves only the assist that was selected out of the list, while before the whole assist list was resolved despite a single popup selection. Co-authored-by: Kirill Bulatov <[email protected]>
| * Index retrieval fixKirill Bulatov2021-05-031-1/+1
| |
| * Small fixesKirill Bulatov2021-05-031-2/+2
| |
| * Tests addedKirill Bulatov2021-05-031-1/+242
| |
| * Add docs and use better namingKirill Bulatov2021-05-031-5/+20
| |
| * Resolve single assist onlyKirill Bulatov2021-05-031-3/+36
| |
| * Add a way to resolve certain assistsKirill Bulatov2021-05-033-16/+39
| |
* | internal: remove one more usage of the rewriterAleksey Kladov2021-05-042-23/+49
| |
* | Don't mutate the tree while traversing in reorder_implLukas Tobias Wirth2021-05-031-4/+36
|/
* internal: fix naming polarityAleksey Kladov2021-04-302-2/+2
| | | | | Type Constructors have *parameters*, when they are substituted with type *arguments*, we have a type.
* internal: normalize nameAleksey Kladov2021-04-301-1/+1
| | | | All def types in hir are unsubstituted
* Split out merge_imports module from helpers::insert_useLukas Wirth2021-04-242-5/+2
|
*-. Merge #8591 #8638bors[bot]2021-04-237-152/+164
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8591: Remove SyntaxRewriter usage in insert_use in favor of mutable syntax trees r=matklad a=Veykril Unfortunately changing `insert_use` to not use `SyntaxRewriter` creates a lot of changes since so much relies on that. But on the other hand this should be the biggest usage of `SyntaxRewriter` I believe. 8638: Remove SyntaxRewriter::from_fn r=Veykril a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
| | * Remove SyntaxRewriter::from_fnLukas Wirth2021-04-232-15/+21
| |/ |/|
* | Merge #8317bors[bot]2021-04-233-0/+559
|\ \ | | | | | | | | | | | | | | | | | | | | | 8317: Convert tuple struct to named struct assist r=Veykril a=unexge Closes https://github.com/rust-analyzer/rust-analyzer/issues/8192 Co-authored-by: unexge <[email protected]>
| * | Add missing test case for "Convert to named struct" assistunexge2021-04-231-0/+40
| | |
| * | Stop iterating reference after made an edit in "Convert to named struct" assistunexge2021-04-231-2/+47
| | |
| * | Move reference editing logic into own function to make error handling more ↵unexge2021-04-221-68/+61
| | | | | | | | | | | | ease in "Convert to named struct" assist
| * | Add multi file test for "Convert to named struct" assistunexge2021-04-211-0/+33
| | |
| * | Remove `unwrap`s in "Convert to named struct" assistunexge2021-04-211-9/+19
| | |
| * | Add larger example for "Convert to named struct" assistunexge2021-04-212-8/+60
| | |
| * | Fix incorrectly replacing method calls in "Convert to named struct" assistunexge2021-04-211-17/+41
| | |
| * | Add convert tuple struct to named struct assistunexge2021-04-043-0/+362
| | |
* | | Merge #8620bors[bot]2021-04-221-14/+22
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8620: Remove unnecessary braces for extracted block expression r=Veykril a=brandondong This change addresses the first bullet point of https://github.com/rust-analyzer/rust-analyzer/issues/7839. Specifically, when extracting block expressions, remove the unneeded extra braces inside the generated function. Co-authored-by: Brandon <[email protected]>
| * | | Remove unnecessary braces for extracted block expressionBrandon2021-04-221-14/+22
| | | |
* | | | Add support for fill match arms of boolean valuesComonad2021-04-211-23/+199
| | | | | | | | | | | | | | | | - Add support for boolean inside tuple
* | | | Merge #8602bors[bot]2021-04-201-28/+45
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8602: Fix panic in `replace_derive_with_manual_impl` r=jonas-schievink a=jonas-schievink bors r+ Co-authored-by: Jonas Schievink <[email protected]>
| * | | | Follow testing style guideJonas Schievink2021-04-201-28/+28
| | | | |
| * | | | Fix panic in `replace_derive_with_manual_impl`Jonas Schievink2021-04-201-0/+17
| |/ / /
* / / / "Inline variable" when on a use of the variableJonas Schievink2021-04-201-38/+185
|/ / /
| | * Don't filter equal nodes in reorder assistsLukas Wirth2021-04-212-10/+6
| | |
| | * Add cov_marks to insert_use testsLukas Wirth2021-04-203-39/+36
| | |
| | * Rewrite extract_struct_from_enum_variant assistLukas Wirth2021-04-201-85/+91
| | |
| | * Remove SyntaxRewriter usage in insert_use in favor of tedLukas Wirth2021-04-203-59/+62
| | |
| | * Replace SyntaxRewriter usage with ted in reorder_impl assistLukas Wirth2021-04-201-9/+13
| |/ |/|
* | Add autoimport test with inner itemsJonas Schievink2021-04-191-0/+33
| |
* | Merge #8583bors[bot]2021-04-191-23/+14
|\ \ | | | | | | | | | | | | | | | | | | | | | 8583: Simplify r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
| * | SimplifyLukas Wirth2021-04-191-23/+14
| | |
| | |
| \ \
*-. \ \ Merge #8524 #8527bors[bot]2021-04-192-38/+138
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8524: Fix extract function with partial block selection r=matklad a=brandondong **Reproduction:** ```rust fn foo() { let n = 1; let mut v = $0n * n;$0 v += 1; } ``` 1. Select the snippet ($0) and use the "Extract into function" assist. 2. Extracted function is incorrect and does not compile: ```rust fn foo() { let n = 1; let mut v = fun_name(n); v += 1; } fn fun_name(n: i32) {} ``` 3. Omitting the ending semicolon from the selection fixes the extracted function: ```rust fn fun_name(n: i32) -> i32 { n * n } ``` **Cause:** - When `extraction_target` uses a block extraction (semicolon case) instead of an expression extraction (no semicolon case), the user selection is directly used as the TextRange. - However, the existing function extraction logic for blocks requires that the TextRange spans from start to end of complete statements to work correctly. - For example: ```rust fn foo() { let m = 2; let n = 1; let mut v = m $0* n; let mut w = 3;$0 v += 1; w += 1; } ``` produces ```rust fn foo() { let m = 2; let n = 1; let mut v = m let mut w = fun_name(n); v += 1; w += 1; } fn fun_name(n: i32) -> i32 { let mut w = 3; w } ``` - The user selected TextRange is directly replaced by the function call which is now in the middle of another statement. The extracted function body only contains statements that were fully covered by the TextRange and so the `* n` code is deleted. The logic for calculating variable usage and outlived variables for the function parameters and return type respectively search within the TextRange and so do not include `m` or `v`. **Fix:** - Only extract full statements when using block extraction. If a user selected part of a statement, extract that full statement. 8527: Switch introduce_named_lifetime assist to use mutable syntax tree r=matklad a=iDawer This extends `GenericParamsOwnerEdit` trait with `get_or_create_generic_param_list` method Co-authored-by: Brandon <[email protected]> Co-authored-by: Dawer <[email protected]>
| | * | Switch introduce_named_lifetime assist to use mutable syntax treeDawer2021-04-141-36/+76
| | | |
| * | | Fix extract function with partial block selectionBrandon2021-04-151-2/+62
| | | |
* | | | Merge #8565bors[bot]2021-04-191-28/+100
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8565: Fill match arms assist: add remaining arms for tuple of enums r=iDawer a=iDawer Fix for #8493 However, the assist is still flaky and does not use `hir_ty::diagnostics::match_check` Co-authored-by: Dawer <[email protected]>
| * | | | Unindent test according to the style guide.Dawer2021-04-191-23/+23
| | | | |