aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
Commit message (Collapse)AuthorAgeFilesLines
...
| | * Remove SyntaxRewriter::from_fnLukas Wirth2021-04-231-16/+3
| |/ |/|
* | Merge #8317bors[bot]2021-04-231-0/+26
|\ \ | | | | | | | | | | | | | | | | | | | | | 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 convert tuple struct to named struct assistunexge2021-04-041-0/+26
| | |
* | | Bump rustc_lexerLaurențiu Nicola2021-04-211-1/+1
| | |
* | | Add support for fill match arms of boolean valuesComonad2021-04-211-0/+8
| | | | | | | | | | | | - Add support for boolean inside tuple
* | | Parse outer atttributes for RecordPatFieldLukas Wirth2021-04-212-6/+53
| | |
| | * Remove SyntaxRewriter usage in insert_use in favor of tedLukas Wirth2021-04-202-2/+16
| |/ |/|
* | Merge #8578bors[bot]2021-04-195-180/+236
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 8578: fix: false positive about inner attrs in docs r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | fix: false positive about inner attrs in docsAleksey Kladov2021-04-195-180/+236
| | | | | | | | | | | | closes #8541
| | |
| \ \
*-. \ \ Merge #8524 #8527bors[bot]2021-04-192-0/+160
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
| | * | Finish GenericParamsOwnerEdit implsDawer2021-04-151-5/+94
| | | |
| | * | Switch introduce_named_lifetime assist to use mutable syntax treeDawer2021-04-142-0/+71
| |/ /
* | | hir_ty: Expand macros at type positioncynecx2021-04-171-23/+25
| | |
* | | nail rowan version downBernhard Schuster2021-04-171-1/+1
| | | | | | | | | The different pre versions include breaking changes, which cause build failures for the users.
* | | Fill match arms for a tuple of a single enum.Dawer2021-04-161-6/+12
|/ /
* | Update crateskjeremy2021-04-071-1/+1
| |
* | Use arrayvec 0.7 to avoid perf regression in 0.6.1kjeremy2021-04-051-1/+1
|/ | | | See: https://github.com/bluss/arrayvec/issues/182
* Add support for doc on hover for macro 2.0Edwin Cheng2021-03-271-2/+2
|
* Basic Support Macro 2.0Edwin Cheng2021-03-271-0/+1
|
* Add TokenTextAleksey Kladov2021-03-263-7/+89
|
* syntax: return owned string instead of leaking stringcynecx2021-03-262-10/+8
|
* Use more std::array::IntoIterLaurențiu Nicola2021-03-251-4/+3
|
* Use arrayvec 0.6Laurențiu Nicola2021-03-252-9/+9
|
* Simplify codeAleksey Kladov2021-03-231-2/+3
| | | | changelog: skip
* rewrite merge use trees assist to use muatable syntax treesAleksey Kladov2021-03-224-46/+74
| | | | changelog internal
* :arrow_up: rowanAleksey Kladov2021-03-221-1/+1
|
* a lot of clippy::style fixesMatthias Krüger2021-03-216-44/+32
|
* clippy::complexity simplifications related to IteratorsMatthias Krüger2021-03-211-2/+1
|
* use strip_prefix() instead of starts_with and slicing (clippy::manual_strip)Matthias Krüger2021-03-211-2/+1
|
* remove more redundant clones (clippy::redundant_clone())Matthias Krüger2021-03-212-3/+3
|
* Don't use an untyped String for ActiveParam trackingLukas Wirth2021-03-201-0/+9
|
* Move `AttrsOwnerNode` to syntax and make it publicJonas Schievink2021-03-192-2/+32
|
* Make ast editing more ergonomicAleksey Kladov2021-03-192-40/+66
| | | | changelog internal
* Parse extended_key_value_attributesLukas Wirth2021-03-192-33/+23
|
* Correctly parse attributes on fn parametersJonas Schievink2021-03-172-49/+49
|
* Better handling of block doc commentsLukas Wirth2021-03-173-35/+29
|
* Merge #8059bors[bot]2021-03-171-1/+1
|\ | | | | | | | | | | | | | | 8059: Move doc-comment highlight injection from AST to HIR r=matklad,jonas-schievink a=Veykril Fixes #5016 Co-authored-by: Lukas Wirth <[email protected]>
| * Replace trait object boxing with extra AttrsOwnerNodeLukas Wirth2021-03-161-1/+1
| |
* | avoid converting types into themselves via .into() (clippy::useless-conversion)Matthias Krüger2021-03-172-2/+2
| | | | | | | | example: let x: String = String::from("hello world").into();
* | pit-of-successify tree editorAleksey Kladov2021-03-162-14/+17
| |
* | Auto-magical whitespaceAleksey Kladov2021-03-162-23/+58
| |
* | Move more boundsAleksey Kladov2021-03-161-10/+44
|/ | | | changelog: skip
* Upgrade rowanAleksey Kladov2021-03-169-26/+226
| | | | Notably, new rowan comes with support for mutable syntax trees.
* Fix macro expansion for statements w/o semicolonEdwin Cheng2021-03-161-2/+8
|
* Enable thread-local coverage marksLaurențiu Nicola2021-03-151-1/+1
|
* Attach trivia to ast::Union nodesLukas Wirth2021-03-141-2/+2
|
* Merge #7956bors[bot]2021-03-121-0/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7956: Add assist to convert for_each into for loops r=Veykril a=SaiintBrisson This PR resolves #7821. Adds an assist to that converts an `Iterator::for_each` into a for loop: ```rust fn main() { let vec = vec![(1, 2), (2, 3), (3, 4)]; x.iter().for_each(|(x, y)| { println!("x: {}, y: {}", x, y); }) } ``` becomes ```rust fn main() { let vec = vec![(1, 2), (2, 3), (3, 4)]; for (x, y) in x.iter() { println!("x: {}, y: {}", x, y); }); } ``` Co-authored-by: Luiz Carlos Mourão Paes de Carvalho <[email protected]> Co-authored-by: Luiz Carlos <[email protected]> Co-authored-by: Lukas Wirth <[email protected]>
| * feat: add expr_for_loop to make in syntaxLuiz Carlos Mourão Paes de Carvalho2021-03-101-0/+3
| |
* | cargo update and lexerkjeremy2021-03-101-1/+1
|/
*-. Merge #7873 #7933bors[bot]2021-03-094-1/+49
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7873: Consider unresolved qualifiers during flyimport r=matklad a=SomeoneToIgnore Closes https://github.com/rust-analyzer/rust-analyzer/issues/7679 Takes unresolved qualifiers into account, providing better completions (or none, if the path is resolved or do not match). Does not handle cases when both path qualifier and some trait has to be imported: there are many extra issues with those (such as overlapping imports, for instance) that will require large diffs to address. Also does not do a fuzzy search on qualifier, that requires some adjustments in `import_map` for better queries and changes to the default replace range which also seems relatively big to include here. ![qualifier_completion](https://user-images.githubusercontent.com/2690773/110040808-0af8dc00-7d4c-11eb-83db-65af94e843bb.gif) 7933: Improve compilation speed r=matklad a=matklad bors r+ 🤖 Co-authored-by: Kirill Bulatov <[email protected]> Co-authored-by: Aleksey Kladov <[email protected]>