aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast
Commit message (Collapse)AuthorAgeFilesLines
* fix: don't add extra whitespace around fieldsAleksey Kladov2021-05-171-0/+4
| | | | closes #8785
* internal: use mutable syntax trees when filling fieldsAleksey Kladov2021-05-162-98/+42
|
* internal: use mutable trees when filling match armsAleksey Kladov2021-05-162-126/+69
|
* Merge #8813bors[bot]2021-05-161-20/+61
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
| * Support length for ByteStringsJade2021-05-131-20/+61
| | | | | | | | I am not confident that my added byte string parsing is right.
* | internal: use more mutable APIsAleksey Kladov2021-05-142-35/+17
| |
* | internal: rewrite assoc item manipulaion to use mutable treesAleksey Kladov2021-05-143-153/+72
| |
* | internal: remove SyntaxRewriterAleksey Kladov2021-05-141-48/+3
| |
* | internal: remove more of the SyntaxRewriterAleksey Kladov2021-05-141-29/+31
| |
* | internal: remove one more immutable treeAleksey Kladov2021-05-141-8/+2
|/
* simplifyAleksey Kladov2021-05-101-0/+3
|
* internal: introduce `ast::make::ext` module with common shortcutsAleksey Kladov2021-05-091-43/+52
| | | | | | | | | | There's a tension between keeping a well-architectured minimal orthogonal set of constructs, and providing convenience functions. Relieve this pressure by introducing an dedicated module for non-orthogonal shortcuts. This is inspired by the django.shortcuts module which serves a similar purpose architecturally.
* internal: fix make APIAleksey Kladov2021-05-091-8/+31
|
* internal: rewrite **Repalce impl Trait** assist to mutable syntax treesAleksey Kladov2021-05-091-12/+7
|
* cleanupsAleksey Kladov2021-05-091-2/+2
|
* minor: remove dead codeAleksey Kladov2021-05-081-11/+1
|
* internal: pull_assignment_up uses mutable treesAleksey Kladov2021-05-081-0/+3
|
* fix: use raw idents in `make::name{_ref}` with keywordsJonas Schievink2021-05-071-2/+12
|
* Hide implementation details of TokenTextDawer2021-05-061-2/+2
|
* Clean upDawer2021-05-061-15/+2
|
* Borrow text from nodes of immutable syntax treesDawer2021-05-061-9/+27
|
* Adapt to a new rowan borrowing node API.Dawer2021-05-061-1/+1
|
* Split out merge_imports module from helpers::insert_useLukas Wirth2021-04-241-1/+21
|
* Merge #8591 #8638bors[bot]2021-04-231-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | 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]>
* \ 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
| | |
* | | Add support for fill match arms of boolean valuesComonad2021-04-211-0/+8
| | | | | | | | | | | | - Add support for boolean inside tuple
| | * Remove SyntaxRewriter usage in insert_use in favor of tedLukas Wirth2021-04-201-0/+1
| |/ |/|
* | Merge #8578bors[bot]2021-04-191-0/+12
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 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-191-0/+12
| | | | | | | | | | | | closes #8541
| | |
| \ \
*-. \ \ Merge #8524 #8527bors[bot]2021-04-191-0/+153
|\ \ \ \ | |_|/ / |/| | / | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-141-0/+64
| |/
* / Fill match arms for a tuple of a single enum.Dawer2021-04-161-6/+12
|/
* Basic Support Macro 2.0Edwin Cheng2021-03-271-0/+1
|
* Add TokenTextAleksey Kladov2021-03-261-7/+10
|
* 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-251-8/+8
|
* Simplify codeAleksey Kladov2021-03-231-2/+3
| | | | changelog: skip
* rewrite merge use trees assist to use muatable syntax treesAleksey Kladov2021-03-223-42/+50
| | | | changelog internal
* a lot of clippy::style fixesMatthias Krüger2021-03-214-41/+29
|
* 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-211-1/+1
|
* Don't use an untyped String for ActiveParam trackingLukas Wirth2021-03-201-0/+9
|
* Move `AttrsOwnerNode` to syntax and make it publicJonas Schievink2021-03-191-0/+30
|
* Make ast editing more ergonomicAleksey Kladov2021-03-191-21/+20
| | | | changelog internal
* Parse extended_key_value_attributesLukas Wirth2021-03-192-33/+23
|
* Better handling of block doc commentsLukas Wirth2021-03-172-22/+13
|